From 0f71338e1d7c0b70f4fe3b19c68612fe730d9de2 Mon Sep 17 00:00:00 2001 From: Poornima G Date: Wed, 15 Mar 2017 10:26:28 +0530 Subject: dht: The xattrs sent in readdirp should be sent in opendir aswell As readdir-ahead can be loaded as a child of dht, dht has to specify the xattrs it is intrested in, as part of opendir call itself. Change-Id: I012ef96cc143b0cef942df78aa7150d85ec38606 BUG: 1431908 Signed-off-by: Poornima G Reviewed-on: https://review.gluster.org/16902 Smoke: Gluster Build System Reviewed-by: Raghavendra G NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System --- .../performance/readdir-ahead/src/readdir-ahead.c | 46 +++++++--------------- .../performance/readdir-ahead/src/readdir-ahead.h | 3 +- 2 files changed, 16 insertions(+), 33 deletions(-) (limited to 'xlators/performance/readdir-ahead') diff --git a/xlators/performance/readdir-ahead/src/readdir-ahead.c b/xlators/performance/readdir-ahead/src/readdir-ahead.c index 9f129aa08d8..2ffcf25d8a7 100644 --- a/xlators/performance/readdir-ahead/src/readdir-ahead.c +++ b/xlators/performance/readdir-ahead/src/readdir-ahead.c @@ -415,7 +415,6 @@ rda_fill_fd(call_frame_t *frame, xlator_t *this, fd_t *fd) struct rda_fd_ctx *ctx; off_t offset; struct rda_priv *priv = this->private; - int ret = 0; ctx = get_rda_fd_ctx(fd, this); if (!ctx) @@ -461,15 +460,6 @@ rda_fill_fd(call_frame_t *frame, xlator_t *this, fd_t *fd) } local->offset = offset; - if (local->skip_dir) { - ret = dict_set_int32 (ctx->xattrs, GF_READDIR_SKIP_DIRS, 1); - if (ret < 0) { - gf_msg (this->name, GF_LOG_ERROR, - 0, READDIR_AHEAD_MSG_DICT_OP_FAILED, - "Dict set of key:%s failed with :%d", - GF_READDIR_SKIP_DIRS, ret); - } - } UNLOCK(&ctx->lock); @@ -547,27 +537,12 @@ rda_opendir(call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd, dict_t *xdata_from_req = NULL; if (xdata) { - /* - * Retrieve list of keys set by md-cache xlator and store it - * in local to be consumed in rda_opendir_cbk - */ - ret = dict_get_str (xdata, GF_MDC_LOADED_KEY_NAMES, &payload); - if (ret) - goto wind; - xdata_from_req = dict_new(); if (!xdata_from_req) { op_errno = ENOMEM; goto unwind; } - ret = rda_unpack_mdc_loaded_keys_to_dict((char *) payload, - xdata_from_req); - if (ret) { - dict_unref(xdata_from_req); - goto wind; - } - local = mem_get0(this->local_pool); if (!local) { dict_unref(xdata_from_req); @@ -575,16 +550,25 @@ rda_opendir(call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd, goto unwind; } + /* + * Retrieve list of keys set by md-cache xlator and store it + * in local to be consumed in rda_opendir_cbk + */ + ret = dict_get_str (xdata, GF_MDC_LOADED_KEY_NAMES, &payload); + if (ret) + goto wind; + ret = rda_unpack_mdc_loaded_keys_to_dict((char *) payload, + xdata_from_req); + if (ret) + goto wind; + + dict_copy (xdata, xdata_from_req); + dict_del (xdata_from_req, GF_MDC_LOADED_KEY_NAMES); + local->xattrs = xdata_from_req; - ret = dict_get_int32 (xdata, GF_READDIR_SKIP_DIRS, &local->skip_dir); frame->local = local; } - wind: - if (xdata) - /* Remove the key after consumption. */ - dict_del (xdata, GF_MDC_LOADED_KEY_NAMES); - STACK_WIND(frame, rda_opendir_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->opendir, loc, fd, xdata); return 0; diff --git a/xlators/performance/readdir-ahead/src/readdir-ahead.h b/xlators/performance/readdir-ahead/src/readdir-ahead.h index 9f9df05212e..8c663e091f1 100644 --- a/xlators/performance/readdir-ahead/src/readdir-ahead.h +++ b/xlators/performance/readdir-ahead/src/readdir-ahead.h @@ -36,8 +36,7 @@ struct rda_local { struct rda_fd_ctx *ctx; fd_t *fd; off_t offset; - dict_t *xattrs; /* md-cache keys to be sent in readdirp() */ - int32_t skip_dir; + dict_t *xattrs; /* xattrs to be sent in readdirp() */ }; struct rda_priv { -- cgit