diff options
author | Vikas Gorur <vikas@gluster.com> | 2009-10-26 09:15:13 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2009-10-27 03:32:32 -0700 |
commit | 78c98cac267ef9aebcaa3c35d70ea93c17462e62 (patch) | |
tree | 01a4afb2d596e905b746f17f601b2afffc661d13 /xlators/cluster/afr/src/afr-inode-write.c | |
parent | a284bf490cdf6ce334a4e70b22eedd7e639620f9 (diff) |
cluster/afr: 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
Diffstat (limited to 'xlators/cluster/afr/src/afr-inode-write.c')
-rw-r--r-- | xlators/cluster/afr/src/afr-inode-write.c | 76 |
1 files changed, 33 insertions, 43 deletions
diff --git a/xlators/cluster/afr/src/afr-inode-write.c b/xlators/cluster/afr/src/afr-inode-write.c index f840a1da467..7dcc067089b 100644 --- a/xlators/cluster/afr/src/afr-inode-write.c +++ b/xlators/cluster/afr/src/afr-inode-write.c @@ -57,8 +57,6 @@ afr_writev_unwind (call_frame_t *frame, xlator_t *this) afr_private_t * priv = NULL; call_frame_t *main_frame = NULL; - struct stat * unwind_buf = NULL; - local = frame->local; priv = this->private; @@ -71,16 +69,13 @@ afr_writev_unwind (call_frame_t *frame, xlator_t *this) UNLOCK (&frame->lock); if (main_frame) { - if (local->cont.writev.read_child_buf.st_ino) { - unwind_buf = &local->cont.writev.read_child_buf; - } else { - unwind_buf = &local->cont.writev.buf; - } - - unwind_buf->st_ino = local->cont.writev.ino; + local->cont.writev.prebuf.st_ino = local->cont.writev.ino; + local->cont.writev.postbuf.st_ino = local->cont.writev.ino; - AFR_STACK_UNWIND (writev, main_frame, local->op_ret, - local->op_errno, unwind_buf, NULL); + AFR_STACK_UNWIND (writev, main_frame, + local->op_ret, local->op_errno, + &local->cont.writev.prebuf, + &local->cont.writev.postbuf); } return 0; } @@ -115,12 +110,14 @@ afr_writev_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (op_ret != -1) { if (local->success_count == 0) { - local->op_ret = op_ret; - local->cont.writev.buf = *postbuf; + local->op_ret = op_ret; + local->cont.writev.prebuf = *prebuf; + local->cont.writev.postbuf = *postbuf; } if (child_index == read_child) { - local->cont.writev.read_child_buf = *postbuf; + local->cont.writev.prebuf = *prebuf; + local->cont.writev.postbuf = *postbuf; } local->success_count++; @@ -245,11 +242,11 @@ afr_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, transaction_frame->local = local; local->op = GF_FOP_WRITE; - local->cont.writev.vector = iov_dup (vector, count); - local->cont.writev.count = count; - local->cont.writev.offset = offset; - local->cont.writev.ino = fd->inode->ino; - local->cont.writev.iobref = iobref_ref (iobref); + local->cont.writev.vector = iov_dup (vector, count); + local->cont.writev.count = count; + local->cont.writev.offset = offset; + local->cont.writev.ino = fd->inode->ino; + local->cont.writev.iobref = iobref_ref (iobref); local->transaction.fop = afr_writev_wind; local->transaction.done = afr_writev_done; @@ -291,8 +288,6 @@ afr_truncate_unwind (call_frame_t *frame, xlator_t *this) afr_private_t * priv = NULL; call_frame_t *main_frame = NULL; - struct stat * unwind_buf = NULL; - local = frame->local; priv = this->private; @@ -305,17 +300,13 @@ afr_truncate_unwind (call_frame_t *frame, xlator_t *this) UNLOCK (&frame->lock); if (main_frame) { - if (local->cont.truncate.read_child_buf.st_ino) { - unwind_buf = &local->cont.truncate.read_child_buf; - } else { - unwind_buf = &local->cont.truncate.buf; - } - - unwind_buf->st_ino = local->cont.truncate.ino; + local->cont.truncate.prebuf.st_ino = local->cont.truncate.ino; + local->cont.truncate.postbuf.st_ino = local->cont.truncate.ino; AFR_STACK_UNWIND (truncate, main_frame, local->op_ret, local->op_errno, - unwind_buf, NULL); + &local->cont.truncate.prebuf, + &local->cont.truncate.postbuf); } return 0; @@ -352,11 +343,13 @@ afr_truncate_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (op_ret != -1) { if (local->success_count == 0) { local->op_ret = op_ret; - local->cont.truncate.buf = *postbuf; + local->cont.truncate.prebuf = *prebuf; + local->cont.truncate.postbuf = *postbuf; } if (child_index == read_child) { - local->cont.truncate.read_child_buf = *postbuf; + local->cont.truncate.prebuf = *prebuf; + local->cont.truncate.postbuf = *postbuf; } local->success_count++; @@ -514,8 +507,6 @@ afr_ftruncate_unwind (call_frame_t *frame, xlator_t *this) afr_private_t * priv = NULL; call_frame_t *main_frame = NULL; - struct stat * unwind_buf = NULL; - local = frame->local; priv = this->private; @@ -528,16 +519,13 @@ afr_ftruncate_unwind (call_frame_t *frame, xlator_t *this) UNLOCK (&frame->lock); if (main_frame) { - if (local->cont.ftruncate.read_child_buf.st_ino) { - unwind_buf = &local->cont.ftruncate.read_child_buf; - } else { - unwind_buf = &local->cont.ftruncate.buf; - } - - unwind_buf->st_ino = local->cont.ftruncate.ino; + local->cont.ftruncate.prebuf.st_ino = local->cont.ftruncate.ino; + local->cont.ftruncate.postbuf.st_ino = local->cont.ftruncate.ino; AFR_STACK_UNWIND (ftruncate, main_frame, local->op_ret, - local->op_errno, unwind_buf, NULL); + local->op_errno, + &local->cont.ftruncate.prebuf, + &local->cont.ftruncate.postbuf); } return 0; } @@ -573,11 +561,13 @@ afr_ftruncate_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (op_ret != -1) { if (local->success_count == 0) { local->op_ret = op_ret; - local->cont.ftruncate.buf = *postbuf; + local->cont.ftruncate.prebuf = *prebuf; + local->cont.ftruncate.postbuf = *postbuf; } if (child_index == read_child) { - local->cont.ftruncate.read_child_buf = *postbuf; + local->cont.ftruncate.prebuf = *prebuf; + local->cont.ftruncate.postbuf = *postbuf; } local->success_count++; |