From 33aad915e4187c9ca5fdff593c08c361cfa4b2f6 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Thu, 5 May 2016 07:59:03 +0530 Subject: protocol/client: Filter o-direct in readv/writev >Change-Id: I519c666b3a7c0db46d47e08a6a7e2dbecc05edf2 >BUG: 1322214 >Signed-off-by: Pranith Kumar K >Reviewed-on: http://review.gluster.org/14215 >Smoke: Gluster Build System >NetBSD-regression: NetBSD Build System >CentOS-regression: Gluster Build System >Reviewed-by: Krutika Dhananjay BUG: 1335284 Change-Id: I119a5f1eebf657b01d8d924ff1f59a49eb472667 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.org/14299 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Niels de Vos --- xlators/protocol/client/src/client.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c index 14af6fb03c5..3cb5e231fbe 100644 --- a/xlators/protocol/client/src/client.c +++ b/xlators/protocol/client/src/client.c @@ -31,6 +31,13 @@ int client_init_rpc (xlator_t *this); int client_destroy_rpc (xlator_t *this); int client_mark_fd_bad (xlator_t *this); +static void +client_filter_o_direct (clnt_conf_t *conf, int32_t *flags) +{ + if (conf->filter_o_direct) + *flags = (*flags & ~O_DIRECT); +} + static int client_fini_complete (xlator_t *this) { @@ -913,11 +920,9 @@ client_create (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, args.fd = fd; args.umask = umask; args.xdata = xdata; + args.flags = flags; - if (!conf->filter_o_direct) - args.flags = flags; - else - args.flags = (flags & ~O_DIRECT); + client_filter_o_direct (conf, &args.flags); proc = &conf->fops->proctable[GF_FOP_CREATE]; if (proc->fn) @@ -948,11 +953,9 @@ client_open (call_frame_t *frame, xlator_t *this, loc_t *loc, args.loc = loc; args.fd = fd; args.xdata = xdata; + args.flags = flags; - if (!conf->filter_o_direct) - args.flags = flags; - else - args.flags = (flags & ~O_DIRECT); + client_filter_o_direct (conf, &args.flags); proc = &conf->fops->proctable[GF_FOP_OPEN]; if (proc->fn) @@ -986,6 +989,8 @@ client_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, args.flags = flags; args.xdata = xdata; + client_filter_o_direct (conf, &args.flags); + proc = &conf->fops->proctable[GF_FOP_READ]; if (proc->fn) ret = proc->fn (frame, this, &args); @@ -1024,6 +1029,8 @@ client_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, args.iobref = iobref; args.xdata = xdata; + client_filter_o_direct (conf, &args.flags); + proc = &conf->fops->proctable[GF_FOP_WRITE]; if (proc->fn) ret = proc->fn (frame, this, &args); -- cgit