From 21cd43cfd62f69cd011fced7ebec93b9347f9fce Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Wed, 11 Mar 2015 17:43:12 +0530 Subject: libxlator: Change marker xattr handling interface - Changed the implementation of marker xattr handling to take just a function which populates important data that is different from default 'gauge' values and subvolumes where the call needs to be wound. - Removed duplicate code I found while reading the code and moved it to cluster_marker_unwind. Removed unused structure members. - Changed dht/afr/stripe implementations to follow the new implementation - Implemented marker xattr handling for ec. Change-Id: Ib0c3626fe31eb7c8aae841eabb694945bf23abd4 BUG: 1200372 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.org/9892 Tested-by: Gluster Build System Reviewed-by: Xavier Hernandez Reviewed-by: Shyamsundar Ranganathan Reviewed-by: Ravishankar N Reviewed-by: Vijay Bellur --- xlators/cluster/dht/src/dht-common.c | 70 +++++++++++------------------------- 1 file changed, 20 insertions(+), 50 deletions(-) (limited to 'xlators/cluster/dht/src/dht-common.c') diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index 3a196e07be9..b7df1f4da4b 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -2791,6 +2791,22 @@ dht_getxattr_get_real_filename (call_frame_t *frame, xlator_t *this, return 0; } +int +dht_marker_populate_args (call_frame_t *frame, int type, int *gauge, + xlator_t **subvols) +{ + dht_local_t *local = NULL; + int i = 0; + dht_layout_t *layout = NULL; + + local = frame->local; + layout = local->layout; + + for (i = 0; i < layout->cnt; i++) + subvols[i] = layout->list[i].xlator; + + return layout->cnt; +} int dht_getxattr (call_frame_t *frame, xlator_t *this, @@ -2804,7 +2820,6 @@ dht_getxattr (call_frame_t *frame, xlator_t *this, dht_conf_t *conf = NULL; dht_local_t *local = NULL; dht_layout_t *layout = NULL; - xlator_t **sub_volumes = NULL; int op_errno = -1; int i = 0; int cnt = 0; @@ -2918,30 +2933,6 @@ dht_getxattr (call_frame_t *frame, xlator_t *this, return 0; } - if (key && (!strcmp (GF_XATTR_MARKER_KEY, key)) - && (GF_CLIENT_PID_GSYNCD == frame->root->pid)) { - if (DHT_IS_DIR(layout)) { - cnt = layout->cnt; - } else { - cnt = 1; - } - - sub_volumes = alloca ( cnt * sizeof (xlator_t *)); - for (i = 0; i < cnt; i++) - *(sub_volumes + i) = layout->list[i].xlator; - - if (cluster_getmarkerattr (frame, this, loc, key, - local, dht_getxattr_unwind, - sub_volumes, cnt, - MARKER_UUID_TYPE, marker_uuid_default_gauge, - conf->vol_uuid)) { - op_errno = EINVAL; - goto err; - } - - return 0; - } - if (key && (!strcmp (GF_XATTR_QUOTA_LIMIT_LIST, key) || !strcmp (GF_XATTR_QUOTA_LIMIT_LIST_OBJECT, key))) { /* quota hardlimit and aggregated size of a directory is stored @@ -2955,31 +2946,10 @@ dht_getxattr (call_frame_t *frame, xlator_t *this, return 0; } - if (key && *conf->vol_uuid) { - if ((match_uuid_local (key, conf->vol_uuid) == 0) && - (GF_CLIENT_PID_GSYNCD == frame->root->pid)) { - if (DHT_IS_DIR(layout)) { - cnt = layout->cnt; - } else { - cnt = 1; - } - sub_volumes = alloca ( cnt * sizeof (xlator_t *)); - for (i = 0; i < cnt; i++) - sub_volumes[i] = layout->list[i].xlator; - - if (cluster_getmarkerattr (frame, this, loc, key, - local, dht_getxattr_unwind, - sub_volumes, cnt, - MARKER_XTIME_TYPE, - marker_xtime_default_gauge, - conf->vol_uuid)) { - op_errno = EINVAL; - goto err; - } - - return 0; - } - } + if (cluster_handle_marker_getxattr (frame, loc, key, conf->vol_uuid, + dht_getxattr_unwind, + dht_marker_populate_args) == 0) + return 0; if (DHT_IS_DIR(layout)) { cnt = local->call_cnt = layout->cnt; -- cgit