diff options
author | Amar Tumballi <amar@gluster.com> | 2012-02-06 17:49:14 +0530 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2012-02-14 01:09:02 -0800 |
commit | 0e6df0100e13123fe38f28c5a090777e894d8f52 (patch) | |
tree | 517c60cc953302172cb51f22f4b7aa52e557c1e9 /xlators/features | |
parent | e17ac220e4bff53fb89f5bea636acb61e347cf50 (diff) |
core: add an extra flag to readv()/writev() API
needed to implement a proper handling of open flag alterations
using fcntl() on fd.
Change-Id: Ic280d5db6f1dc0418d5c439abb8db1d3ac21ced0
Signed-off-by: Amar Tumballi <amar@gluster.com>
BUG: 782265
Reviewed-on: http://review.gluster.com/2723
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/features')
-rw-r--r-- | xlators/features/locks/src/posix.c | 21 | ||||
-rw-r--r-- | xlators/features/marker/src/marker.c | 4 | ||||
-rw-r--r-- | xlators/features/quiesce/src/quiesce.c | 20 | ||||
-rw-r--r-- | xlators/features/quiesce/src/quiesce.h | 1 | ||||
-rw-r--r-- | xlators/features/quota/src/quota.c | 12 | ||||
-rw-r--r-- | xlators/features/read-only/src/read-only-common.c | 2 | ||||
-rw-r--r-- | xlators/features/read-only/src/read-only-common.h | 2 | ||||
-rw-r--r-- | xlators/features/trash/src/trash.c | 12 |
8 files changed, 39 insertions, 35 deletions
diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c index 9025feb95..7ce4ec942 100644 --- a/xlators/features/locks/src/posix.c +++ b/xlators/features/locks/src/posix.c @@ -598,11 +598,11 @@ __rw_allowable (pl_inode_t *pl_inode, posix_lock_t *region, int pl_readv_cont (call_frame_t *frame, xlator_t *this, - fd_t *fd, size_t size, off_t offset) + fd_t *fd, size_t size, off_t offset, uint32_t flags) { STACK_WIND (frame, pl_readv_cbk, FIRST_CHILD (this), FIRST_CHILD (this)->fops->readv, - fd, size, offset); + fd, size, offset, flags); return 0; } @@ -610,7 +610,7 @@ pl_readv_cont (call_frame_t *frame, xlator_t *this, int pl_readv (call_frame_t *frame, xlator_t *this, - fd_t *fd, size_t size, off_t offset) + fd_t *fd, size_t size, off_t offset, uint32_t flags) { posix_locks_private_t *priv = NULL; pl_inode_t *pl_inode = NULL; @@ -657,7 +657,7 @@ pl_readv (call_frame_t *frame, xlator_t *this, } rw->stub = fop_readv_stub (frame, pl_readv_cont, - fd, size, offset); + fd, size, offset, flags); if (!rw->stub) { op_errno = ENOMEM; op_ret = -1; @@ -677,7 +677,7 @@ pl_readv (call_frame_t *frame, xlator_t *this, if (wind_needed) { STACK_WIND (frame, pl_readv_cbk, FIRST_CHILD (this), FIRST_CHILD (this)->fops->readv, - fd, size, offset); + fd, size, offset, flags); } if (op_ret == -1) @@ -691,11 +691,11 @@ pl_readv (call_frame_t *frame, xlator_t *this, int pl_writev_cont (call_frame_t *frame, xlator_t *this, fd_t *fd, struct iovec *vector, int count, off_t offset, - struct iobref *iobref) + uint32_t flags, struct iobref *iobref) { STACK_WIND (frame, pl_writev_cbk, FIRST_CHILD (this), FIRST_CHILD (this)->fops->writev, - fd, vector, count, offset, iobref); + fd, vector, count, offset, flags, iobref); return 0; } @@ -704,7 +704,7 @@ pl_writev_cont (call_frame_t *frame, xlator_t *this, fd_t *fd, int pl_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, struct iovec *vector, int32_t count, off_t offset, - struct iobref *iobref) + uint32_t flags, struct iobref *iobref) { posix_locks_private_t *priv = NULL; pl_inode_t *pl_inode = NULL; @@ -714,7 +714,6 @@ pl_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, int op_errno = 0; char wind_needed = 1; - priv = this->private; pl_inode = pl_inode_get (this, fd->inode); @@ -752,7 +751,7 @@ pl_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, rw->stub = fop_writev_stub (frame, pl_writev_cont, fd, vector, count, offset, - iobref); + flags, iobref); if (!rw->stub) { op_errno = ENOMEM; op_ret = -1; @@ -772,7 +771,7 @@ pl_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, if (wind_needed) STACK_WIND (frame, pl_writev_cbk, FIRST_CHILD (this), FIRST_CHILD (this)->fops->writev, - fd, vector, count, offset, iobref); + fd, vector, count, offset, flags, iobref); if (op_ret == -1) STACK_UNWIND_STRICT (writev, frame, -1, op_errno, NULL, NULL); diff --git a/xlators/features/marker/src/marker.c b/xlators/features/marker/src/marker.c index bbd448871..0a99740e9 100644 --- a/xlators/features/marker/src/marker.c +++ b/xlators/features/marker/src/marker.c @@ -627,7 +627,7 @@ marker_writev (call_frame_t *frame, fd_t *fd, struct iovec *vector, int32_t count, - off_t offset, + off_t offset, uint32_t flags, struct iobref *iobref) { int32_t ret = 0; @@ -650,7 +650,7 @@ marker_writev (call_frame_t *frame, wind: STACK_WIND (frame, marker_writev_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->writev, fd, vector, count, offset, - iobref); + flags, iobref); return 0; err: STACK_UNWIND_STRICT (writev, frame, -1, ENOMEM, NULL, NULL); diff --git a/xlators/features/quiesce/src/quiesce.c b/xlators/features/quiesce/src/quiesce.c index 57b2cdeac..1b150b215 100644 --- a/xlators/features/quiesce/src/quiesce.c +++ b/xlators/features/quiesce/src/quiesce.c @@ -323,7 +323,8 @@ quiesce_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if ((op_ret == -1) && (op_errno == ENOTCONN)) { /* Re-transmit (by putting in the queue) */ stub = fop_readv_stub (frame, default_readv_resume, - local->fd, local->size, local->offset); + local->fd, local->size, local->offset, + local->io_flag); if (!stub) { STACK_UNWIND_STRICT (readv, frame, -1, ENOMEM, NULL, 0, NULL, NULL); @@ -700,7 +701,8 @@ quiesce_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, /* Re-transmit (by putting in the queue) */ stub = fop_writev_stub (frame, default_writev_resume, local->fd, local->vector, local->flag, - local->offset, local->iobref); + local->offset, local->io_flags, + local->iobref); if (!stub) { STACK_UNWIND_STRICT (writev, frame, -1, ENOMEM, NULL, NULL); @@ -1786,7 +1788,7 @@ quiesce_writev (call_frame_t *frame, fd_t *fd, struct iovec *vector, int32_t count, - off_t off, + off_t off, uint32_t flags, struct iobref *iobref) { quiesce_priv_t *priv = NULL; @@ -1802,13 +1804,13 @@ quiesce_writev (call_frame_t *frame, fd, vector, count, - off, + off, flags, iobref); return 0; } stub = fop_writev_stub (frame, default_writev_resume, - fd, vector, count, off, iobref); + fd, vector, count, off, flags, iobref); if (!stub) { STACK_UNWIND_STRICT (writev, frame, -1, ENOMEM, NULL, NULL); return 0; @@ -1824,7 +1826,7 @@ quiesce_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, - off_t offset) + off_t offset, uint32_t flags) { quiesce_priv_t *priv = NULL; call_stub_t *stub = NULL; @@ -1837,6 +1839,7 @@ quiesce_readv (call_frame_t *frame, local->fd = fd_ref (fd); local->size = size; local->offset = offset; + local->io_flag = flags; frame->local = local; STACK_WIND (frame, @@ -1845,11 +1848,12 @@ quiesce_readv (call_frame_t *frame, FIRST_CHILD(this)->fops->readv, fd, size, - offset); + offset, flags); return 0; } - stub = fop_readv_stub (frame, default_readv_resume, fd, size, offset); + stub = fop_readv_stub (frame, default_readv_resume, fd, size, offset, + flags); if (!stub) { STACK_UNWIND_STRICT (readv, frame, -1, ENOMEM, NULL, 0, NULL, NULL); diff --git a/xlators/features/quiesce/src/quiesce.h b/xlators/features/quiesce/src/quiesce.h index 32b1935d9..1adb70ebe 100644 --- a/xlators/features/quiesce/src/quiesce.h +++ b/xlators/features/quiesce/src/quiesce.h @@ -55,6 +55,7 @@ typedef struct { entrylk_type type; gf_xattrop_flags_t xattrop_flags; int32_t wbflags; + uint32_t io_flag; } quiesce_local_t; #endif diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c index 32144c633..8df51bbbb 100644 --- a/xlators/features/quota/src/quota.c +++ b/xlators/features/quota/src/quota.c @@ -857,7 +857,7 @@ out: int32_t quota_writev_helper (call_frame_t *frame, xlator_t *this, fd_t *fd, struct iovec *vector, int32_t count, off_t off, - struct iobref *iobref) + uint32_t flags, struct iobref *iobref) { quota_local_t *local = NULL; int32_t op_errno = EINVAL; @@ -875,7 +875,7 @@ quota_writev_helper (call_frame_t *frame, xlator_t *this, fd_t *fd, STACK_WIND (frame, quota_writev_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->writev, fd, vector, count, off, - iobref); + flags, iobref); return 0; unwind: @@ -887,7 +887,7 @@ unwind: int32_t quota_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, struct iovec *vector, int32_t count, off_t off, - struct iobref *iobref) + uint32_t flags, struct iobref *iobref) { int32_t ret = -1, op_errno = EINVAL; int32_t parents = 0; @@ -919,7 +919,7 @@ quota_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, } stub = fop_writev_stub (frame, quota_writev_helper, fd, vector, count, - off, iobref); + off, flags, iobref); if (stub == NULL) { op_errno = ENOMEM; goto unwind; @@ -2295,7 +2295,7 @@ out: int32_t quota_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, - off_t offset) + off_t offset, uint32_t flags) { quota_local_t *local = NULL; @@ -2309,7 +2309,7 @@ quota_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, local->loc.inode = inode_ref (fd->inode); STACK_WIND (frame, quota_readv_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->readv, fd, size, offset); + FIRST_CHILD(this)->fops->readv, fd, size, offset, flags); return 0; unwind: diff --git a/xlators/features/read-only/src/read-only-common.c b/xlators/features/read-only/src/read-only-common.c index 5e4949ee0..efd175081 100644 --- a/xlators/features/read-only/src/read-only-common.c +++ b/xlators/features/read-only/src/read-only-common.c @@ -222,7 +222,7 @@ ro_fsyncdir (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags) int32_t ro_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, struct iovec *vector, - int32_t count, off_t off, struct iobref *iobref) + int32_t count, off_t off, uint32_t flags, struct iobref *iobref) { STACK_UNWIND_STRICT (writev, frame, -1, EROFS, NULL, NULL); return 0; diff --git a/xlators/features/read-only/src/read-only-common.h b/xlators/features/read-only/src/read-only-common.h index 3bc008e59..8c89e88ce 100644 --- a/xlators/features/read-only/src/read-only-common.h +++ b/xlators/features/read-only/src/read-only-common.h @@ -112,7 +112,7 @@ ro_fsyncdir (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags); int32_t ro_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, struct iovec *vector, - int32_t count, off_t off, struct iobref *iobref); + int32_t count, off_t off, uint32_t flags, struct iobref *iobref); int32_t ro_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict, diff --git a/xlators/features/trash/src/trash.c b/xlators/features/trash/src/trash.c index 42ee79a96..38920db6c 100644 --- a/xlators/features/trash/src/trash.c +++ b/xlators/features/trash/src/trash.c @@ -690,7 +690,7 @@ trash_truncate_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local->fsize = stbuf->ia_size; STACK_WIND (frame, trash_truncate_writev_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->writev, - local->newfd, vector, count, local->cur_offset, iobuf); + local->newfd, vector, count, local->cur_offset, 0, iobuf); out: return 0; @@ -723,7 +723,7 @@ trash_truncate_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, STACK_WIND (frame, trash_truncate_readv_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->readv, local->fd, (size_t)GF_BLOCK_READV_SIZE, - local->cur_offset); + local->cur_offset, 0); goto out; } @@ -763,7 +763,7 @@ trash_truncate_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, STACK_WIND (frame, trash_truncate_readv_cbk, FIRST_CHILD (this), FIRST_CHILD (this)->fops->readv, - local->fd, (size_t)GF_BLOCK_READV_SIZE, local->cur_offset); + local->fd, (size_t)GF_BLOCK_READV_SIZE, local->cur_offset, 0); out: return 0; @@ -1110,7 +1110,7 @@ trash_ftruncate_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, STACK_WIND (frame, trash_ftruncate_readv_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->readv, local->fd, (size_t)GF_BLOCK_READV_SIZE, - local->cur_offset); + local->cur_offset, 0); return 0; } @@ -1142,7 +1142,7 @@ trash_ftruncate_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, STACK_WIND (frame, trash_ftruncate_writev_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->writev, - local->newfd, vector, count, local->cur_offset, NULL); + local->newfd, vector, count, local->cur_offset, 0, NULL); return 0; } @@ -1194,7 +1194,7 @@ trash_ftruncate_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, STACK_WIND (frame, trash_ftruncate_readv_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->readv, local->fd, - (size_t)GF_BLOCK_READV_SIZE, local->cur_offset); + (size_t)GF_BLOCK_READV_SIZE, local->cur_offset, 0); return 0; } |