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 /libglusterfs | |
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 'libglusterfs')
-rw-r--r-- | libglusterfs/src/call-stub.c | 20 | ||||
-rw-r--r-- | libglusterfs/src/call-stub.h | 6 | ||||
-rw-r--r-- | libglusterfs/src/defaults.c | 16 | ||||
-rw-r--r-- | libglusterfs/src/defaults.h | 24 | ||||
-rw-r--r-- | libglusterfs/src/syncop.c | 14 | ||||
-rw-r--r-- | libglusterfs/src/syncop.h | 6 | ||||
-rw-r--r-- | libglusterfs/src/xlator.h | 4 |
7 files changed, 53 insertions, 37 deletions
diff --git a/libglusterfs/src/call-stub.c b/libglusterfs/src/call-stub.c index 24ca3825b0d..cdae9df251e 100644 --- a/libglusterfs/src/call-stub.c +++ b/libglusterfs/src/call-stub.c @@ -888,7 +888,7 @@ fop_readv_stub (call_frame_t *frame, fop_readv_t fn, fd_t *fd, size_t size, - off_t off) + off_t off, uint32_t flags) { call_stub_t *stub = NULL; @@ -900,8 +900,10 @@ fop_readv_stub (call_frame_t *frame, stub->args.readv.fn = fn; if (fd) stub->args.readv.fd = fd_ref (fd); - stub->args.readv.size = size; - stub->args.readv.off = off; + stub->args.readv.size = size; + stub->args.readv.off = off; + stub->args.readv.flags = flags; + out: return stub; } @@ -945,7 +947,7 @@ fop_writev_stub (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) { call_stub_t *stub = NULL; @@ -960,9 +962,11 @@ fop_writev_stub (call_frame_t *frame, if (fd) stub->args.writev.fd = fd_ref (fd); stub->args.writev.vector = iov_dup (vector, count); - stub->args.writev.count = count; - stub->args.writev.off = off; + stub->args.writev.count = count; + stub->args.writev.off = off; + stub->args.writev.flags = flags; stub->args.writev.iobref = iobref_ref (iobref); + out: return stub; } @@ -2258,7 +2262,8 @@ call_resume_wind (call_stub_t *stub) stub->frame->this, stub->args.readv.fd, stub->args.readv.size, - stub->args.readv.off); + stub->args.readv.off, + stub->args.readv.flags); break; } @@ -2270,6 +2275,7 @@ call_resume_wind (call_stub_t *stub) stub->args.writev.vector, stub->args.writev.count, stub->args.writev.off, + stub->args.writev.flags, stub->args.writev.iobref); break; } diff --git a/libglusterfs/src/call-stub.h b/libglusterfs/src/call-stub.h index 5e6c0a1d385..081f6d200f0 100644 --- a/libglusterfs/src/call-stub.h +++ b/libglusterfs/src/call-stub.h @@ -268,6 +268,7 @@ typedef struct { fd_t *fd; size_t size; off_t off; + uint32_t flags; } readv; struct { fop_readv_cbk_t fn; @@ -286,6 +287,7 @@ typedef struct { struct iovec *vector; int32_t count; off_t off; + uint32_t flags; struct iobref *iobref; } writev; struct { @@ -823,7 +825,7 @@ fop_readv_stub (call_frame_t *frame, fop_readv_t fn, fd_t *fd, size_t size, - off_t off); + off_t off, uint32_t flags); call_stub_t * fop_readv_cbk_stub (call_frame_t *frame, @@ -841,7 +843,7 @@ fop_writev_stub (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); call_stub_t * diff --git a/libglusterfs/src/defaults.c b/libglusterfs/src/defaults.c index be2c9c55f4c..f3a8d2832a8 100644 --- a/libglusterfs/src/defaults.c +++ b/libglusterfs/src/defaults.c @@ -517,20 +517,20 @@ default_flush_resume (call_frame_t *frame, xlator_t *this, fd_t *fd) int32_t default_writev_resume (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) { STACK_WIND (frame, default_writev_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->writev, fd, vector, count, off, - iobref); + flags, iobref); return 0; } int32_t default_readv_resume (call_frame_t *frame, xlator_t *this, fd_t *fd, - size_t size, off_t offset) + size_t size, off_t offset, uint32_t flags) { STACK_WIND (frame, default_readv_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->readv, fd, size, offset); + FIRST_CHILD(this)->fops->readv, fd, size, offset, flags); return 0; } @@ -898,21 +898,21 @@ default_flush (call_frame_t *frame, xlator_t *this, fd_t *fd) int32_t default_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, - struct iovec *vector, int32_t count, off_t off, + struct iovec *vector, int32_t count, off_t off, uint32_t flags, struct iobref *iobref) { STACK_WIND (frame, default_writev_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->writev, fd, vector, count, off, - iobref); + flags, iobref); return 0; } int32_t default_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, - off_t offset) + off_t offset, uint32_t flags) { STACK_WIND (frame, default_readv_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->readv, fd, size, offset); + FIRST_CHILD(this)->fops->readv, fd, size, offset, flags); return 0; } diff --git a/libglusterfs/src/defaults.h b/libglusterfs/src/defaults.h index deba1557d5f..f30bd8332ad 100644 --- a/libglusterfs/src/defaults.h +++ b/libglusterfs/src/defaults.h @@ -117,7 +117,8 @@ int32_t default_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, - off_t offset); + off_t offset, + uint32_t flags); int32_t default_writev (call_frame_t *frame, xlator_t *this, @@ -125,6 +126,7 @@ int32_t default_writev (call_frame_t *frame, struct iovec *vector, int32_t count, off_t offset, + uint32_t flags, struct iobref *iobref); int32_t default_flush (call_frame_t *frame, @@ -333,18 +335,18 @@ int32_t default_open_resume (call_frame_t *frame, int32_t wbflags); int32_t default_readv_resume (call_frame_t *frame, - xlator_t *this, - fd_t *fd, - size_t size, - off_t offset); + xlator_t *this, + fd_t *fd, + size_t size, + off_t offset, uint32_t flags); int32_t default_writev_resume (call_frame_t *frame, - xlator_t *this, - fd_t *fd, - struct iovec *vector, - int32_t count, - off_t offset, - struct iobref *iobref); + xlator_t *this, + fd_t *fd, + struct iovec *vector, + int32_t count, + off_t offset, uint32_t flags, + struct iobref *iobref); int32_t default_flush_resume (call_frame_t *frame, xlator_t *this, diff --git a/libglusterfs/src/syncop.c b/libglusterfs/src/syncop.c index 86b4822c59d..7b6f78248ef 100644 --- a/libglusterfs/src/syncop.c +++ b/libglusterfs/src/syncop.c @@ -791,12 +791,13 @@ syncop_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int syncop_readv (xlator_t *subvol, fd_t *fd, size_t size, off_t off, - struct iovec **vector, int *count, struct iobref **iobref) + uint32_t flags, struct iovec **vector, int *count, + struct iobref **iobref) { struct syncargs args = {0, }; SYNCOP (subvol, (&args), syncop_readv_cbk, subvol->fops->readv, - fd, size, off); + fd, size, off, flags); if (vector) *vector = args.vector; @@ -836,19 +837,20 @@ syncop_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int syncop_writev (xlator_t *subvol, fd_t *fd, struct iovec *vector, - int32_t count, off_t offset, struct iobref *iobref) + int32_t count, off_t offset, struct iobref *iobref, + uint32_t flags) { struct syncargs args = {0, }; SYNCOP (subvol, (&args), syncop_writev_cbk, subvol->fops->writev, - fd, vector, count, offset, iobref); + fd, vector, count, offset, flags, iobref); errno = args.op_errno; return args.op_ret; } int syncop_write (xlator_t *subvol, fd_t *fd, const char *buf, int size, - off_t offset, struct iobref *iobref) + off_t offset, struct iobref *iobref, uint32_t flags) { struct syncargs args = {0,}; struct iovec vec = {0,}; @@ -857,7 +859,7 @@ int syncop_write (xlator_t *subvol, fd_t *fd, const char *buf, int size, vec.iov_base = (void *)buf; SYNCOP (subvol, (&args), syncop_writev_cbk, subvol->fops->writev, - fd, &vec, 1, offset, iobref); + fd, &vec, 1, offset, flags, iobref); errno = args.op_errno; return args.op_ret; diff --git a/libglusterfs/src/syncop.h b/libglusterfs/src/syncop.h index 7f696f17723..627fb619703 100644 --- a/libglusterfs/src/syncop.h +++ b/libglusterfs/src/syncop.h @@ -195,10 +195,12 @@ int syncop_open (xlator_t *subvol, loc_t *loc, int32_t flags, fd_t *fd); int syncop_close (fd_t *fd); int syncop_write (xlator_t *subvol, fd_t *fd, const char *buf, int size, - off_t offset, struct iobref *iobref); + off_t offset, struct iobref *iobref, uint32_t flags); int syncop_writev (xlator_t *subvol, fd_t *fd, struct iovec *vector, - int32_t count, off_t offset, struct iobref *iobref); + int32_t count, off_t offset, struct iobref *iobref, + uint32_t flags); int syncop_readv (xlator_t *subvol, fd_t *fd, size_t size, off_t off, + uint32_t flags, /* out */ struct iovec **vector, int *count, struct iobref **iobref); diff --git a/libglusterfs/src/xlator.h b/libglusterfs/src/xlator.h index cca2505ab18..c8eff335329 100644 --- a/libglusterfs/src/xlator.h +++ b/libglusterfs/src/xlator.h @@ -510,7 +510,8 @@ typedef int32_t (*fop_readv_t) (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, - off_t offset); + off_t offset, + uint32_t flags); typedef int32_t (*fop_writev_t) (call_frame_t *frame, xlator_t *this, @@ -518,6 +519,7 @@ typedef int32_t (*fop_writev_t) (call_frame_t *frame, struct iovec *vector, int32_t count, off_t offset, + uint32_t flags, struct iobref *iobref); typedef int32_t (*fop_flush_t) (call_frame_t *frame, |