|
|
d1681e |
From 76b5366d4f346d5010bd153d20668f8860262c4e Mon Sep 17 00:00:00 2001
|
|
|
d1681e |
From: Xavier Hernandez <jahernan@redhat.com>
|
|
|
d1681e |
Date: Mon, 16 Oct 2017 13:57:59 +0200
|
|
|
d1681e |
Subject: [PATCH 158/180] cluster/ec: create eager-lock option for non-regular
|
|
|
d1681e |
files
|
|
|
d1681e |
|
|
|
d1681e |
A new option is added to allow independent configuration of eager
|
|
|
d1681e |
locking for regular files and non-regular files.
|
|
|
d1681e |
|
|
|
d1681e |
> Upstream patch: https://review.gluster.org/18530
|
|
|
d1681e |
|
|
|
d1681e |
Change-Id: I8f80e46d36d8551011132b15c0fac549b7fb1c60
|
|
|
d1681e |
BUG: 1530519
|
|
|
d1681e |
Signed-off-by: Xavier Hernandez <jahernan@redhat.com>
|
|
|
d1681e |
Reviewed-on: https://code.engineering.redhat.com/gerrit/130432
|
|
|
d1681e |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
d1681e |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
d1681e |
---
|
|
|
d1681e |
libglusterfs/src/globals.h | 2 ++
|
|
|
d1681e |
tests/basic/ec/ec-background-heals.t | 1 +
|
|
|
d1681e |
tests/basic/ec/ec-optimistic-changelog.t | 1 +
|
|
|
d1681e |
tests/bugs/cli/bug-1320388.t | 1 +
|
|
|
d1681e |
xlators/cluster/ec/src/ec-common.c | 22 +++++++++++++++-
|
|
|
d1681e |
xlators/cluster/ec/src/ec-types.h | 1 +
|
|
|
d1681e |
xlators/cluster/ec/src/ec.c | 34 ++++++++++++++++---------
|
|
|
d1681e |
xlators/mgmt/glusterd/src/glusterd-volume-set.c | 5 ++++
|
|
|
d1681e |
8 files changed, 54 insertions(+), 13 deletions(-)
|
|
|
d1681e |
|
|
|
d1681e |
diff --git a/libglusterfs/src/globals.h b/libglusterfs/src/globals.h
|
|
|
d1681e |
index 692d49d..6bbe3e6 100644
|
|
|
d1681e |
--- a/libglusterfs/src/globals.h
|
|
|
d1681e |
+++ b/libglusterfs/src/globals.h
|
|
|
d1681e |
@@ -101,6 +101,8 @@
|
|
|
d1681e |
|
|
|
d1681e |
#define GD_OP_VERSION_3_12_2 31202 /* Op-version for GlusterFS 3.12.2 */
|
|
|
d1681e |
|
|
|
d1681e |
+#define GD_OP_VERSION_3_12_3 31203 /* Op-version for GlusterFS 3.12.3 */
|
|
|
d1681e |
+
|
|
|
d1681e |
#define GD_OP_VERSION_3_13_0 31300 /* Op-version for GlusterFS 3.13.0 */
|
|
|
d1681e |
|
|
|
d1681e |
#define GD_OP_VERSION_3_13_1 31301 /* Op-version for GlusterFS 3.13.1 */
|
|
|
d1681e |
diff --git a/tests/basic/ec/ec-background-heals.t b/tests/basic/ec/ec-background-heals.t
|
|
|
d1681e |
index b9291bc..29778a4 100644
|
|
|
d1681e |
--- a/tests/basic/ec/ec-background-heals.t
|
|
|
d1681e |
+++ b/tests/basic/ec/ec-background-heals.t
|
|
|
d1681e |
@@ -17,6 +17,7 @@ TEST $CLI volume set $V0 performance.read-ahead off
|
|
|
d1681e |
TEST $CLI volume set $V0 performance.io-cache off
|
|
|
d1681e |
TEST $CLI volume set $V0 disperse.background-heals 0
|
|
|
d1681e |
TEST $CLI volume set $V0 disperse.eager-lock off
|
|
|
d1681e |
+TEST $CLI volume set $V0 disperse.other-eager-lock off
|
|
|
d1681e |
TEST $CLI volume start $V0
|
|
|
d1681e |
|
|
|
d1681e |
TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0;
|
|
|
d1681e |
diff --git a/tests/basic/ec/ec-optimistic-changelog.t b/tests/basic/ec/ec-optimistic-changelog.t
|
|
|
d1681e |
index 1277da6..a372cd3 100644
|
|
|
d1681e |
--- a/tests/basic/ec/ec-optimistic-changelog.t
|
|
|
d1681e |
+++ b/tests/basic/ec/ec-optimistic-changelog.t
|
|
|
d1681e |
@@ -19,6 +19,7 @@ TEST $CLI volume set $V0 performance.io-cache off
|
|
|
d1681e |
TEST $CLI volume set $V0 disperse.background-heals 0
|
|
|
d1681e |
TEST $CLI volume set $V0 disperse.optimistic-change-log off
|
|
|
d1681e |
TEST $CLI volume set $V0 disperse.eager-lock off
|
|
|
d1681e |
+TEST $CLI volume set $V0 disperse.other-eager-lock off
|
|
|
d1681e |
TEST $CLI volume start $V0
|
|
|
d1681e |
|
|
|
d1681e |
TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0;
|
|
|
d1681e |
diff --git a/tests/bugs/cli/bug-1320388.t b/tests/bugs/cli/bug-1320388.t
|
|
|
d1681e |
index ca23ab8..bed1392 100755
|
|
|
d1681e |
--- a/tests/bugs/cli/bug-1320388.t
|
|
|
d1681e |
+++ b/tests/bugs/cli/bug-1320388.t
|
|
|
d1681e |
@@ -29,6 +29,7 @@ TEST glusterd
|
|
|
d1681e |
TEST pidof glusterd
|
|
|
d1681e |
TEST $CLI volume create $V0 disperse 6 redundancy 2 $H0:$B0/${V0}{0..5}
|
|
|
d1681e |
TEST $CLI volume set $V0 disperse.eager-lock off
|
|
|
d1681e |
+TEST $CLI volume set $V0 disperse.other-eager-lock off
|
|
|
d1681e |
TEST $CLI volume start $V0
|
|
|
d1681e |
TEST glusterfs --entry-timeout=0 --attribute-timeout=0 -s $H0 --volfile-id $V0 $M0
|
|
|
d1681e |
EXPECT_WITHIN $CHILD_UP_TIMEOUT "^6$" ec_child_up_count $V0 0
|
|
|
d1681e |
diff --git a/xlators/cluster/ec/src/ec-common.c b/xlators/cluster/ec/src/ec-common.c
|
|
|
d1681e |
index 18ed274..051fff6 100644
|
|
|
d1681e |
--- a/xlators/cluster/ec/src/ec-common.c
|
|
|
d1681e |
+++ b/xlators/cluster/ec/src/ec-common.c
|
|
|
d1681e |
@@ -2553,6 +2553,26 @@ void ec_flush_size_version(ec_fop_data_t * fop)
|
|
|
d1681e |
ec_update_info(&fop->locks[0]);
|
|
|
d1681e |
}
|
|
|
d1681e |
|
|
|
d1681e |
+static gf_boolean_t
|
|
|
d1681e |
+ec_use_eager_lock(ec_t *ec, ec_fop_data_t *fop)
|
|
|
d1681e |
+{
|
|
|
d1681e |
+ /* Fops with no locks at this point mean that they are sent as sub-fops
|
|
|
d1681e |
+ * of other higher level fops. In this case we simply assume that the
|
|
|
d1681e |
+ * parent fop will take correct care of the eager lock. */
|
|
|
d1681e |
+ if (fop->lock_count == 0) {
|
|
|
d1681e |
+ return _gf_true;
|
|
|
d1681e |
+ }
|
|
|
d1681e |
+
|
|
|
d1681e |
+ /* We may have more than one lock, but this only happens in the rename
|
|
|
d1681e |
+ * fop, and both locks will reference an inode of the same type (a
|
|
|
d1681e |
+ * directory in this case), so we only need to check the first lock. */
|
|
|
d1681e |
+ if (fop->locks[0].lock->loc.inode->ia_type == IA_IFREG) {
|
|
|
d1681e |
+ return ec->eager_lock;
|
|
|
d1681e |
+ }
|
|
|
d1681e |
+
|
|
|
d1681e |
+ return ec->other_eager_lock;
|
|
|
d1681e |
+}
|
|
|
d1681e |
+
|
|
|
d1681e |
void ec_lock_reuse(ec_fop_data_t *fop)
|
|
|
d1681e |
{
|
|
|
d1681e |
ec_cbk_data_t *cbk;
|
|
|
d1681e |
@@ -2562,7 +2582,7 @@ void ec_lock_reuse(ec_fop_data_t *fop)
|
|
|
d1681e |
ec = fop->xl->private;
|
|
|
d1681e |
cbk = fop->answer;
|
|
|
d1681e |
|
|
|
d1681e |
- if (ec->eager_lock && cbk != NULL) {
|
|
|
d1681e |
+ if (ec_use_eager_lock(ec, fop) && cbk != NULL) {
|
|
|
d1681e |
if (cbk->xdata != NULL) {
|
|
|
d1681e |
if ((dict_get_int32(cbk->xdata, GLUSTERFS_INODELK_COUNT,
|
|
|
d1681e |
&count) == 0) && (count > 1)) {
|
|
|
d1681e |
diff --git a/xlators/cluster/ec/src/ec-types.h b/xlators/cluster/ec/src/ec-types.h
|
|
|
d1681e |
index 3129586..f6e2cd9 100644
|
|
|
d1681e |
--- a/xlators/cluster/ec/src/ec-types.h
|
|
|
d1681e |
+++ b/xlators/cluster/ec/src/ec-types.h
|
|
|
d1681e |
@@ -594,6 +594,7 @@ struct _ec {
|
|
|
d1681e |
gf_timer_t *timer;
|
|
|
d1681e |
gf_boolean_t shutdown;
|
|
|
d1681e |
gf_boolean_t eager_lock;
|
|
|
d1681e |
+ gf_boolean_t other_eager_lock;
|
|
|
d1681e |
gf_boolean_t optimistic_changelog;
|
|
|
d1681e |
gf_boolean_t parallel_writes;
|
|
|
d1681e |
uint32_t background_heals;
|
|
|
d1681e |
diff --git a/xlators/cluster/ec/src/ec.c b/xlators/cluster/ec/src/ec.c
|
|
|
d1681e |
index 09c5fa8..13ce7fb 100644
|
|
|
d1681e |
--- a/xlators/cluster/ec/src/ec.c
|
|
|
d1681e |
+++ b/xlators/cluster/ec/src/ec.c
|
|
|
d1681e |
@@ -276,6 +276,8 @@ reconfigure (xlator_t *this, dict_t *options)
|
|
|
d1681e |
bool, failed);
|
|
|
d1681e |
GF_OPTION_RECONF ("eager-lock", ec->eager_lock, options,
|
|
|
d1681e |
bool, failed);
|
|
|
d1681e |
+ GF_OPTION_RECONF ("other-eager-lock", ec->other_eager_lock, options,
|
|
|
d1681e |
+ bool, failed);
|
|
|
d1681e |
GF_OPTION_RECONF ("background-heals", background_heals, options,
|
|
|
d1681e |
uint32, failed);
|
|
|
d1681e |
GF_OPTION_RECONF ("heal-wait-qlength", heal_wait_qlen, options,
|
|
|
d1681e |
@@ -654,6 +656,7 @@ init (xlator_t *this)
|
|
|
d1681e |
GF_OPTION_INIT ("self-heal-daemon", ec->shd.enabled, bool, failed);
|
|
|
d1681e |
GF_OPTION_INIT ("iam-self-heal-daemon", ec->shd.iamshd, bool, failed);
|
|
|
d1681e |
GF_OPTION_INIT ("eager-lock", ec->eager_lock, bool, failed);
|
|
|
d1681e |
+ GF_OPTION_INIT ("other-eager-lock", ec->other_eager_lock, bool, failed);
|
|
|
d1681e |
GF_OPTION_INIT ("background-heals", ec->background_heals, uint32, failed);
|
|
|
d1681e |
GF_OPTION_INIT ("heal-wait-qlength", ec->heal_wait_qlen, uint32, failed);
|
|
|
d1681e |
GF_OPTION_INIT ("self-heal-window-size", ec->self_heal_window_size, uint32,
|
|
|
d1681e |
@@ -1397,18 +1400,25 @@ struct volume_options options[] =
|
|
|
d1681e |
{ .key = {"eager-lock"},
|
|
|
d1681e |
.type = GF_OPTION_TYPE_BOOL,
|
|
|
d1681e |
.default_value = "on",
|
|
|
d1681e |
- .description = "Enable/Disable eager lock for disperse volume. "
|
|
|
d1681e |
- "If a fop takes a lock and completes its operation, "
|
|
|
d1681e |
- "it waits for next 1 second before releasing the lock, "
|
|
|
d1681e |
- "to see if the lock can be reused for next fop from "
|
|
|
d1681e |
- "the same client. If ec finds any lock contention within "
|
|
|
d1681e |
- "1 second it releases the lock immediately before time "
|
|
|
d1681e |
- "expires. This improves the performance of file operations."
|
|
|
d1681e |
- "However, as it takes lock on first brick, for few operations "
|
|
|
d1681e |
- "like read, discovery of lock contention might take long time "
|
|
|
d1681e |
- "and can actually degrade the performance. "
|
|
|
d1681e |
- "If eager lock is disabled, lock will be released as soon as fop "
|
|
|
d1681e |
- "completes. "
|
|
|
d1681e |
+ .description = "Enable/Disable eager lock for regular files on a "
|
|
|
d1681e |
+ "disperse volume. If a fop takes a lock and completes "
|
|
|
d1681e |
+ "its operation, it waits for next 1 second before "
|
|
|
d1681e |
+ "releasing the lock, to see if the lock can be reused "
|
|
|
d1681e |
+ "for next fop from the same client. If ec finds any lock "
|
|
|
d1681e |
+ "contention within 1 second it releases the lock "
|
|
|
d1681e |
+ "immediately before time expires. This improves the "
|
|
|
d1681e |
+ "performance of file operations. However, as it takes "
|
|
|
d1681e |
+ "lock on first brick, for few operations like read, "
|
|
|
d1681e |
+ "discovery of lock contention might take long time and "
|
|
|
d1681e |
+ "can actually degrade the performance. If eager lock is "
|
|
|
d1681e |
+ "disabled, lock will be released as soon as fop "
|
|
|
d1681e |
+ "completes."
|
|
|
d1681e |
+ },
|
|
|
d1681e |
+ { .key = {"other-eager-lock"},
|
|
|
d1681e |
+ .type = GF_OPTION_TYPE_BOOL,
|
|
|
d1681e |
+ .default_value = "on",
|
|
|
d1681e |
+ .description = "It's equivalent to the eager-lock option but for non "
|
|
|
d1681e |
+ "regular files."
|
|
|
d1681e |
},
|
|
|
d1681e |
{ .key = {"background-heals"},
|
|
|
d1681e |
.type = GF_OPTION_TYPE_INT,
|
|
|
d1681e |
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
|
|
|
d1681e |
index 693c917..af0a982 100644
|
|
|
d1681e |
--- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c
|
|
|
d1681e |
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
|
|
|
d1681e |
@@ -1445,6 +1445,11 @@ struct volopt_map_entry glusterd_volopt_map[] = {
|
|
|
d1681e |
.op_version = GD_OP_VERSION_3_7_10,
|
|
|
d1681e |
.flags = OPT_FLAG_CLIENT_OPT
|
|
|
d1681e |
},
|
|
|
d1681e |
+ { .key = "disperse.other-eager-lock",
|
|
|
d1681e |
+ .voltype = "cluster/disperse",
|
|
|
d1681e |
+ .op_version = GD_OP_VERSION_3_12_2,
|
|
|
d1681e |
+ .flags = OPT_FLAG_CLIENT_OPT
|
|
|
d1681e |
+ },
|
|
|
d1681e |
{ .key = "cluster.quorum-type",
|
|
|
d1681e |
.voltype = "cluster/replicate",
|
|
|
d1681e |
.option = "quorum-type",
|
|
|
d1681e |
--
|
|
|
d1681e |
1.8.3.1
|
|
|
d1681e |
|