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/cluster | |
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/cluster')
-rw-r--r-- | xlators/cluster/afr/src/afr-inode-read.c | 8 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr-inode-read.h | 2 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr-inode-write.c | 4 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr-inode-write.h | 4 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heal-algorithm.c | 4 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr.h | 2 | ||||
-rw-r--r-- | xlators/cluster/afr/src/pump.c | 6 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-common.h | 3 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-inode-read.c | 8 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-inode-write.c | 10 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-rebalance.c | 8 | ||||
-rw-r--r-- | xlators/cluster/stripe/src/stripe.c | 8 |
12 files changed, 39 insertions, 28 deletions
diff --git a/xlators/cluster/afr/src/afr-inode-read.c b/xlators/cluster/afr/src/afr-inode-read.c index 5b534cf3742..0ef0f4f8642 100644 --- a/xlators/cluster/afr/src/afr-inode-read.c +++ b/xlators/cluster/afr/src/afr-inode-read.c @@ -1083,7 +1083,8 @@ afr_readv_cbk (call_frame_t *frame, void *cookie, children[next_call_child], children[next_call_child]->fops->readv, local->fd, local->cont.readv.size, - local->cont.readv.offset); + local->cont.readv.offset, + local->cont.readv.flags); } out: @@ -1098,7 +1099,7 @@ out: int32_t afr_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) { afr_private_t * priv = NULL; afr_local_t * local = NULL; @@ -1143,6 +1144,7 @@ afr_readv (call_frame_t *frame, xlator_t *this, local->cont.readv.size = size; local->cont.readv.offset = offset; + local->cont.readv.flags = flags; ret = afr_open_fd_fix (frame, this, _gf_false); if (ret) { @@ -1153,7 +1155,7 @@ afr_readv (call_frame_t *frame, xlator_t *this, (void *) (long) call_child, children[call_child], children[call_child]->fops->readv, - fd, size, offset); + fd, size, offset, flags); ret = 0; out: diff --git a/xlators/cluster/afr/src/afr-inode-read.h b/xlators/cluster/afr/src/afr-inode-read.h index 8af3ed1b503..5ec7411b11d 100644 --- a/xlators/cluster/afr/src/afr-inode-read.h +++ b/xlators/cluster/afr/src/afr-inode-read.h @@ -38,7 +38,7 @@ afr_readlink (call_frame_t *frame, xlator_t *this, int32_t afr_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); int32_t afr_getxattr (call_frame_t *frame, xlator_t *this, diff --git a/xlators/cluster/afr/src/afr-inode-write.c b/xlators/cluster/afr/src/afr-inode-write.c index 2a7e0e736a5..72dcdc4785b 100644 --- a/xlators/cluster/afr/src/afr-inode-write.c +++ b/xlators/cluster/afr/src/afr-inode-write.c @@ -157,6 +157,7 @@ afr_writev_wind (call_frame_t *frame, xlator_t *this) local->cont.writev.vector, local->cont.writev.count, local->cont.writev.offset, + local->cont.writev.flags, local->cont.writev.iobref); if (!--call_count) @@ -441,7 +442,7 @@ out: int afr_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) { afr_private_t * priv = NULL; afr_local_t * local = NULL; @@ -466,6 +467,7 @@ afr_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, local->cont.writev.vector = iov_dup (vector, count); local->cont.writev.count = count; local->cont.writev.offset = offset; + local->cont.writev.flags = flags; local->cont.writev.iobref = iobref_ref (iobref); local->fd = fd_ref (fd); diff --git a/xlators/cluster/afr/src/afr-inode-write.h b/xlators/cluster/afr/src/afr-inode-write.h index bdd0b48669d..729a490d562 100644 --- a/xlators/cluster/afr/src/afr-inode-write.h +++ b/xlators/cluster/afr/src/afr-inode-write.h @@ -37,9 +37,9 @@ afr_fchmod (call_frame_t *frame, xlator_t *this, fd_t *fd, mode_t mode); int32_t -afr_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, +afr_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); int32_t afr_truncate (call_frame_t *frame, xlator_t *this, diff --git a/xlators/cluster/afr/src/afr-self-heal-algorithm.c b/xlators/cluster/afr/src/afr-self-heal-algorithm.c index cb1516d8473..629822a8e60 100644 --- a/xlators/cluster/afr/src/afr-self-heal-algorithm.c +++ b/xlators/cluster/afr/src/afr-self-heal-algorithm.c @@ -519,7 +519,7 @@ sh_loop_read_cbk (call_frame_t *loop_frame, void *cookie, priv->children[i], priv->children[i]->fops->writev, loop_sh->healing_fd, vector, count, - loop_sh->offset, iobref); + loop_sh->offset, 0, iobref); if (!--call_count) break; @@ -546,7 +546,7 @@ sh_loop_read (call_frame_t *loop_frame, xlator_t *this) priv->children[loop_sh->source], priv->children[loop_sh->source]->fops->readv, loop_sh->healing_fd, loop_sh->block_size, - loop_sh->offset); + loop_sh->offset, 0); return 0; } diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h index 0c4bf5f6385..003d666e00d 100644 --- a/xlators/cluster/afr/src/afr.h +++ b/xlators/cluster/afr/src/afr.h @@ -475,6 +475,7 @@ typedef struct _afr_local { size_t size; off_t offset; int last_index; + uint32_t flags; } readv; /* dir read */ @@ -508,6 +509,7 @@ typedef struct _afr_local { struct iobref *iobref; int32_t count; off_t offset; + uint32_t flags; } writev; struct { diff --git a/xlators/cluster/afr/src/pump.c b/xlators/cluster/afr/src/pump.c index 8ef30edbaf4..df0b31166ef 100644 --- a/xlators/cluster/afr/src/pump.c +++ b/xlators/cluster/afr/src/pump.c @@ -1987,7 +1987,7 @@ pump_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) { afr_private_t *priv = NULL; @@ -2000,11 +2000,11 @@ pump_writev (call_frame_t *frame, fd, vector, count, - off, + off, flags, iobref); return 0; } - afr_writev (frame, this, fd, vector, count, off, iobref); + afr_writev (frame, this, fd, vector, count, off, flags, iobref); return 0; } diff --git a/xlators/cluster/dht/src/dht-common.h b/xlators/cluster/dht/src/dht-common.h index ef78892eb04..749abe5380d 100644 --- a/xlators/cluster/dht/src/dht-common.h +++ b/xlators/cluster/dht/src/dht-common.h @@ -466,7 +466,7 @@ int32_t dht_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 dht_writev (call_frame_t *frame, xlator_t *this, @@ -474,6 +474,7 @@ int32_t dht_writev (call_frame_t *frame, struct iovec *vector, int32_t count, off_t offset, + uint32_t flags, struct iobref *iobref); int32_t dht_flush (call_frame_t *frame, diff --git a/xlators/cluster/dht/src/dht-inode-read.c b/xlators/cluster/dht/src/dht-inode-read.c index 7352e47bd62..3ec6f4ba243 100644 --- a/xlators/cluster/dht/src/dht-inode-read.c +++ b/xlators/cluster/dht/src/dht-inode-read.c @@ -448,7 +448,8 @@ dht_readv2 (xlator_t *this, call_frame_t *frame, int op_ret) subvol = local->cached_subvol; STACK_WIND (frame, dht_readv_cbk, subvol, subvol->fops->readv, - local->fd, local->rebalance.size, local->rebalance.offset); + local->fd, local->rebalance.size, local->rebalance.offset, + local->rebalance.flags); return 0; @@ -459,7 +460,7 @@ out: int dht_readv (call_frame_t *frame, xlator_t *this, - fd_t *fd, size_t size, off_t off) + fd_t *fd, size_t size, off_t off, uint32_t flags) { xlator_t *subvol = NULL; int op_errno = -1; @@ -485,11 +486,12 @@ dht_readv (call_frame_t *frame, xlator_t *this, local->rebalance.offset = off; local->rebalance.size = size; + local->rebalance.flags = flags; local->call_cnt = 1; STACK_WIND (frame, dht_readv_cbk, subvol, subvol->fops->readv, - fd, size, off); + fd, size, off, flags); return 0; diff --git a/xlators/cluster/dht/src/dht-inode-write.c b/xlators/cluster/dht/src/dht-inode-write.c index 4f65b46713c..2f59e7c94f6 100644 --- a/xlators/cluster/dht/src/dht-inode-write.c +++ b/xlators/cluster/dht/src/dht-inode-write.c @@ -112,14 +112,15 @@ dht_writev2 (xlator_t *this, call_frame_t *frame, int op_ret) STACK_WIND (frame, dht_writev_cbk, subvol, subvol->fops->writev, local->fd, local->rebalance.vector, local->rebalance.count, - local->rebalance.offset, local->rebalance.iobref); + local->rebalance.offset, local->rebalance.flags, + local->rebalance.iobref); return 0; } int -dht_writev (call_frame_t *frame, xlator_t *this, - fd_t *fd, struct iovec *vector, int count, off_t off, +dht_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, + struct iovec *vector, int count, off_t off, uint32_t flags, struct iobref *iobref) { xlator_t *subvol = NULL; @@ -149,12 +150,13 @@ dht_writev (call_frame_t *frame, xlator_t *this, local->rebalance.vector = iov_dup (vector, count); local->rebalance.offset = off; local->rebalance.count = count; + local->rebalance.flags = flags; local->rebalance.iobref = iobref_ref (iobref); local->call_cnt = 1; STACK_WIND (frame, dht_writev_cbk, subvol, subvol->fops->writev, - fd, vector, count, off, iobref); + fd, vector, count, off, flags, iobref); return 0; diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c index 6c91baaaccb..dfd6f3b6ecc 100644 --- a/xlators/cluster/dht/src/dht-rebalance.c +++ b/xlators/cluster/dht/src/dht-rebalance.c @@ -60,7 +60,7 @@ dht_write_with_holes (xlator_t *to, fd_t *fd, struct iovec *vec, int count, ret = syncop_write (to, fd, (buf + tmp_offset), (start_idx - tmp_offset), (offset + tmp_offset), - iobref); + iobref, 0); /* 'path' will be logged in calling function */ if (ret < 0) { gf_log (THIS->name, GF_LOG_WARNING, @@ -78,7 +78,7 @@ dht_write_with_holes (xlator_t *to, fd_t *fd, struct iovec *vec, int count, /* This means, last chunk is not yet written.. write it */ ret = syncop_write (to, fd, (buf + tmp_offset), (buf_len - tmp_offset), - (offset + tmp_offset), iobref); + (offset + tmp_offset), iobref, 0); if (ret < 0) { /* 'path' will be logged in calling function */ gf_log (THIS->name, GF_LOG_WARNING, @@ -263,7 +263,7 @@ __dht_rebalance_migrate_data (xlator_t *from, xlator_t *to, fd_t *src, fd_t *dst read_size = (((ia_size - total) > DHT_REBALANCE_BLKSIZE) ? DHT_REBALANCE_BLKSIZE : (ia_size - total)); ret = syncop_readv (from, src, read_size, - offset, &vector, &count, &iobref); + offset, 0, &vector, &count, &iobref); if (!ret || (ret < 0)) { break; } @@ -273,7 +273,7 @@ __dht_rebalance_migrate_data (xlator_t *from, xlator_t *to, fd_t *src, fd_t *dst ret, offset, iobref); else ret = syncop_writev (to, dst, vector, count, - offset, iobref); + offset, iobref, 0); if (ret < 0) { break; } diff --git a/xlators/cluster/stripe/src/stripe.c b/xlators/cluster/stripe/src/stripe.c index 086f07f92ca..5385fb359e9 100644 --- a/xlators/cluster/stripe/src/stripe.c +++ b/xlators/cluster/stripe/src/stripe.c @@ -3692,7 +3692,7 @@ end: int32_t stripe_readv (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) { int32_t op_errno = EINVAL; int32_t idx = 0; @@ -3779,7 +3779,7 @@ stripe_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, idx = (index % fctx->stripe_count); STACK_WIND (rframe, stripe_readv_cbk, fctx->xl_array[idx], fctx->xl_array[idx]->fops->readv, - fd, frame_size, frame_offset); + fd, frame_size, frame_offset, flags); frame_offset += frame_size; } @@ -3842,7 +3842,7 @@ out: int32_t stripe_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) { struct iovec *tmp_vec = NULL; stripe_local_t *local = NULL; @@ -3915,7 +3915,7 @@ stripe_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, STACK_WIND (frame, stripe_writev_cbk, fctx->xl_array[idx], fctx->xl_array[idx]->fops->writev, fd, tmp_vec, - tmp_count, offset + offset_offset, iobref); + tmp_count, offset + offset_offset, flags, iobref); GF_FREE (tmp_vec); offset_offset += fill_size; if (remaining_size == 0) |