From bf20b066c233a9fc7c82335a131a7969f356b89b Mon Sep 17 00:00:00 2001 From: Sunil Kumar Acharya Date: Thu, 20 Apr 2017 12:24:51 +0530 Subject: cluster/ec: Implement self-heal-window_size option Fix implements the heal window size option for EC. This option control the maximum size of read/write operation carried out in self-heal process. BUG: 1441491 Change-Id: I6c0ef65c9ca18b0828f91b319d4f52ac5b77d0d8 Signed-off-by: Sunil Kumar Acharya Reviewed-on: https://review.gluster.org/17098 Reviewed-by: Pranith Kumar Karampuri Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System --- xlators/cluster/ec/src/ec-heal.c | 4 +--- xlators/cluster/ec/src/ec-types.h | 1 + xlators/cluster/ec/src/ec.c | 14 ++++++++++++++ xlators/mgmt/glusterd/src/glusterd-volume-set.c | 5 +++++ 4 files changed, 21 insertions(+), 3 deletions(-) (limited to 'xlators') diff --git a/xlators/cluster/ec/src/ec-heal.c b/xlators/cluster/ec/src/ec-heal.c index e4f9c0e3539..afe7833f385 100644 --- a/xlators/cluster/ec/src/ec-heal.c +++ b/xlators/cluster/ec/src/ec-heal.c @@ -1897,7 +1897,6 @@ ec_rebuild_data (call_frame_t *frame, ec_t *ec, fd_t *fd, uint64_t size, ec_heal_t *heal = NULL; int ret = 0; syncbarrier_t barrier; - struct iobuf_pool *pool = NULL; if (syncbarrier_init (&barrier)) return -ENOMEM; @@ -1907,9 +1906,8 @@ ec_rebuild_data (call_frame_t *frame, ec_t *ec, fd_t *fd, uint64_t size, heal->xl = ec->xl; heal->data = &barrier; syncbarrier_init (heal->data); - pool = ec->xl->ctx->iobuf_pool; heal->total_size = size; - heal->size = iobpool_default_pagesize (pool); + heal->size = (128 * GF_UNIT_KB * (ec->self_heal_window_size)); /* We need to adjust the size to a multiple of the stripe size of the * volume. Otherwise writes would need to fill gaps (head and/or tail) * with existent data from the bad bricks. This could be garbage on a diff --git a/xlators/cluster/ec/src/ec-types.h b/xlators/cluster/ec/src/ec-types.h index f184f459c2e..3e93a1a32cc 100644 --- a/xlators/cluster/ec/src/ec-types.h +++ b/xlators/cluster/ec/src/ec-types.h @@ -565,6 +565,7 @@ struct _ec { gf_boolean_t optimistic_changelog; uint32_t background_heals; uint32_t heal_wait_qlen; + uint32_t self_heal_window_size; /* max size of read/writes */ struct list_head pending_fops; struct list_head heal_waiting; struct list_head healing; diff --git a/xlators/cluster/ec/src/ec.c b/xlators/cluster/ec/src/ec.c index d61ff1bf36a..e628183190e 100644 --- a/xlators/cluster/ec/src/ec.c +++ b/xlators/cluster/ec/src/ec.c @@ -280,6 +280,8 @@ reconfigure (xlator_t *this, dict_t *options) uint32, failed); GF_OPTION_RECONF ("heal-wait-qlength", heal_wait_qlen, options, uint32, failed); + GF_OPTION_RECONF ("self-heal-window-size", ec->self_heal_window_size, + options, uint32, failed); GF_OPTION_RECONF ("heal-timeout", ec->shd.timeout, options, int32, failed); ec_configure_background_heal_opts (ec, background_heals, @@ -663,6 +665,8 @@ init (xlator_t *this) GF_OPTION_INIT ("eager-lock", ec->eager_lock, bool, failed); GF_OPTION_INIT ("background-heals", ec->background_heals, uint32, failed); GF_OPTION_INIT ("heal-wait-qlength", ec->heal_wait_qlen, uint32, failed); + GF_OPTION_INIT ("self-heal-window-size", ec->self_heal_window_size, uint32, + failed); ec_configure_background_heal_opts (ec, ec->background_heals, ec->heal_wait_qlen); GF_OPTION_INIT ("read-policy", read_policy, str, failed); @@ -1303,6 +1307,8 @@ int32_t ec_dump_private(xlator_t *this) ec_bin(tmp, sizeof(tmp), ec->xl_up, ec->nodes)); gf_proc_dump_write("background-heals", "%d", ec->background_heals); gf_proc_dump_write("heal-wait-qlength", "%d", ec->heal_wait_qlen); + gf_proc_dump_write("self-heal-window-size", "%"PRIu32, + ec->self_heal_window_size); gf_proc_dump_write("healers", "%d", ec->healers); gf_proc_dump_write("heal-waiters", "%d", ec->heal_waiters); gf_proc_dump_write("read-policy", "%s", ec_read_policies[ec->read_policy]); @@ -1466,6 +1472,14 @@ struct volume_options options[] = .description = "force the cpu extensions to be used to accelerate the " "galois field computations." }, + { .key = {"self-heal-window-size"}, + .type = GF_OPTION_TYPE_INT, + .min = 1, + .max = 1024, + .default_value = "1", + .description = "Maximum number blocks(128KB) per file for which " + "self-heal process would be applied simultaneously." + }, { .key = {"optimistic-change-log"}, .type = GF_OPTION_TYPE_BOOL, .default_value = "on", diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c index d8005fd8d96..08557d1bd86 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c @@ -3212,6 +3212,11 @@ struct volopt_map_entry glusterd_volopt_map[] = { .op_version = GD_OP_VERSION_3_9_0, .flags = OPT_FLAG_CLIENT_OPT }, + { .key = "disperse.self-heal-window-size", + .voltype = "cluster/disperse", + .op_version = GD_OP_VERSION_3_11_0, + .flags = OPT_FLAG_CLIENT_OPT + }, { .key = "cluster.use-compound-fops", .voltype = "cluster/replicate", .value = "off", -- cgit