diff options
| author | Xavier Hernandez <xhernandez@datalab.es> | 2014-07-14 17:34:04 +0200 |
|---|---|---|
| committer | Vijay Bellur <vbellur@redhat.com> | 2014-09-16 10:14:28 -0700 |
| commit | b224dd14b75fb993eec4f44ecf11edce8a6fc42f (patch) | |
| tree | 2a67a96fa981428adaef85d57c408265db50c8f2 /xlators/cluster/ec/src/ec-inode-read.c | |
| parent | 7fe574039815ad1339851eb0dc9f2366b02ceddf (diff) | |
ec: Optimize read/write performance
This patch significantly improves performance of read/write
operations on a dispersed volume by reusing previous inodelk/
entrylk operations on the same inode/entry. This reduces the
latency of each individual operation considerably.
Inode version and size are also updated when needed instead
of on each request. This gives an additional boost.
This is a backport of http://review.gluster.org/8369/
Change-Id: I4b98d5508c86b53032e16e295f72a3f83fd8fcac
BUG: 1140844
Signed-off-by: Xavier Hernandez <xhernandez@datalab.es>
Reviewed-on: http://review.gluster.org/8746
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Dan Lambright <dlambrig@redhat.com>
Diffstat (limited to 'xlators/cluster/ec/src/ec-inode-read.c')
| -rw-r--r-- | xlators/cluster/ec/src/ec-inode-read.c | 47 |
1 files changed, 41 insertions, 6 deletions
diff --git a/xlators/cluster/ec/src/ec-inode-read.c b/xlators/cluster/ec/src/ec-inode-read.c index a31220ecbc1..0cb5559f62b 100644 --- a/xlators/cluster/ec/src/ec-inode-read.c +++ b/xlators/cluster/ec/src/ec-inode-read.c @@ -252,7 +252,15 @@ int32_t ec_manager_getxattr(ec_fop_data_t * fop, int32_t state) { case EC_STATE_INIT: case EC_STATE_LOCK: - ec_lock_inode(fop, &fop->loc[0]); + if (fop->fd == NULL) + { + ec_lock_prepare_inode(fop, &fop->loc[0]); + } + else + { + ec_lock_prepare_fd(fop, fop->fd); + } + ec_lock(fop); return EC_STATE_DISPATCH; @@ -311,7 +319,7 @@ int32_t ec_manager_getxattr(ec_fop_data_t * fop, int32_t state) cbk->op_errno, cbk->dict, cbk->xdata); } - return EC_STATE_UNLOCK; + return EC_STATE_LOCK_REUSE; case -EC_STATE_LOCK: case -EC_STATE_DISPATCH: @@ -325,6 +333,12 @@ int32_t ec_manager_getxattr(ec_fop_data_t * fop, int32_t state) fop->error, NULL, NULL); } + return EC_STATE_LOCK_REUSE; + + case -EC_STATE_LOCK_REUSE: + case EC_STATE_LOCK_REUSE: + ec_lock_reuse(fop, 0); + return EC_STATE_UNLOCK; case -EC_STATE_UNLOCK: @@ -1216,7 +1230,8 @@ int32_t ec_manager_readv(ec_fop_data_t * fop, int32_t state) /* Fall through */ case EC_STATE_LOCK: - ec_lock_fd(fop, fop->fd); + ec_lock_prepare_fd(fop, fop->fd); + ec_lock(fop); return EC_STATE_GET_SIZE_AND_VERSION; @@ -1276,7 +1291,7 @@ int32_t ec_manager_readv(ec_fop_data_t * fop, int32_t state) &cbk->iatt[0], cbk->buffers, cbk->xdata); } - return EC_STATE_UNLOCK; + return EC_STATE_LOCK_REUSE; case -EC_STATE_LOCK: case -EC_STATE_GET_SIZE_AND_VERSION: @@ -1291,6 +1306,12 @@ int32_t ec_manager_readv(ec_fop_data_t * fop, int32_t state) NULL, 0, NULL, NULL, NULL); } + return EC_STATE_LOCK_REUSE; + + case -EC_STATE_LOCK_REUSE: + case EC_STATE_LOCK_REUSE: + ec_lock_reuse(fop, 0); + return EC_STATE_UNLOCK; case -EC_STATE_UNLOCK: @@ -1455,7 +1476,15 @@ int32_t ec_manager_stat(ec_fop_data_t * fop, int32_t state) { case EC_STATE_INIT: case EC_STATE_LOCK: - ec_lock_inode(fop, &fop->loc[0]); + if (fop->fd == NULL) + { + ec_lock_prepare_inode(fop, &fop->loc[0]); + } + else + { + ec_lock_prepare_fd(fop, fop->fd); + } + ec_lock(fop); return EC_STATE_GET_SIZE_AND_VERSION; @@ -1522,7 +1551,7 @@ int32_t ec_manager_stat(ec_fop_data_t * fop, int32_t state) } } - return EC_STATE_UNLOCK; + return EC_STATE_LOCK_REUSE; case -EC_STATE_LOCK: case -EC_STATE_GET_SIZE_AND_VERSION: @@ -1548,6 +1577,12 @@ int32_t ec_manager_stat(ec_fop_data_t * fop, int32_t state) } } + return EC_STATE_LOCK_REUSE; + + case -EC_STATE_LOCK_REUSE: + case EC_STATE_LOCK_REUSE: + ec_lock_reuse(fop, 0); + return EC_STATE_UNLOCK; case -EC_STATE_UNLOCK: |
