summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/ec/src/ec-inode-read.c
diff options
context:
space:
mode:
authorXavier Hernandez <xhernandez@datalab.es>2014-07-14 17:34:04 +0200
committerVijay Bellur <vbellur@redhat.com>2014-09-15 23:12:16 -0700
commitd97863562bb0d2f685df3d2e3aa4bef1299c8307 (patch)
treeb8d9455cdface5425e2452e98751ac75dac358e4 /xlators/cluster/ec/src/ec-inode-read.c
parent2be54585002cd1c9d02928b89a02047b58dd6aed (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. Change-Id: I4b98d5508c86b53032e16e295f72a3f83fd8fcac BUG: 1122586 Signed-off-by: Xavier Hernandez <xhernandez@datalab.es> Reviewed-on: http://review.gluster.org/8369 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.c47
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: