From 0e6df0100e13123fe38f28c5a090777e894d8f52 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Mon, 6 Feb 2012 17:49:14 +0530 Subject: 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 BUG: 782265 Reviewed-on: http://review.gluster.com/2723 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- xlators/protocol/client/src/client.c | 6 ++++-- xlators/protocol/client/src/client3_1-fops.c | 4 ++++ xlators/protocol/server/src/server3_1-fops.c | 7 +++++-- 3 files changed, 13 insertions(+), 4 deletions(-) (limited to 'xlators/protocol') diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c index 5f11987034d..229e0191725 100644 --- a/xlators/protocol/client/src/client.c +++ b/xlators/protocol/client/src/client.c @@ -753,7 +753,7 @@ out: int32_t client_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, - off_t offset) + off_t offset, uint32_t flags) { int ret = -1; clnt_conf_t *conf = NULL; @@ -767,6 +767,7 @@ client_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, args.fd = fd; args.size = size; args.offset = offset; + args.flags = flags; proc = &conf->fops->proctable[GF_FOP_READ]; if (!proc) { @@ -792,7 +793,7 @@ out: int32_t client_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) { int ret = -1; clnt_conf_t *conf = NULL; @@ -807,6 +808,7 @@ client_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, args.vector = vector; args.count = count; args.offset = off; + args.flags = flags; args.iobref = iobref; proc = &conf->fops->proctable[GF_FOP_WRITE]; diff --git a/xlators/protocol/client/src/client3_1-fops.c b/xlators/protocol/client/src/client3_1-fops.c index fe928aecd19..6ad646409bb 100644 --- a/xlators/protocol/client/src/client3_1-fops.c +++ b/xlators/protocol/client/src/client3_1-fops.c @@ -3420,6 +3420,8 @@ client3_1_readv (call_frame_t *frame, xlator_t *this, req.size = args->size; req.offset = args->offset; req.fd = remote_fd; + req.flag = args->flags; + memcpy (req.gfid, args->fd->inode->gfid, 16); /* TODO: what is the size we should send ? */ @@ -3508,6 +3510,8 @@ client3_1_writev (call_frame_t *frame, xlator_t *this, void *data) req.size = args->size; req.offset = args->offset; req.fd = remote_fd; + req.flag = args->flags; + memcpy (req.gfid, args->fd->inode->gfid, 16); ret = client_submit_vec_request (this, &req, frame, conf->fops, GFS3_OP_WRITE, diff --git a/xlators/protocol/server/src/server3_1-fops.c b/xlators/protocol/server/src/server3_1-fops.c index 62aca398dae..90f70256943 100644 --- a/xlators/protocol/server/src/server3_1-fops.c +++ b/xlators/protocol/server/src/server3_1-fops.c @@ -2389,7 +2389,7 @@ server_writev_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_writev_cbk, bound_xl, bound_xl->fops->writev, state->fd, state->payload_vector, state->payload_count, - state->offset, state->iobref); + state->offset, state->flags, state->iobref); return 0; err: @@ -2411,7 +2411,7 @@ server_readv_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_readv_cbk, bound_xl, bound_xl->fops->readv, - state->fd, state->size, state->offset); + state->fd, state->size, state->offset, state->flags); return 0; err: @@ -2937,6 +2937,8 @@ server_readv (rpcsvc_request_t *req) state->resolve.fd_no = args.fd; state->size = args.size; state->offset = args.offset; + state->flags = args.flag; + memcpy (state->resolve.gfid, args.gfid, 16); ret = 0; @@ -2984,6 +2986,7 @@ server_writev (rpcsvc_request_t *req) state->resolve.type = RESOLVE_MUST; state->resolve.fd_no = args.fd; state->offset = args.offset; + state->flags = args.flag; state->iobref = iobref_ref (req->iobref); memcpy (state->resolve.gfid, args.gfid, 16); -- cgit