summaryrefslogtreecommitdiffstats
path: root/xlators/performance/open-behind/src
diff options
context:
space:
mode:
authorKrutika Dhananjay <kdhananj@redhat.com>2016-09-20 12:05:23 +0530
committerRaghavendra G <rgowdapp@redhat.com>2016-09-22 22:32:14 -0700
commita412a4f50d8ca2ae68dbfa93b80757889150ce99 (patch)
tree56107a0551e91dc72714f741384d770487441f13 /xlators/performance/open-behind/src
parent7090cf287847a808d6d0225bc9110f44c3248e12 (diff)
performance/open-behind: Pass O_DIRECT flags for anon fd reads when required
Writes are already passing the correct flags at the time of open(). Also, make io-cache honor direct-io for anon-fds with O_DIRECT flag during reads. Change-Id: I215cb09ef1b607b9f95cabf0ef3065c00edd9e78 BUG: 1377556 Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com> Reviewed-on: http://review.gluster.org/15537 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Raghavendra G <rgowdapp@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators/performance/open-behind/src')
-rw-r--r--xlators/performance/open-behind/src/open-behind.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/xlators/performance/open-behind/src/open-behind.c b/xlators/performance/open-behind/src/open-behind.c
index efab88582ff..00e8906910a 100644
--- a/xlators/performance/open-behind/src/open-behind.c
+++ b/xlators/performance/open-behind/src/open-behind.c
@@ -351,19 +351,25 @@ err:
fd_t *
-ob_get_wind_fd (xlator_t *this, fd_t *fd)
+ob_get_wind_fd (xlator_t *this, fd_t *fd, uint32_t *flag)
{
- ob_conf_t *conf = NULL;
- ob_fd_t *ob_fd = NULL;
+ fd_t *wind_fd = NULL;
+ ob_fd_t *ob_fd = NULL;
+ ob_conf_t *conf = NULL;
conf = this->private;
ob_fd = ob_fd_ctx_get (this, fd);
- if (ob_fd && conf->use_anonymous_fd)
- return fd_anonymous (fd->inode);
+ if (ob_fd && conf->use_anonymous_fd) {
+ wind_fd = fd_anonymous (fd->inode);
+ if ((ob_fd->flags & O_DIRECT) && (flag))
+ *flag = *flag | O_DIRECT;
+ } else {
+ wind_fd = fd_ref (fd);
+ }
- return fd_ref (fd);
+ return wind_fd;
}
@@ -378,7 +384,7 @@ ob_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
conf = this->private;
if (!conf->read_after_open)
- wind_fd = ob_get_wind_fd (this, fd);
+ wind_fd = ob_get_wind_fd (this, fd, &flags);
else
wind_fd = fd_ref (fd);
@@ -427,7 +433,7 @@ ob_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata)
call_stub_t *stub = NULL;
fd_t *wind_fd = NULL;
- wind_fd = ob_get_wind_fd (this, fd);
+ wind_fd = ob_get_wind_fd (this, fd, NULL);
stub = fop_fstat_stub (frame, default_fstat_resume, wind_fd, xdata);