summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2009-06-30 17:34:44 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-06-30 16:10:34 -0700
commit095caa8feb992459781c992c843f34c98c5bd607 (patch)
tree8d69ab2a12116811071c47c98f7c5765c4af54bc /xlators
parentfccb91cba86a8219191d7f241f4c6a722d512b4e (diff)
enhancement in write-behind
Write calls should not be pushed to background only when the mandatory locking is enabled, in all other cases (eg: O_SYNC, O_DIRECT etc), we should not be 'caching' any data, but the calls can be pushed to the background Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/performance/write-behind/src/write-behind.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c
index 9ce8557f4..ab149b750 100644
--- a/xlators/performance/write-behind/src/write-behind.c
+++ b/xlators/performance/write-behind/src/write-behind.c
@@ -895,12 +895,11 @@ int32_t
wb_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
int32_t op_errno, fd_t *fd)
{
- int32_t flags = 0;
+ long flags = 0;
wb_file_t *file = NULL;
wb_conf_t *conf = this->private;
- if (op_ret != -1)
- {
+ if (op_ret != -1) {
file = wb_file_create (this, fd);
/*
@@ -913,14 +912,13 @@ wb_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
file->disabled = 1;
/* If O_DIRECT then, we disable chaching */
- if (frame->local)
- {
- flags = *((int32_t *)frame->local);
+ if (frame->local) {
+ flags = (long)frame->local;
if (((flags & O_DIRECT) == O_DIRECT)
|| ((flags & O_RDONLY) == O_RDONLY)
|| (((flags & O_SYNC) == O_SYNC)
- && conf->enable_O_SYNC == _gf_true)) {
- file->disabled = 1;
+ && (conf->enable_O_SYNC == _gf_true))) {
+ file->window_size = 0;
}
}
@@ -936,8 +934,7 @@ int32_t
wb_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags,
fd_t *fd)
{
- frame->local = CALLOC (1, sizeof(int32_t));
- *((int32_t *)frame->local) = flags;
+ frame->local = (void *)(long)flags;
STACK_WIND (frame,
wb_open_cbk,
@@ -953,10 +950,11 @@ wb_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, fd_t *fd, inode_t *inode,
struct stat *buf)
{
+ long flags = 0;
wb_file_t *file = NULL;
+ wb_conf_t *conf = this->private;
- if (op_ret != -1)
- {
+ if (op_ret != -1) {
file = wb_file_create (this, fd);
/*
* If mandatory locking has been enabled on this file,
@@ -964,8 +962,17 @@ wb_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
*/
if ((fd->inode->st_mode & S_ISGID)
&& !(fd->inode->st_mode & S_IXGRP))
- {
file->disabled = 1;
+
+ /* If O_DIRECT then, we disable chaching */
+ if (frame->local) {
+ flags = (long)frame->local;
+ if (((flags & O_DIRECT) == O_DIRECT)
+ || ((flags & O_RDONLY) == O_RDONLY)
+ || (((flags & O_SYNC) == O_SYNC)
+ && (conf->enable_O_SYNC == _gf_true))) {
+ file->window_size = 0;
+ }
}
LOCK_INIT (&file->lock);
@@ -980,6 +987,8 @@ int32_t
wb_create (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags,
mode_t mode, fd_t *fd)
{
+ frame->local = (void *)(long)flags;
+
STACK_WIND (frame,
wb_create_cbk,
FIRST_CHILD(this),