summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@gluster.com>2009-10-01 06:58:59 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-10-01 07:23:31 -0700
commit1e0b3920dc0bcb8d15586adceacacedba75b17ab (patch)
treeea3d15f301bbac408eeac25cdad5706157df190b
parentb342852f9d41c8274cdc808c1a481487b44a7ab9 (diff)
read-ahead: NFS-friendly logic changes
Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 145 (NFSv3 related additions to 2.1 task list) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=145
-rw-r--r--xlators/performance/read-ahead/src/read-ahead.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/xlators/performance/read-ahead/src/read-ahead.c b/xlators/performance/read-ahead/src/read-ahead.c
index a6b6f2f254b..cc876486904 100644
--- a/xlators/performance/read-ahead/src/read-ahead.c
+++ b/xlators/performance/read-ahead/src/read-ahead.c
@@ -48,6 +48,7 @@ ra_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
ra_conf_t *conf = NULL;
ra_file_t *file = NULL;
int ret = 0;
+ long wbflags = 0;
conf = this->private;
@@ -55,6 +56,8 @@ ra_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
goto unwind;
}
+ wbflags = (long)frame->local;
+
file = CALLOC (1, sizeof (*file));
if (!file) {
op_ret = -1;
@@ -77,6 +80,10 @@ ra_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if ((fd->flags & O_DIRECT) || ((fd->flags & O_ACCMODE) == O_WRONLY))
file->disabled = 1;
+ if (wbflags & GF_OPEN_NOWB) {
+ file->disabled = 1;
+ }
+
file->offset = (unsigned long long) 0;
file->conf = conf;
file->pages.next = &file->pages;
@@ -102,6 +109,8 @@ ra_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
file->page_count = 1;
}
+ frame->local = NULL;
+
unwind:
STACK_UNWIND (frame, op_ret, op_errno, fd);
@@ -170,7 +179,8 @@ ra_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
pthread_mutex_init (&file->file_lock, NULL);
unwind:
- STACK_UNWIND (frame, op_ret, op_errno, fd, inode, buf);
+ STACK_UNWIND (frame, op_ret, op_errno, fd, inode, buf, preparent,
+ postparent);
return 0;
}
@@ -180,6 +190,8 @@ int
ra_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags,
fd_t *fd, int32_t wbflags)
{
+ frame->local = (void *)(long)wbflags;
+
STACK_WIND (frame, ra_open_cbk,
FIRST_CHILD (this),
FIRST_CHILD (this)->fops->open,
@@ -511,7 +523,7 @@ ra_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
return 0;
unwind:
- STACK_UNWIND (frame, -1, op_errno, NULL, 0, NULL);
+ STACK_UNWIND (frame, -1, op_errno, NULL, 0, NULL, NULL);
return 0;
}
@@ -595,7 +607,7 @@ ra_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t datasync)
return 0;
unwind:
- STACK_UNWIND (frame, -1, op_errno);
+ STACK_UNWIND (frame, -1, op_errno, NULL, NULL);
return 0;
}
@@ -656,7 +668,7 @@ ra_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, struct iovec *vector,
return 0;
unwind:
- STACK_UNWIND (frame, -1, op_errno, NULL);
+ STACK_UNWIND (frame, -1, op_errno, NULL, NULL);
return 0;
}