From 6e8298654a7d0de29192b88d769132cfc51c9ac7 Mon Sep 17 00:00:00 2001 From: vmallika Date: Wed, 1 Apr 2015 20:03:37 +0530 Subject: quota/disperse: handle inode quotas in xattr aggregate with the inode quota feature, quota size is now increased from 64bit to 192bits which contains values of 'file size', 'file count' and 'dir count' This change in quota size xattr needs to be handled in disperse xattr aggregation Signed-off-by: vmallika Change-Id: I5fd28aa9f5b8b6cba83a98360236417a97ac16ee BUG: 1207967 Reviewed-on: http://review.gluster.org/10112 Reviewed-by: Pranith Kumar Karampuri Tested-by: Gluster Build System Reviewed-by: Sachin Pandit Reviewed-by: Raghavendra G Tested-by: Raghavendra G --- libglusterfs/src/quota-common-utils.c | 29 ++++++++++++++++++++++------- libglusterfs/src/quota-common-utils.h | 3 +++ 2 files changed, 25 insertions(+), 7 deletions(-) (limited to 'libglusterfs') diff --git a/libglusterfs/src/quota-common-utils.c b/libglusterfs/src/quota-common-utils.c index 8cc09e8fff7..ab153209d0d 100644 --- a/libglusterfs/src/quota-common-utils.c +++ b/libglusterfs/src/quota-common-utils.c @@ -15,18 +15,13 @@ #include "quota-common-utils.h" int32_t -quota_dict_get_meta (dict_t *dict, char *key, quota_meta_t *meta) +quota_data_to_meta (data_t *data, char *key, quota_meta_t *meta) { int32_t ret = -1; - data_t *data = NULL; quota_meta_t *value = NULL; int64_t *size = NULL; - if (!dict || !key || !meta) - goto out; - - data = dict_get (dict, key); - if (!data || !data->data) + if (!data || !key || !meta) goto out; if (data->len > sizeof (int64_t)) { @@ -58,6 +53,26 @@ out: return ret; } +int32_t +quota_dict_get_meta (dict_t *dict, char *key, quota_meta_t *meta) +{ + int32_t ret = -1; + data_t *data = NULL; + + if (!dict || !key || !meta) + goto out; + + data = dict_get (dict, key); + if (!data || !data->data) + goto out; + + ret = quota_data_to_meta (data, key, meta); + +out: + + return ret; +} + int32_t quota_dict_set_meta (dict_t *dict, char *key, const quota_meta_t *meta, ia_type_t ia_type) diff --git a/libglusterfs/src/quota-common-utils.h b/libglusterfs/src/quota-common-utils.h index 42301724348..eff86850dd5 100644 --- a/libglusterfs/src/quota-common-utils.h +++ b/libglusterfs/src/quota-common-utils.h @@ -26,6 +26,9 @@ struct _quota_meta { } __attribute__ ((__packed__)); typedef struct _quota_meta quota_meta_t; +int32_t +quota_data_to_meta (data_t *data, char *key, quota_meta_t *meta); + int32_t quota_dict_get_meta (dict_t *dict, char *key, quota_meta_t *meta); -- cgit