diff options
author | Raghavendra G <rgowdapp@redhat.com> | 2018-07-14 18:01:30 +0530 |
---|---|---|
committer | Raghavendra G <rgowdapp@redhat.com> | 2018-07-19 06:56:20 +0000 |
commit | 1ee1666df5a5f30075536c6816582bbdad229f27 (patch) | |
tree | a0206f731bc7690b39e1256fa30d0a22966f8446 /xlators/performance/read-ahead | |
parent | 1dd71ff8addf93dcde66a4e84916e90dbf3cad07 (diff) |
performance/read-ahead: stricter adherence to force-atime-update
Throwaway read-ahead cache in fstat only if force-atime-update is
set. Note that fstat flushes read-ahead cache only for atime
consistency. However if atime consistency is needed user is required
to set force-atime-update which updates atime on backend fs even
though application reads are served from read-ahead cache. So, if user
has not set force-atime-update, atime won't be accurate and there is
no point in flushing read-ahead cache in fstats. mounts
requiring atime consistency have to mandatorily set
force-atime-update.
Also note that normally kernel interspers reads with fstat. So,
read-ahead is not effective as fstats flush read-ahead-cache. Instead
it regresses performance due to wasted network reads. It is
recommended to turn off read-ahead if applications require atime
consistency.
This patch is aimed at applications which don't require atime
consistency. Without atime consistency required, read-ahead cache is
effective and increases performance of sequential reads.
Change-Id: I122bbc410cee96661823f9c4b934383495c18446
Signed-off-by: Raghavendra G <rgowdapp@redhat.com>
Fixes: bz#1601166
Diffstat (limited to 'xlators/performance/read-ahead')
-rw-r--r-- | xlators/performance/read-ahead/src/read-ahead.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/xlators/performance/read-ahead/src/read-ahead.c b/xlators/performance/read-ahead/src/read-ahead.c index 1185c6e4183..652b001129b 100644 --- a/xlators/performance/read-ahead/src/read-ahead.c +++ b/xlators/performance/read-ahead/src/read-ahead.c @@ -867,6 +867,9 @@ ra_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata) inode_t *inode = NULL; uint64_t tmp_file = 0; int32_t op_errno = EINVAL; + ra_conf_t *conf = NULL; + + conf = this->private; GF_ASSERT (frame); GF_VALIDATE_OR_GOTO (frame->this->name, this, unwind); @@ -874,20 +877,23 @@ ra_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata) inode = fd->inode; - LOCK (&inode->lock); - { - list_for_each_entry (iter_fd, &inode->fd_list, inode_list) { - tmp_file = 0; - fd_ctx_get (iter_fd, this, &tmp_file); - file = (ra_file_t *)(long)tmp_file; - - if (!file) - continue; - flush_region (frame, file, 0, - file->pages.prev->offset + 1, 0); + if (conf->force_atime_update) { + LOCK (&inode->lock); + { + list_for_each_entry (iter_fd, &inode->fd_list, + inode_list) { + tmp_file = 0; + fd_ctx_get (iter_fd, this, &tmp_file); + file = (ra_file_t *)(long)tmp_file; + + if (!file) + continue; + flush_region (frame, file, 0, + file->pages.prev->offset + 1, 0); + } } + UNLOCK (&inode->lock); } - UNLOCK (&inode->lock); STACK_WIND (frame, ra_attr_cbk, FIRST_CHILD (this), FIRST_CHILD (this)->fops->fstat, fd, xdata); |