summaryrefslogtreecommitdiffstats
path: root/xlators/performance
diff options
context:
space:
mode:
authorJeff Darcy <jdarcy@redhat.com>2012-01-10 17:42:24 -0500
committerAnand Avati <avati@redhat.com>2012-02-21 02:25:22 -0800
commit490d8805f0d9b4e58258505d678f0e75e089aa26 (patch)
tree1dbd68bc24117cca9e84e111c95abf43a39aa362 /xlators/performance
parentbca46fd46b1a1a28daeb9ea3f47cef9bbacecd6d (diff)
Honor O_SYNC etc. properly.
Change-Id: I3dd90fe230386ad5571c5e639f27460e3d003f0e BUG: 773100 Signed-off-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-on: http://review.gluster.com/2626 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/performance')
-rw-r--r--xlators/performance/write-behind/src/write-behind.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c
index be7da2f44ce..a8b1c0c3cff 100644
--- a/xlators/performance/write-behind/src/write-behind.c
+++ b/xlators/performance/write-behind/src/write-behind.c
@@ -1344,6 +1344,29 @@ out:
return 0;
}
+void
+wb_disable_all (xlator_t *this, fd_t *origfd)
+{
+ inode_t *inode = NULL;
+ fd_t *otherfd = NULL;
+ uint64_t tmp_file = 0;
+
+ inode = origfd->inode;
+ LOCK(&inode->lock);
+ list_for_each_entry (otherfd, &inode->fd_list, inode_list) {
+ if (otherfd == origfd) {
+ continue;
+ }
+ if (fd_ctx_get(otherfd,this,&tmp_file)) {
+ continue;
+ }
+ gf_log(this->name,GF_LOG_DEBUG,
+ "disabling wb on %p because %p is O_SYNC",
+ otherfd, origfd);
+ ((wb_file_t *)(long)tmp_file)->disabled = 1;
+ }
+ UNLOCK(&inode->lock);
+}
int32_t
wb_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
@@ -1382,10 +1405,13 @@ wb_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
|| ((flags & O_ACCMODE) == O_RDONLY)
|| (((flags & O_SYNC) == O_SYNC)
&& conf->enable_O_SYNC == _gf_true)) {
- file->window_conf = 0;
+ gf_log(this->name,GF_LOG_DEBUG,
+ "disabling wb on %p", fd);
+ file->disabled = 1;
+ wb_disable_all(this,fd);
}
- if (wbflags & GF_OPEN_NOWB) {
+ else if (wbflags & GF_OPEN_NOWB) {
file->disabled = 1;
}
}