diff options
| author | Ravishankar N <ravishankar@redhat.com> | 2016-04-05 15:16:52 +0530 | 
|---|---|---|
| committer | Pranith Kumar Karampuri <pkarampu@redhat.com> | 2016-04-11 04:32:37 -0700 | 
| commit | e1004679563ef17c460f83098983baf105655712 (patch) | |
| tree | 86b6d63da1aee0131fcc285203f90213f06328d8 /xlators/features/arbiter/src/arbiter.c | |
| parent | 09c9da3b12da73dd718522fdf7587d3be5a14137 (diff) | |
arbiter: write performance improvement
Problem: The throughput for a 'dd' workload was much less for arbiter
configuration when compared to normal replica-3 volume. There were 2
issues:
i)arbiter_writev was using the request dict as response dict while
unwinding, leading to incorect GLUSTERFS_WRITE_IS_APPEND and
GLUSTERFS_OPEN_FD_COUNT values (=4), leading to immediate post-ops
because is_afr_delayed_changelog_post_op_needed() failed due to
afr_are_multiple_fds_opened() check.
ii) The arbiter code in afr was setting local->transaction.{start and len} =0
to take full file locks. What this meant was even for simultaenous but
non-overlapping writevs, afr_transaction_eager_lock_init() was not
happening because afr_locals_overlap() always stays true. Consequently
is_afr_delayed_changelog_post_op_needed() failed due to
local->delayed_post_op not being set.
Fix:
i) Send appropriate response dict values in arbiter_writev.
ii) Modify flock params instead of local->transaction.{start and len} to
take full file locks in the transaction.
Also changed _fill_writev_xdata() in posix to fill rsp_xdata for
whatever key is requested for.
Change-Id: I1c5fc5e98aba49ade540bb441a022e65b753432a
BUG: 1324004
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
Reported-by: Robert Rauch <robert.rauch@gns-systems.de>
Reported-by: Russel Purinton <russell.purinton@gmail.com>
Reviewed-on: http://review.gluster.org/13906
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Smoke: Gluster Build System <jenkins@build.gluster.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators/features/arbiter/src/arbiter.c')
| -rw-r--r-- | xlators/features/arbiter/src/arbiter.c | 57 | 
1 files changed, 49 insertions, 8 deletions
diff --git a/xlators/features/arbiter/src/arbiter.c b/xlators/features/arbiter/src/arbiter.c index b404597be9d..786f60b7bc9 100644 --- a/xlators/features/arbiter/src/arbiter.c +++ b/xlators/features/arbiter/src/arbiter.c @@ -128,8 +128,7 @@ arbiter_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset,          }          buf = ctx->iattbuf;  unwind: -        STACK_UNWIND_STRICT (truncate, frame, op_ret, op_errno, buf, buf, -                             xdata); +        STACK_UNWIND_STRICT (truncate, frame, op_ret, op_errno, buf, buf, NULL);          return 0;  } @@ -152,10 +151,48 @@ arbiter_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,          buf = ctx->iattbuf;  unwind:          STACK_UNWIND_STRICT (ftruncate, frame, op_ret, op_errno, buf, buf, -                             xdata); +                             NULL);          return 0;  } +dict_t* +arbiter_fill_writev_xdata (fd_t *fd, dict_t *xdata, xlator_t *this) +{ +        dict_t  *rsp_xdata = NULL; +        int32_t ret = 0; +        int is_append = 1; + +        if (!fd || !fd->inode || gf_uuid_is_null (fd->inode->gfid)) { +                goto out; +        } + +        if (!xdata) +                goto out; + +        rsp_xdata = dict_new(); +        if (!rsp_xdata) +                goto out; + +        if (dict_get (xdata, GLUSTERFS_OPEN_FD_COUNT)) { +                ret = dict_set_uint32 (rsp_xdata, GLUSTERFS_OPEN_FD_COUNT, +                                       fd->inode->fd_count); +                if (ret < 0) { +                        gf_msg_debug (this->name, 0, "Failed to set dict value" +                                      " for GLUSTERFS_OPEN_FD_COUNT"); +                } +        } +        if (dict_get (xdata, GLUSTERFS_WRITE_IS_APPEND)) { +                ret = dict_set_uint32 (rsp_xdata, GLUSTERFS_WRITE_IS_APPEND, +                                       is_append); +                if (ret < 0) { +                        gf_msg_debug (this->name, 0, "Failed to set dict value" +                                      " for GLUSTERFS_WRITE_IS_APPEND"); +                } +        } +out: +        return rsp_xdata; +} +  int32_t  arbiter_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,                  struct iovec *vector, int32_t count, off_t off, uint32_t flags, @@ -163,6 +200,7 @@ arbiter_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,  {          arbiter_inode_ctx_t *ctx      = NULL;          struct iatt         *buf      = NULL; +        dict_t           *rsp_xdata   = NULL;          int                  op_ret   = 0;          int                  op_errno = 0; @@ -174,8 +212,12 @@ arbiter_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,          }          buf = ctx->iattbuf;          op_ret = iov_length (vector, count); +        rsp_xdata = arbiter_fill_writev_xdata (fd, xdata, this);  unwind: -        STACK_UNWIND_STRICT (writev, frame, op_ret, op_errno, buf, buf, xdata); +        STACK_UNWIND_STRICT (writev, frame, op_ret, op_errno, buf, buf, +                             rsp_xdata); +        if (rsp_xdata) +                dict_unref (rsp_xdata);          return 0;  } @@ -196,8 +238,7 @@ arbiter_fallocate (call_frame_t *frame, xlator_t *this, fd_t *fd,          }          buf = ctx->iattbuf;  unwind: -        STACK_UNWIND_STRICT(fallocate, frame, op_ret, op_errno, buf, buf, -                            xdata); +        STACK_UNWIND_STRICT(fallocate, frame, op_ret, op_errno, buf, buf, NULL);          return 0;  } @@ -218,7 +259,7 @@ arbiter_discard (call_frame_t *frame, xlator_t *this, fd_t *fd,          }          buf = ctx->iattbuf;  unwind: -        STACK_UNWIND_STRICT(discard, frame, op_ret, op_errno, buf, buf, xdata); +        STACK_UNWIND_STRICT(discard, frame, op_ret, op_errno, buf, buf, NULL);          return 0;  } @@ -239,7 +280,7 @@ arbiter_zerofill (call_frame_t *frame, xlator_t *this, fd_t *fd,          }          buf = ctx->iattbuf;  unwind: -        STACK_UNWIND_STRICT(zerofill, frame, op_ret, op_errno, buf, buf, xdata); +        STACK_UNWIND_STRICT(zerofill, frame, op_ret, op_errno, buf, buf, NULL);          return 0;  }  | 
