|
|
21ab4e |
From 75b83ef8ea62cacff0273bba35027cc80266a5ee Mon Sep 17 00:00:00 2001
|
|
|
21ab4e |
From: Poornima G <pgurusid@redhat.com>
|
|
|
21ab4e |
Date: Wed, 15 Mar 2017 10:26:28 +0530
|
|
|
21ab4e |
Subject: [PATCH 373/375] dht: The xattrs sent in readdirp should be sent in
|
|
|
21ab4e |
opendir aswell
|
|
|
21ab4e |
|
|
|
21ab4e |
As readdir-ahead can be loaded as a child of dht, dht has to specify
|
|
|
21ab4e |
the xattrs it is intrested in, as part of opendir call itself.
|
|
|
21ab4e |
|
|
|
21ab4e |
> Reviewed-on: https://review.gluster.org/16902
|
|
|
21ab4e |
> Smoke: Gluster Build System <jenkins@build.gluster.org>
|
|
|
21ab4e |
> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
|
|
|
21ab4e |
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
21ab4e |
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
|
|
|
21ab4e |
> Signed-off-by: Poornima G <pgurusid@redhat.com>
|
|
|
21ab4e |
|
|
|
21ab4e |
Change-Id: I012ef96cc143b0cef942df78aa7150d85ec38606
|
|
|
21ab4e |
BUG: 1427096
|
|
|
21ab4e |
Signed-off-by: Poornima G <pgurusid@redhat.com>
|
|
|
21ab4e |
Reviewed-on: https://code.engineering.redhat.com/gerrit/102614
|
|
|
21ab4e |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
21ab4e |
---
|
|
|
21ab4e |
xlators/cluster/dht/src/dht-common.c | 72 +++++++++++++---------
|
|
|
21ab4e |
.../performance/readdir-ahead/src/readdir-ahead.c | 46 +++++---------
|
|
|
21ab4e |
.../performance/readdir-ahead/src/readdir-ahead.h | 3 +-
|
|
|
21ab4e |
3 files changed, 60 insertions(+), 61 deletions(-)
|
|
|
21ab4e |
|
|
|
21ab4e |
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
|
|
|
21ab4e |
index 77d0e48..717bd7a 100644
|
|
|
21ab4e |
--- a/xlators/cluster/dht/src/dht-common.c
|
|
|
21ab4e |
+++ b/xlators/cluster/dht/src/dht-common.c
|
|
|
21ab4e |
@@ -4858,6 +4858,9 @@ dht_opendir (call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd,
|
|
|
21ab4e |
int op_errno = -1;
|
|
|
21ab4e |
int i = -1;
|
|
|
21ab4e |
int ret = 0;
|
|
|
21ab4e |
+ gf_boolean_t new_xdata = _gf_false;
|
|
|
21ab4e |
+ xlator_t **subvolumes = NULL;
|
|
|
21ab4e |
+ int call_count = 0;
|
|
|
21ab4e |
|
|
|
21ab4e |
VALIDATE_OR_GOTO (frame, err);
|
|
|
21ab4e |
VALIDATE_OR_GOTO (this, err);
|
|
|
21ab4e |
@@ -4869,46 +4872,59 @@ dht_opendir (call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd,
|
|
|
21ab4e |
local = dht_local_init (frame, loc, fd, GF_FOP_OPENDIR);
|
|
|
21ab4e |
if (!local) {
|
|
|
21ab4e |
op_errno = ENOMEM;
|
|
|
21ab4e |
-
|
|
|
21ab4e |
goto err;
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
+ if (!xdata) {
|
|
|
21ab4e |
+ xdata = dict_new ();
|
|
|
21ab4e |
+ if (!xdata) {
|
|
|
21ab4e |
+ op_errno = ENOMEM;
|
|
|
21ab4e |
+ goto err;
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+ new_xdata = _gf_true;
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ ret = dict_set_uint32 (xdata, conf->link_xattr_name, 256);
|
|
|
21ab4e |
+ if (ret)
|
|
|
21ab4e |
+ gf_msg (this->name, GF_LOG_WARNING, 0, DHT_MSG_DICT_SET_FAILED,
|
|
|
21ab4e |
+ "Failed to set dictionary value : key = %s",
|
|
|
21ab4e |
+ conf->link_xattr_name);
|
|
|
21ab4e |
+
|
|
|
21ab4e |
if ((conf->defrag && conf->defrag->cmd == GF_DEFRAG_CMD_START_TIER) ||
|
|
|
21ab4e |
(conf->defrag && conf->defrag->cmd ==
|
|
|
21ab4e |
GF_DEFRAG_CMD_START_DETACH_TIER) ||
|
|
|
21ab4e |
(!(conf->local_subvols_cnt) || !conf->defrag)) {
|
|
|
21ab4e |
- local->call_cnt = conf->subvolume_cnt;
|
|
|
21ab4e |
-
|
|
|
21ab4e |
- for (i = 0; i < conf->subvolume_cnt; i++) {
|
|
|
21ab4e |
- STACK_WIND_COOKIE (frame, dht_fd_cbk,
|
|
|
21ab4e |
- conf->subvolumes[i],
|
|
|
21ab4e |
- conf->subvolumes[i],
|
|
|
21ab4e |
- conf->subvolumes[i]->fops->opendir,
|
|
|
21ab4e |
- loc, fd, xdata);
|
|
|
21ab4e |
- }
|
|
|
21ab4e |
+ call_count = local->call_cnt = conf->subvolume_cnt;
|
|
|
21ab4e |
+ subvolumes = conf->subvolumes;
|
|
|
21ab4e |
} else {
|
|
|
21ab4e |
- local->call_cnt = conf->local_subvols_cnt;
|
|
|
21ab4e |
- for (i = 0; i < conf->local_subvols_cnt; i++) {
|
|
|
21ab4e |
- if (conf->readdir_optimize == _gf_true) {
|
|
|
21ab4e |
- if (conf->local_subvols[i] != local->first_up_subvol)
|
|
|
21ab4e |
- ret = dict_set_int32 (local->xattr,
|
|
|
21ab4e |
- GF_READDIR_SKIP_DIRS, 1);
|
|
|
21ab4e |
- if (ret)
|
|
|
21ab4e |
- gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
21ab4e |
- DHT_MSG_DICT_SET_FAILED,
|
|
|
21ab4e |
- "Failed to set dictionary"
|
|
|
21ab4e |
- " value :key = %s, ret:%d",
|
|
|
21ab4e |
- GF_READDIR_SKIP_DIRS, ret);
|
|
|
21ab4e |
+ call_count = local->call_cnt = conf->local_subvols_cnt;
|
|
|
21ab4e |
+ subvolumes = conf->local_subvols;
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
|
|
|
21ab4e |
- }
|
|
|
21ab4e |
- STACK_WIND_COOKIE (frame, dht_fd_cbk,
|
|
|
21ab4e |
- conf->local_subvols[i],
|
|
|
21ab4e |
- conf->local_subvols[i],
|
|
|
21ab4e |
- conf->local_subvols[i]->fops->opendir,
|
|
|
21ab4e |
- loc, fd, xdata);
|
|
|
21ab4e |
+ for (i = 0; i < call_count; i++) {
|
|
|
21ab4e |
+ if (conf->readdir_optimize == _gf_true) {
|
|
|
21ab4e |
+ if (subvolumes[i] != local->first_up_subvol)
|
|
|
21ab4e |
+ ret = dict_set_int32 (xdata,
|
|
|
21ab4e |
+ GF_READDIR_SKIP_DIRS, 1);
|
|
|
21ab4e |
+ if (ret)
|
|
|
21ab4e |
+ gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
21ab4e |
+ DHT_MSG_DICT_SET_FAILED,
|
|
|
21ab4e |
+ "Failed to set dictionary"
|
|
|
21ab4e |
+ " value :key = %s, ret:%d",
|
|
|
21ab4e |
+ GF_READDIR_SKIP_DIRS, ret);
|
|
|
21ab4e |
}
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ STACK_WIND_COOKIE (frame, dht_fd_cbk,
|
|
|
21ab4e |
+ subvolumes[i],
|
|
|
21ab4e |
+ subvolumes[i],
|
|
|
21ab4e |
+ subvolumes[i]->fops->opendir,
|
|
|
21ab4e |
+ loc, fd, xdata);
|
|
|
21ab4e |
+ dict_del (xdata, GF_READDIR_SKIP_DIRS);
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
+ if (new_xdata)
|
|
|
21ab4e |
+ dict_unref (xdata);
|
|
|
21ab4e |
+
|
|
|
21ab4e |
return 0;
|
|
|
21ab4e |
|
|
|
21ab4e |
err:
|
|
|
21ab4e |
diff --git a/xlators/performance/readdir-ahead/src/readdir-ahead.c b/xlators/performance/readdir-ahead/src/readdir-ahead.c
|
|
|
21ab4e |
index 9f129aa..2ffcf25 100644
|
|
|
21ab4e |
--- a/xlators/performance/readdir-ahead/src/readdir-ahead.c
|
|
|
21ab4e |
+++ b/xlators/performance/readdir-ahead/src/readdir-ahead.c
|
|
|
21ab4e |
@@ -415,7 +415,6 @@ rda_fill_fd(call_frame_t *frame, xlator_t *this, fd_t *fd)
|
|
|
21ab4e |
struct rda_fd_ctx *ctx;
|
|
|
21ab4e |
off_t offset;
|
|
|
21ab4e |
struct rda_priv *priv = this->private;
|
|
|
21ab4e |
- int ret = 0;
|
|
|
21ab4e |
|
|
|
21ab4e |
ctx = get_rda_fd_ctx(fd, this);
|
|
|
21ab4e |
if (!ctx)
|
|
|
21ab4e |
@@ -461,15 +460,6 @@ rda_fill_fd(call_frame_t *frame, xlator_t *this, fd_t *fd)
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
local->offset = offset;
|
|
|
21ab4e |
- if (local->skip_dir) {
|
|
|
21ab4e |
- ret = dict_set_int32 (ctx->xattrs, GF_READDIR_SKIP_DIRS, 1);
|
|
|
21ab4e |
- if (ret < 0) {
|
|
|
21ab4e |
- gf_msg (this->name, GF_LOG_ERROR,
|
|
|
21ab4e |
- 0, READDIR_AHEAD_MSG_DICT_OP_FAILED,
|
|
|
21ab4e |
- "Dict set of key:%s failed with :%d",
|
|
|
21ab4e |
- GF_READDIR_SKIP_DIRS, ret);
|
|
|
21ab4e |
- }
|
|
|
21ab4e |
- }
|
|
|
21ab4e |
|
|
|
21ab4e |
UNLOCK(&ctx->lock);
|
|
|
21ab4e |
|
|
|
21ab4e |
@@ -547,27 +537,12 @@ rda_opendir(call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd,
|
|
|
21ab4e |
dict_t *xdata_from_req = NULL;
|
|
|
21ab4e |
|
|
|
21ab4e |
if (xdata) {
|
|
|
21ab4e |
- /*
|
|
|
21ab4e |
- * Retrieve list of keys set by md-cache xlator and store it
|
|
|
21ab4e |
- * in local to be consumed in rda_opendir_cbk
|
|
|
21ab4e |
- */
|
|
|
21ab4e |
- ret = dict_get_str (xdata, GF_MDC_LOADED_KEY_NAMES, &payload);
|
|
|
21ab4e |
- if (ret)
|
|
|
21ab4e |
- goto wind;
|
|
|
21ab4e |
-
|
|
|
21ab4e |
xdata_from_req = dict_new();
|
|
|
21ab4e |
if (!xdata_from_req) {
|
|
|
21ab4e |
op_errno = ENOMEM;
|
|
|
21ab4e |
goto unwind;
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
- ret = rda_unpack_mdc_loaded_keys_to_dict((char *) payload,
|
|
|
21ab4e |
- xdata_from_req);
|
|
|
21ab4e |
- if (ret) {
|
|
|
21ab4e |
- dict_unref(xdata_from_req);
|
|
|
21ab4e |
- goto wind;
|
|
|
21ab4e |
- }
|
|
|
21ab4e |
-
|
|
|
21ab4e |
local = mem_get0(this->local_pool);
|
|
|
21ab4e |
if (!local) {
|
|
|
21ab4e |
dict_unref(xdata_from_req);
|
|
|
21ab4e |
@@ -575,16 +550,25 @@ rda_opendir(call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd,
|
|
|
21ab4e |
goto unwind;
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
+ /*
|
|
|
21ab4e |
+ * Retrieve list of keys set by md-cache xlator and store it
|
|
|
21ab4e |
+ * in local to be consumed in rda_opendir_cbk
|
|
|
21ab4e |
+ */
|
|
|
21ab4e |
+ ret = dict_get_str (xdata, GF_MDC_LOADED_KEY_NAMES, &payload);
|
|
|
21ab4e |
+ if (ret)
|
|
|
21ab4e |
+ goto wind;
|
|
|
21ab4e |
+ ret = rda_unpack_mdc_loaded_keys_to_dict((char *) payload,
|
|
|
21ab4e |
+ xdata_from_req);
|
|
|
21ab4e |
+ if (ret)
|
|
|
21ab4e |
+ goto wind;
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ dict_copy (xdata, xdata_from_req);
|
|
|
21ab4e |
+ dict_del (xdata_from_req, GF_MDC_LOADED_KEY_NAMES);
|
|
|
21ab4e |
+
|
|
|
21ab4e |
local->xattrs = xdata_from_req;
|
|
|
21ab4e |
- ret = dict_get_int32 (xdata, GF_READDIR_SKIP_DIRS, &local->skip_dir);
|
|
|
21ab4e |
frame->local = local;
|
|
|
21ab4e |
}
|
|
|
21ab4e |
-
|
|
|
21ab4e |
wind:
|
|
|
21ab4e |
- if (xdata)
|
|
|
21ab4e |
- /* Remove the key after consumption. */
|
|
|
21ab4e |
- dict_del (xdata, GF_MDC_LOADED_KEY_NAMES);
|
|
|
21ab4e |
-
|
|
|
21ab4e |
STACK_WIND(frame, rda_opendir_cbk, FIRST_CHILD(this),
|
|
|
21ab4e |
FIRST_CHILD(this)->fops->opendir, loc, fd, xdata);
|
|
|
21ab4e |
return 0;
|
|
|
21ab4e |
diff --git a/xlators/performance/readdir-ahead/src/readdir-ahead.h b/xlators/performance/readdir-ahead/src/readdir-ahead.h
|
|
|
21ab4e |
index 9f9df05..8c663e0 100644
|
|
|
21ab4e |
--- a/xlators/performance/readdir-ahead/src/readdir-ahead.h
|
|
|
21ab4e |
+++ b/xlators/performance/readdir-ahead/src/readdir-ahead.h
|
|
|
21ab4e |
@@ -36,8 +36,7 @@ struct rda_local {
|
|
|
21ab4e |
struct rda_fd_ctx *ctx;
|
|
|
21ab4e |
fd_t *fd;
|
|
|
21ab4e |
off_t offset;
|
|
|
21ab4e |
- dict_t *xattrs; /* md-cache keys to be sent in readdirp() */
|
|
|
21ab4e |
- int32_t skip_dir;
|
|
|
21ab4e |
+ dict_t *xattrs; /* xattrs to be sent in readdirp() */
|
|
|
21ab4e |
};
|
|
|
21ab4e |
|
|
|
21ab4e |
struct rda_priv {
|
|
|
21ab4e |
--
|
|
|
21ab4e |
1.8.3.1
|
|
|
21ab4e |
|