diff options
author | Pranith Kumar K <pkarampu@redhat.com> | 2015-03-11 17:43:12 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2015-03-25 11:10:40 -0700 |
commit | 21cd43cfd62f69cd011fced7ebec93b9347f9fce (patch) | |
tree | e3736b832dea4721754623cae8c27b3de49cb220 /xlators/cluster/dht | |
parent | 18dd162e00c8655648cea702bdb7b8bf25f1da97 (diff) |
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 <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/9892
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Xavier Hernandez <xhernandez@datalab.es>
Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
Reviewed-by: Ravishankar N <ravishankar@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/cluster/dht')
-rw-r--r-- | xlators/cluster/dht/src/dht-common.c | 70 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-common.h | 3 |
2 files changed, 20 insertions, 53 deletions
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; diff --git a/xlators/cluster/dht/src/dht-common.h b/xlators/cluster/dht/src/dht-common.h index 9145f336d7c..9d505c1e601 100644 --- a/xlators/cluster/dht/src/dht-common.h +++ b/xlators/cluster/dht/src/dht-common.h @@ -216,9 +216,6 @@ struct dht_local { /* gfid related */ uuid_t gfid; - /*Marker Related*/ - struct marker_str marker; - /* flag used to make sure we need to return estale in {lookup,revalidate}_cbk */ char return_estale; |