diff options
author | Krutika Dhananjay <kdhananj@redhat.com> | 2015-08-26 09:27:42 +0530 |
---|---|---|
committer | Pranith Kumar Karampuri <pkarampu@redhat.com> | 2015-08-29 23:51:50 -0700 |
commit | bbd4624980a037c07fc134eee252840fed82dcf1 (patch) | |
tree | 6550e304b9ceb315844ab0f18fda80de7460cd50 /xlators/features/shard | |
parent | 848788e37929f5c636af5c454545fc62f58122c5 (diff) |
features/shard: Fix size update for writes at hole region
Backport of: http://review.gluster.org/#/c/12020
Change-Id: I4b6e9101ccb881d3d285704902484e1e89ccaceb
BUG: 1257204
Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
Reviewed-on: http://review.gluster.org/12026
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators/features/shard')
-rw-r--r-- | xlators/features/shard/src/shard.c | 11 | ||||
-rw-r--r-- | xlators/features/shard/src/shard.h | 1 |
2 files changed, 10 insertions, 2 deletions
diff --git a/xlators/features/shard/src/shard.c b/xlators/features/shard/src/shard.c index ba1579f1170..2c893cc1101 100644 --- a/xlators/features/shard/src/shard.c +++ b/xlators/features/shard/src/shard.c @@ -2929,6 +2929,13 @@ shard_writev_do_cbk (call_frame_t *frame, void *cookie, xlator_t *this, SHARD_STACK_UNWIND (writev, frame, local->written_size, local->op_errno, NULL, NULL, NULL); } else { + if (local->is_write_extending) + local->delta_size = (local->offset + + local->total_size) - + local->prebuf.ia_size; + else + local->delta_size = 0; + local->hole_size = 0; if (xdata) local->xattr_rsp = dict_ref (xdata); shard_update_file_size (frame, this, local->fd, NULL, @@ -3102,8 +3109,8 @@ shard_post_lookup_writev_handler (call_frame_t *frame, xlator_t *this) /* At this point, calculate the size of the hole if it is going to be * created as part of this write. */ - if (local->offset > local->prebuf.ia_size) - local->hole_size = local->offset - local->prebuf.ia_size; + if (local->offset + local->total_size > local->prebuf.ia_size) + local->is_write_extending = _gf_true; if (local->create_count) shard_common_resume_mknod (frame, this, diff --git a/xlators/features/shard/src/shard.h b/xlators/features/shard/src/shard.h index e6144a29e68..f480c2912b6 100644 --- a/xlators/features/shard/src/shard.h +++ b/xlators/features/shard/src/shard.h @@ -185,6 +185,7 @@ typedef struct shard_local { struct iobuf *iobuf; gf_dirent_t entries_head; gf_boolean_t list_inited; + gf_boolean_t is_write_extending; shard_post_fop_handler_t handler; shard_post_lookup_shards_fop_handler_t pls_fop_handler; shard_post_resolve_fop_handler_t post_res_handler; |