summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorvmallika <vmallika@redhat.com>2015-04-01 20:03:37 +0530
committerRaghavendra G <rgowdapp@redhat.com>2015-04-14 05:01:18 +0000
commit6e8298654a7d0de29192b88d769132cfc51c9ac7 (patch)
treec70306373aff2967ae0d3ecd4148d1aaae085e48 /xlators
parentd3b52c8283eb4c85018a5055a0dbe628b5bd2d29 (diff)
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 <vmallika@redhat.com> Change-Id: I5fd28aa9f5b8b6cba83a98360236417a97ac16ee BUG: 1207967 Reviewed-on: http://review.gluster.org/10112 Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Sachin Pandit <spandit@redhat.com> Reviewed-by: Raghavendra G <rgowdapp@redhat.com> Tested-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/cluster/ec/src/ec-combine.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/xlators/cluster/ec/src/ec-combine.c b/xlators/cluster/ec/src/ec-combine.c
index 5f5d97275be..e84055c51e4 100644
--- a/xlators/cluster/ec/src/ec-combine.c
+++ b/xlators/cluster/ec/src/ec-combine.c
@@ -17,6 +17,7 @@
#include "ec-helpers.h"
#include "ec-common.h"
#include "ec-combine.h"
+#include "quota-common-utils.h"
#define EC_QUOTA_PREFIX "trusted.glusterfs.quota."
@@ -584,11 +585,14 @@ int32_t ec_dict_data_max64(ec_cbk_data_t *cbk, int32_t which, char *key)
int32_t ec_dict_data_quota(ec_cbk_data_t *cbk, int32_t which, char *key)
{
- data_t *data[cbk->count];
- dict_t *dict;
- ec_t *ec;
- int32_t i, num;
- uint64_t max, tmp;
+ data_t *data[cbk->count];
+ dict_t *dict = NULL;
+ ec_t *ec = NULL;
+ int32_t i = 0;
+ int32_t num = 0;
+ int32_t ret = -1;
+ quota_meta_t size = {0, };
+ quota_meta_t max_size = {0, };
num = cbk->count;
if (!ec_dict_list(data, &num, cbk, which, key)) {
@@ -604,19 +608,24 @@ int32_t ec_dict_data_quota(ec_cbk_data_t *cbk, int32_t which, char *key)
* bricks and we can receive slightly different values. If that's the
* case, we take the maximum of all received values.
*/
- max = ntoh64(*(uint64_t *)data_to_ptr(data[0]));
- for (i = 1; i < num; i++) {
- tmp = ntoh64(*(uint64_t *)data_to_ptr(data[i]));
- if (max < tmp) {
- max = tmp;
- }
+ for (i = 0; i < num; i++) {
+ ret = quota_data_to_meta (data[i], QUOTA_SIZE_KEY, &size);
+ if (ret == -1)
+ continue;
+
+ if (size.size > max_size.size)
+ max_size.size = size.size;
+ if (size.file_count > max_size.file_count)
+ max_size.file_count = size.file_count;
+ if (size.dir_count > max_size.dir_count)
+ max_size.dir_count = size.dir_count;
}
ec = cbk->fop->xl->private;
- max *= ec->fragments;
+ max_size.size *= ec->fragments;
dict = (which == EC_COMBINE_XDATA) ? cbk->xdata : cbk->dict;
- if (ec_dict_set_number(dict, key, max) != 0) {
+ if (quota_dict_set_meta (dict, key, &max_size, IA_IFDIR) != 0) {
return -1;
}