diff options
author | Amar Tumballi <amarts@redhat.com> | 2012-11-28 11:51:57 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2012-12-12 00:22:49 -0500 |
commit | 19a391344daecde4ee6446897c248be5b828b67b (patch) | |
tree | 364206da4f3682017cb1b55269c3948350fb26cb /xlators/protocol/client | |
parent | 7746a12476298286d5ff918af3a526dd60dae992 (diff) |
protocol/client: add an option to filter O_DIRECT flag in open
with the option, the idea is all client-side caching will be disabled,
where as on server side process, the fd will be treated as a regular
fd, thus helping the performance better.
"gluster volume set <VOLNAME> remote-dio enable" would set
this option in client protocol volumes.
Change-Id: I08f3d1f6fed6da58501b5b94e5572216593c2847
Signed-off-by: Amar Tumballi <amarts@redhat.com>
BUG: 856156
Reviewed-on: https://code.engineering.redhat.com/gerrit/1685
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Tested-by: Vijay Bellur <vbellur@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/1885
Diffstat (limited to 'xlators/protocol/client')
-rw-r--r-- | xlators/protocol/client/src/client.c | 26 | ||||
-rw-r--r-- | xlators/protocol/client/src/client.h | 3 |
2 files changed, 27 insertions, 2 deletions
diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c index 65df70f0604..d327375d0aa 100644 --- a/xlators/protocol/client/src/client.c +++ b/xlators/protocol/client/src/client.c @@ -815,12 +815,16 @@ client_create (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, goto out; args.loc = loc; - args.flags = flags; args.mode = mode; args.fd = fd; args.umask = umask; args.xdata = xdata; + if (!conf->filter_o_direct) + args.flags = flags; + else + args.flags = (flags & ~O_DIRECT); + proc = &conf->fops->proctable[GF_FOP_CREATE]; if (!proc) { gf_log (this->name, GF_LOG_ERROR, @@ -854,10 +858,14 @@ client_open (call_frame_t *frame, xlator_t *this, loc_t *loc, goto out; args.loc = loc; - args.flags = flags; args.fd = fd; args.xdata = xdata; + if (!conf->filter_o_direct) + args.flags = flags; + else + args.flags = (flags & ~O_DIRECT); + proc = &conf->fops->proctable[GF_FOP_OPEN]; if (!proc) { gf_log (this->name, GF_LOG_ERROR, @@ -2194,6 +2202,9 @@ build_client_config (xlator_t *this, clnt_conf_t *conf) gf_log (this->name, GF_LOG_WARNING, "option 'remote-subvolume' not given"); + GF_OPTION_INIT ("filter-O_DIRECT", conf->filter_o_direct, + bool, out); + ret = 0; out: return ret; @@ -2377,6 +2388,9 @@ reconfigure (xlator_t *this, dict_t *options) } } + GF_OPTION_RECONF ("filter-O_DIRECT", conf->filter_o_direct, + options, bool, out); + ret = client_init_grace_timer (this, options, conf); if (ret) goto out; @@ -2712,5 +2726,13 @@ struct volume_options options[] = { .min = GF_MIN_SOCKET_WINDOW_SIZE, .max = GF_MAX_SOCKET_WINDOW_SIZE }, + { .key = {"filter-O_DIRECT"}, + .type = GF_OPTION_TYPE_BOOL, + .default_value = "disable", + .description = "If enabled, in open() and creat() calls, O_DIRECT " + "flag will be filtered at the client protocol level so server will " + "still continue to cache the file. This works similar to NFS's " + "behavior of O_DIRECT", + }, { .key = {NULL} }, }; diff --git a/xlators/protocol/client/src/client.h b/xlators/protocol/client/src/client.h index ac999db5a16..035a3ecd764 100644 --- a/xlators/protocol/client/src/client.h +++ b/xlators/protocol/client/src/client.h @@ -109,6 +109,9 @@ typedef struct clnt_conf { means dont register, true means register */ char parent_down; + + gf_boolean_t filter_o_direct; /* if set, filter O_DIRECT from + the flags list of open() */ } clnt_conf_t; typedef struct _client_fd_ctx { |