74096c
From 866a4c49ad9c5a9125814a9f843d4c7fd967ab2b Mon Sep 17 00:00:00 2001
74096c
From: Kotresh HR <khiremat@redhat.com>
74096c
Date: Mon, 3 Feb 2020 18:10:17 +0530
74096c
Subject: [PATCH 446/449] bitrot: Make number of signer threads configurable
74096c
74096c
The number of signing process threads (glfs_brpobj)
74096c
is set to 4 by default. The recommendation is to set
74096c
it to number of cores available. This patch makes it
74096c
configurable as follows
74096c
74096c
gluster vol bitrot <volname> signer-threads <count>
74096c
74096c
> fixes: bz#1797869
74096c
> Change-Id: Ia883b3e5e34e0bc8d095243508d320c9c9c58adc
74096c
> Signed-off-by: Kotresh HR <khiremat@redhat.com>
74096c
> (Cherry pick from commit 8fad76650bd85463708f59d2518f5b764ae4c702)
74096c
> (Reviewed on upstream link https://review.gluster.org/#/c/glusterfs/+/24091/)
74096c
74096c
BUG: 1790336
74096c
Change-Id: Ia883b3e5e34e0bc8d095243508d320c9c9c58adc
74096c
Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
74096c
Reviewed-on: https://code.engineering.redhat.com/gerrit/202780
74096c
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
74096c
---
74096c
 cli/src/cli-cmd-parser.c                           | 29 +++++++-
74096c
 cli/src/cli-cmd-volume.c                           | 12 +++
74096c
 doc/gluster.8                                      |  6 ++
74096c
 libglusterfs/src/glusterfs/common-utils.h          |  1 +
74096c
 rpc/xdr/src/cli1-xdr.x                             |  1 +
74096c
 tests/bitrot/br-signer-threads-config-1797869.t    | 73 +++++++++++++++++++
74096c
 xlators/features/bit-rot/src/bitd/bit-rot.c        | 45 +++++++++---
74096c
 xlators/features/bit-rot/src/bitd/bit-rot.h        | 20 ++---
74096c
 .../bit-rot/src/stub/bit-rot-stub-mem-types.h      |  1 +
74096c
 xlators/mgmt/glusterd/src/glusterd-bitrot.c        | 85 ++++++++++++++++++++++
74096c
 xlators/mgmt/glusterd/src/glusterd-volgen.c        | 16 ++--
74096c
 xlators/mgmt/glusterd/src/glusterd-volume-set.c    |  9 +++
74096c
 12 files changed, 270 insertions(+), 28 deletions(-)
74096c
 create mode 100644 tests/bitrot/br-signer-threads-config-1797869.t
74096c
74096c
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
74096c
index 7446b95..5fd05f4 100644
74096c
--- a/cli/src/cli-cmd-parser.c
74096c
+++ b/cli/src/cli-cmd-parser.c
74096c
@@ -5661,7 +5661,7 @@ cli_cmd_bitrot_parse(const char **words, int wordcount, dict_t **options)
74096c
     char *volname = NULL;
74096c
     char *opwords[] = {
74096c
         "enable",       "disable", "scrub-throttle", "scrub-frequency", "scrub",
74096c
-        "signing-time", NULL};
74096c
+        "signing-time", "signer-threads", NULL};
74096c
     char *scrub_throt_values[] = {"lazy", "normal", "aggressive", NULL};
74096c
     char *scrub_freq_values[] = {"hourly",  "daily",  "weekly", "biweekly",
74096c
                                  "monthly", "minute", NULL};
74096c
@@ -5669,6 +5669,7 @@ cli_cmd_bitrot_parse(const char **words, int wordcount, dict_t **options)
74096c
     dict_t *dict = NULL;
74096c
     gf_bitrot_type type = GF_BITROT_OPTION_TYPE_NONE;
74096c
     int32_t expiry_time = 0;
74096c
+    int32_t signer_th_count = 0;
74096c
 
74096c
     GF_ASSERT(words);
74096c
     GF_ASSERT(options);
74096c
@@ -5849,6 +5850,31 @@ cli_cmd_bitrot_parse(const char **words, int wordcount, dict_t **options)
74096c
             }
74096c
             goto set_type;
74096c
         }
74096c
+    } else if (!strcmp(words[3], "signer-threads")) {
74096c
+        if (!words[4]) {
74096c
+            cli_err(
74096c
+                "Missing signer-thread value for bitrot "
74096c
+                "option");
74096c
+            ret = -1;
74096c
+            goto out;
74096c
+        } else {
74096c
+            type = GF_BITROT_OPTION_TYPE_SIGNER_THREADS;
74096c
+
74096c
+            signer_th_count = strtol(words[4], NULL, 0);
74096c
+            if (signer_th_count < 1) {
74096c
+                cli_err("signer-thread count should not be less than 1");
74096c
+                ret = -1;
74096c
+                goto out;
74096c
+            }
74096c
+
74096c
+            ret = dict_set_uint32(dict, "signer-threads",
74096c
+                                  (unsigned int)signer_th_count);
74096c
+            if (ret) {
74096c
+                cli_out("Failed to set dict for bitrot");
74096c
+                goto out;
74096c
+            }
74096c
+            goto set_type;
74096c
+        }
74096c
     } else {
74096c
         cli_err(
74096c
             "Invalid option %s for bitrot. Please enter valid "
74096c
@@ -5857,7 +5883,6 @@ cli_cmd_bitrot_parse(const char **words, int wordcount, dict_t **options)
74096c
         ret = -1;
74096c
         goto out;
74096c
     }
74096c
-
74096c
 set_type:
74096c
     ret = dict_set_int32(dict, "type", type);
74096c
     if (ret < 0)
74096c
diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c
74096c
index f33fc99..72504ca 100644
74096c
--- a/cli/src/cli-cmd-volume.c
74096c
+++ b/cli/src/cli-cmd-volume.c
74096c
@@ -3236,6 +3236,16 @@ struct cli_cmd bitrot_cmds[] = {
74096c
     {"volume bitrot <VOLNAME> {enable|disable}", NULL, /*cli_cmd_bitrot_cbk,*/
74096c
      "Enable/disable bitrot for volume <VOLNAME>"},
74096c
 
74096c
+    {"volume bitrot <VOLNAME> signing-time <time-in-secs>",
74096c
+     NULL, /*cli_cmd_bitrot_cbk,*/
74096c
+     "Waiting time for an object after last fd is closed to start signing "
74096c
+     "process"},
74096c
+
74096c
+    {"volume bitrot <VOLNAME> signer-threads <count>",
74096c
+     NULL, /*cli_cmd_bitrot_cbk,*/
74096c
+     "Number of signing process threads. Usually set to number of available "
74096c
+     "cores"},
74096c
+
74096c
     {"volume bitrot <VOLNAME> scrub-throttle {lazy|normal|aggressive}",
74096c
      NULL, /*cli_cmd_bitrot_cbk,*/
74096c
      "Set the speed of the scrubber for volume <VOLNAME>"},
74096c
@@ -3251,6 +3261,8 @@ struct cli_cmd bitrot_cmds[] = {
74096c
      "the scrubber. ondemand starts the scrubber immediately."},
74096c
 
74096c
     {"volume bitrot <VOLNAME> {enable|disable}\n"
74096c
+     "volume bitrot <VOLNAME> signing-time <time-in-secs>\n"
74096c
+     "volume bitrot <VOLNAME> signer-threads <count>\n"
74096c
      "volume bitrot <volname> scrub-throttle {lazy|normal|aggressive}\n"
74096c
      "volume bitrot <volname> scrub-frequency {hourly|daily|weekly|biweekly"
74096c
      "|monthly}\n"
74096c
diff --git a/doc/gluster.8 b/doc/gluster.8
74096c
index 66bdb48..084346d 100644
74096c
--- a/doc/gluster.8
74096c
+++ b/doc/gluster.8
74096c
@@ -244,6 +244,12 @@ Use "!<OPTION>" to reset option <OPTION> to default value.
74096c
 \fB\ volume bitrot <VOLNAME> {enable|disable} \fR
74096c
 Enable/disable bitrot for volume <VOLNAME>
74096c
 .TP
74096c
+\fB\ volume bitrot <VOLNAME> signing-time <time-in-secs> \fR
74096c
+Waiting time for an object after last fd is closed to start signing process.
74096c
+.TP
74096c
+\fB\ volume bitrot <VOLNAME> signer-threads <count> \fR
74096c
+Number of signing process threads. Usually set to number of available cores.
74096c
+.TP
74096c
 \fB\ volume bitrot <VOLNAME> scrub-throttle {lazy|normal|aggressive} \fR
74096c
 Scrub-throttle value is a measure of how fast or slow the scrubber scrubs the filesystem for volume <VOLNAME>
74096c
 .TP
74096c
diff --git a/libglusterfs/src/glusterfs/common-utils.h b/libglusterfs/src/glusterfs/common-utils.h
74096c
index 0e2ecc7..f0a0a41 100644
74096c
--- a/libglusterfs/src/glusterfs/common-utils.h
74096c
+++ b/libglusterfs/src/glusterfs/common-utils.h
74096c
@@ -126,6 +126,7 @@ trap(void);
74096c
 
74096c
 /* Default value of signing waiting time to sign a file for bitrot */
74096c
 #define SIGNING_TIMEOUT "120"
74096c
+#define BR_WORKERS "4"
74096c
 
74096c
 /* xxhash */
74096c
 #define GF_XXH64_DIGEST_LENGTH 8
74096c
diff --git a/rpc/xdr/src/cli1-xdr.x b/rpc/xdr/src/cli1-xdr.x
74096c
index a32c864..777cb00 100644
74096c
--- a/rpc/xdr/src/cli1-xdr.x
74096c
+++ b/rpc/xdr/src/cli1-xdr.x
74096c
@@ -68,6 +68,7 @@ enum gf_bitrot_type {
74096c
         GF_BITROT_OPTION_TYPE_EXPIRY_TIME,
74096c
         GF_BITROT_CMD_SCRUB_STATUS,
74096c
         GF_BITROT_CMD_SCRUB_ONDEMAND,
74096c
+        GF_BITROT_OPTION_TYPE_SIGNER_THREADS,
74096c
         GF_BITROT_OPTION_TYPE_MAX
74096c
 };
74096c
 
74096c
diff --git a/tests/bitrot/br-signer-threads-config-1797869.t b/tests/bitrot/br-signer-threads-config-1797869.t
74096c
new file mode 100644
74096c
index 0000000..657ef3e
74096c
--- /dev/null
74096c
+++ b/tests/bitrot/br-signer-threads-config-1797869.t
74096c
@@ -0,0 +1,73 @@
74096c
+#!/bin/bash
74096c
+
74096c
+. $(dirname $0)/../include.rc
74096c
+. $(dirname $0)/../volume.rc
74096c
+. $(dirname $0)/../cluster.rc
74096c
+
74096c
+function get_bitd_count_1 {
74096c
+        ps auxww | grep glusterfs | grep bitd.pid | grep -v grep | grep $H1 | wc -l
74096c
+}
74096c
+
74096c
+function get_bitd_count_2 {
74096c
+        ps auxww | grep glusterfs | grep bitd.pid | grep -v grep | grep $H2 | wc -l
74096c
+}
74096c
+
74096c
+function get_bitd_pid_1 {
74096c
+        ps auxww | grep glusterfs | grep bitd.pid | grep -v grep | grep $H1 | awk '{print $2}'
74096c
+}
74096c
+
74096c
+function get_bitd_pid_2 {
74096c
+        ps auxww | grep glusterfs | grep bitd.pid | grep -v grep | grep $H2 | awk '{print $2}'
74096c
+}
74096c
+
74096c
+function get_signer_th_count_1 {
74096c
+        ps -eL | grep $(get_bitd_pid_1) | grep glfs_brpobj | wc -l
74096c
+}
74096c
+
74096c
+function get_signer_th_count_2 {
74096c
+        ps -eL | grep $(get_bitd_pid_2) | grep glfs_brpobj | wc -l
74096c
+}
74096c
+
74096c
+cleanup;
74096c
+
74096c
+TEST launch_cluster 2
74096c
+
74096c
+TEST $CLI_1 peer probe $H2;
74096c
+EXPECT_WITHIN $PROBE_TIMEOUT 1 peer_count;
74096c
+
74096c
+TEST $CLI_1 volume create $V0 $H1:$B1
74096c
+TEST $CLI_1 volume create $V1 $H2:$B2
74096c
+EXPECT 'Created' volinfo_field_1 $V0 'Status';
74096c
+EXPECT 'Created' volinfo_field_1 $V1 'Status';
74096c
+
74096c
+TEST $CLI_1 volume start $V0
74096c
+TEST $CLI_1 volume start $V1
74096c
+EXPECT 'Started' volinfo_field_1 $V0 'Status';
74096c
+EXPECT 'Started' volinfo_field_1 $V1 'Status';
74096c
+
74096c
+#Enable bitrot
74096c
+TEST $CLI_1 volume bitrot $V0 enable
74096c
+TEST $CLI_1 volume bitrot $V1 enable
74096c
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" get_bitd_count_1
74096c
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" get_bitd_count_2
74096c
+
74096c
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "4" get_signer_th_count_1
74096c
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "4" get_signer_th_count_2
74096c
+
74096c
+old_bitd_pid_1=$(get_bitd_pid_1)
74096c
+old_bitd_pid_2=$(get_bitd_pid_2)
74096c
+TEST $CLI_1 volume bitrot $V0 signer-threads 1
74096c
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" get_signer_th_count_1
74096c
+EXPECT_NOT "$old_bitd_pid_1" get_bitd_pid_1;
74096c
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "4" get_signer_th_count_2
74096c
+EXPECT "$old_bitd_pid_2" get_bitd_pid_2;
74096c
+
74096c
+old_bitd_pid_1=$(get_bitd_pid_1)
74096c
+old_bitd_pid_2=$(get_bitd_pid_2)
74096c
+TEST $CLI_1 volume bitrot $V1 signer-threads 2
74096c
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "2" get_signer_th_count_2
74096c
+EXPECT_NOT "$old_bitd_pid_2" get_bitd_pid_2;
74096c
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" get_signer_th_count_1
74096c
+EXPECT "$old_bitd_pid_1" get_bitd_pid_1;
74096c
+
74096c
+cleanup;
74096c
diff --git a/xlators/features/bit-rot/src/bitd/bit-rot.c b/xlators/features/bit-rot/src/bitd/bit-rot.c
74096c
index 7b1c5dc..b8feef7 100644
74096c
--- a/xlators/features/bit-rot/src/bitd/bit-rot.c
74096c
+++ b/xlators/features/bit-rot/src/bitd/bit-rot.c
74096c
@@ -1734,22 +1734,26 @@ out:
74096c
     return 0;
74096c
 }
74096c
 
74096c
-/**
74096c
- * Initialize signer specific structures, spawn worker threads.
74096c
- */
74096c
-
74096c
 static void
74096c
 br_fini_signer(xlator_t *this, br_private_t *priv)
74096c
 {
74096c
     int i = 0;
74096c
 
74096c
-    for (; i < BR_WORKERS; i++) {
74096c
+    if (priv == NULL)
74096c
+        return;
74096c
+
74096c
+    for (; i < priv->signer_th_count; i++) {
74096c
         (void)gf_thread_cleanup_xint(priv->obj_queue->workers[i]);
74096c
     }
74096c
+    GF_FREE(priv->obj_queue->workers);
74096c
 
74096c
     pthread_cond_destroy(&priv->object_cond);
74096c
 }
74096c
 
74096c
+/**
74096c
+ * Initialize signer specific structures, spawn worker threads.
74096c
+ */
74096c
+
74096c
 static int32_t
74096c
 br_init_signer(xlator_t *this, br_private_t *priv)
74096c
 {
74096c
@@ -1769,7 +1773,12 @@ br_init_signer(xlator_t *this, br_private_t *priv)
74096c
         goto cleanup_cond;
74096c
     INIT_LIST_HEAD(&priv->obj_queue->objects);
74096c
 
74096c
-    for (i = 0; i < BR_WORKERS; i++) {
74096c
+    priv->obj_queue->workers = GF_CALLOC(
74096c
+        priv->signer_th_count, sizeof(pthread_t), gf_br_mt_br_worker_t);
74096c
+    if (!priv->obj_queue->workers)
74096c
+        goto cleanup_obj_queue;
74096c
+
74096c
+    for (i = 0; i < priv->signer_th_count; i++) {
74096c
         ret = gf_thread_create(&priv->obj_queue->workers[i], NULL,
74096c
                                br_process_object, this, "brpobj");
74096c
         if (ret != 0) {
74096c
@@ -1787,7 +1796,9 @@ cleanup_threads:
74096c
     for (i--; i >= 0; i--) {
74096c
         (void)gf_thread_cleanup_xint(priv->obj_queue->workers[i]);
74096c
     }
74096c
+    GF_FREE(priv->obj_queue->workers);
74096c
 
74096c
+cleanup_obj_queue:
74096c
     GF_FREE(priv->obj_queue);
74096c
 
74096c
 cleanup_cond:
74096c
@@ -1840,7 +1851,7 @@ br_rate_limit_signer(xlator_t *this, int child_count, int numbricks)
74096c
     if (contribution == 0)
74096c
         contribution = 1;
74096c
     spec.rate = BR_HASH_CALC_READ_SIZE * contribution;
74096c
-    spec.maxlimit = BR_WORKERS * BR_HASH_CALC_READ_SIZE;
74096c
+    spec.maxlimit = priv->signer_th_count * BR_HASH_CALC_READ_SIZE;
74096c
 
74096c
 #endif
74096c
 
74096c
@@ -1860,11 +1871,16 @@ br_rate_limit_signer(xlator_t *this, int child_count, int numbricks)
74096c
 static int32_t
74096c
 br_signer_handle_options(xlator_t *this, br_private_t *priv, dict_t *options)
74096c
 {
74096c
-    if (options)
74096c
+    if (options) {
74096c
         GF_OPTION_RECONF("expiry-time", priv->expiry_time, options, uint32,
74096c
                          error_return);
74096c
-    else
74096c
+        GF_OPTION_RECONF("signer-threads", priv->signer_th_count, options,
74096c
+                         uint32, error_return);
74096c
+    } else {
74096c
         GF_OPTION_INIT("expiry-time", priv->expiry_time, uint32, error_return);
74096c
+        GF_OPTION_INIT("signer-threads", priv->signer_th_count, uint32,
74096c
+                       error_return);
74096c
+    }
74096c
 
74096c
     return 0;
74096c
 
74096c
@@ -1880,6 +1896,8 @@ br_signer_init(xlator_t *this, br_private_t *priv)
74096c
 
74096c
     GF_OPTION_INIT("expiry-time", priv->expiry_time, uint32, error_return);
74096c
     GF_OPTION_INIT("brick-count", numbricks, int32, error_return);
74096c
+    GF_OPTION_INIT("signer-threads", priv->signer_th_count, uint32,
74096c
+                   error_return);
74096c
 
74096c
     ret = br_rate_limit_signer(this, priv->child_count, numbricks);
74096c
     if (ret)
74096c
@@ -2210,6 +2228,15 @@ struct volume_options options[] = {
74096c
         .description = "Pause/Resume scrub. Upon resume, scrubber "
74096c
                        "continues from where it left off.",
74096c
     },
74096c
+    {
74096c
+        .key = {"signer-threads"},
74096c
+        .type = GF_OPTION_TYPE_INT,
74096c
+        .default_value = BR_WORKERS,
74096c
+        .op_version = {GD_OP_VERSION_7_0},
74096c
+        .flags = OPT_FLAG_SETTABLE,
74096c
+        .description = "Number of signing process threads. As a best "
74096c
+                       "practice, set this to the number of processor cores",
74096c
+    },
74096c
     {.key = {NULL}},
74096c
 };
74096c
 
74096c
diff --git a/xlators/features/bit-rot/src/bitd/bit-rot.h b/xlators/features/bit-rot/src/bitd/bit-rot.h
74096c
index a4d4fd7..8ac7dcd 100644
74096c
--- a/xlators/features/bit-rot/src/bitd/bit-rot.h
74096c
+++ b/xlators/features/bit-rot/src/bitd/bit-rot.h
74096c
@@ -30,12 +30,6 @@
74096c
 
74096c
 #include <openssl/sha.h>
74096c
 
74096c
-/**
74096c
- * TODO: make this configurable. As a best practice, set this to the
74096c
- * number of processor cores.
74096c
- */
74096c
-#define BR_WORKERS 4
74096c
-
74096c
 typedef enum scrub_throttle {
74096c
     BR_SCRUB_THROTTLE_VOID = -1,
74096c
     BR_SCRUB_THROTTLE_LAZY = 0,
74096c
@@ -108,12 +102,12 @@ struct br_child {
74096c
 typedef struct br_child br_child_t;
74096c
 
74096c
 struct br_obj_n_workers {
74096c
-    struct list_head objects;      /* queue of objects expired from the
74096c
-                                      timer wheel and ready to be picked
74096c
-                                      up for signing */
74096c
-    pthread_t workers[BR_WORKERS]; /* Threads which pick up the objects
74096c
-                                      from the above queue and start
74096c
-                                      signing each object */
74096c
+    struct list_head objects; /* queue of objects expired from the
74096c
+                                 timer wheel and ready to be picked
74096c
+                                 up for signing */
74096c
+    pthread_t *workers;       /* Threads which pick up the objects
74096c
+                                 from the above queue and start
74096c
+                                 signing each object */
74096c
 };
74096c
 
74096c
 struct br_scrubber {
74096c
@@ -209,6 +203,8 @@ struct br_private {
74096c
 
74096c
     uint32_t expiry_time; /* objects "wait" time */
74096c
 
74096c
+    uint32_t signer_th_count; /* Number of signing process threads */
74096c
+
74096c
     tbf_t *tbf; /* token bucket filter */
74096c
 
74096c
     gf_boolean_t iamscrubber; /* function as a fs scrubber */
74096c
diff --git a/xlators/features/bit-rot/src/stub/bit-rot-stub-mem-types.h b/xlators/features/bit-rot/src/stub/bit-rot-stub-mem-types.h
74096c
index 40bcda1..9d93caf 100644
74096c
--- a/xlators/features/bit-rot/src/stub/bit-rot-stub-mem-types.h
74096c
+++ b/xlators/features/bit-rot/src/stub/bit-rot-stub-mem-types.h
74096c
@@ -29,6 +29,7 @@ enum br_mem_types {
74096c
     gf_br_stub_mt_sigstub_t,
74096c
     gf_br_mt_br_child_event_t,
74096c
     gf_br_stub_mt_misc,
74096c
+    gf_br_mt_br_worker_t,
74096c
     gf_br_stub_mt_end,
74096c
 };
74096c
 
74096c
diff --git a/xlators/mgmt/glusterd/src/glusterd-bitrot.c b/xlators/mgmt/glusterd/src/glusterd-bitrot.c
74096c
index c653249..f79af2d 100644
74096c
--- a/xlators/mgmt/glusterd/src/glusterd-bitrot.c
74096c
+++ b/xlators/mgmt/glusterd/src/glusterd-bitrot.c
74096c
@@ -34,6 +34,7 @@ const char *gd_bitrot_op_list[GF_BITROT_OPTION_TYPE_MAX] = {
74096c
     [GF_BITROT_OPTION_TYPE_SCRUB_FREQ] = "scrub-frequency",
74096c
     [GF_BITROT_OPTION_TYPE_SCRUB] = "scrub",
74096c
     [GF_BITROT_OPTION_TYPE_EXPIRY_TIME] = "expiry-time",
74096c
+    [GF_BITROT_OPTION_TYPE_SIGNER_THREADS] = "signer-threads",
74096c
 };
74096c
 
74096c
 int
74096c
@@ -354,6 +355,81 @@ out:
74096c
     return ret;
74096c
 }
74096c
 
74096c
+static gf_boolean_t
74096c
+is_bitd_configure_noop(xlator_t *this, glusterd_volinfo_t *volinfo)
74096c
+{
74096c
+    gf_boolean_t noop = _gf_true;
74096c
+    glusterd_brickinfo_t *brickinfo = NULL;
74096c
+
74096c
+    if (!glusterd_is_bitrot_enabled(volinfo))
74096c
+        goto out;
74096c
+    else if (volinfo->status != GLUSTERD_STATUS_STARTED)
74096c
+        goto out;
74096c
+    else {
74096c
+        cds_list_for_each_entry(brickinfo, &volinfo->bricks, brick_list)
74096c
+        {
74096c
+            if (!glusterd_is_local_brick(this, volinfo, brickinfo))
74096c
+                continue;
74096c
+            noop = _gf_false;
74096c
+            return noop;
74096c
+        }
74096c
+    }
74096c
+out:
74096c
+    return noop;
74096c
+}
74096c
+
74096c
+static int
74096c
+glusterd_bitrot_signer_threads(glusterd_volinfo_t *volinfo, dict_t *dict,
74096c
+                               char *key, char **op_errstr)
74096c
+{
74096c
+    int32_t ret = -1;
74096c
+    uint32_t signer_th_count = 0;
74096c
+    uint32_t existing_th_count = 0;
74096c
+    xlator_t *this = NULL;
74096c
+    glusterd_conf_t *priv = NULL;
74096c
+    char dkey[32] = {
74096c
+        0,
74096c
+    };
74096c
+
74096c
+    this = THIS;
74096c
+    GF_ASSERT(this);
74096c
+
74096c
+    priv = this->private;
74096c
+    GF_VALIDATE_OR_GOTO(this->name, priv, out);
74096c
+
74096c
+    ret = dict_get_uint32(dict, "signer-threads", &signer_th_count);
74096c
+    if (ret) {
74096c
+        gf_msg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_GET_FAILED,
74096c
+               "Unable to get bitrot signer thread count.");
74096c
+        goto out;
74096c
+    }
74096c
+
74096c
+    ret = dict_get_uint32(volinfo->dict, key, &existing_th_count);
74096c
+    if (ret == 0 && signer_th_count == existing_th_count) {
74096c
+        goto out;
74096c
+    }
74096c
+
74096c
+    snprintf(dkey, sizeof(dkey), "%d", signer_th_count);
74096c
+    ret = dict_set_dynstr_with_alloc(volinfo->dict, key, dkey);
74096c
+    if (ret) {
74096c
+        gf_msg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
74096c
+               "Failed to set option %s", key);
74096c
+        goto out;
74096c
+    }
74096c
+
74096c
+    if (!is_bitd_configure_noop(this, volinfo)) {
74096c
+        ret = priv->bitd_svc.manager(&(priv->bitd_svc), NULL,
74096c
+                                     PROC_START_NO_WAIT);
74096c
+        if (ret) {
74096c
+            gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_BITDSVC_RECONF_FAIL,
74096c
+                   "Failed to reconfigure bitrot services");
74096c
+            goto out;
74096c
+        }
74096c
+    }
74096c
+out:
74096c
+    return ret;
74096c
+}
74096c
+
74096c
 static int
74096c
 glusterd_bitrot_enable(glusterd_volinfo_t *volinfo, char **op_errstr)
74096c
 {
74096c
@@ -594,6 +670,15 @@ glusterd_op_bitrot(dict_t *dict, char **op_errstr, dict_t *rsp_dict)
74096c
                 volinfo, dict, "features.expiry-time", op_errstr);
74096c
             if (ret)
74096c
                 goto out;
74096c
+            break;
74096c
+
74096c
+        case GF_BITROT_OPTION_TYPE_SIGNER_THREADS:
74096c
+            ret = glusterd_bitrot_signer_threads(
74096c
+                volinfo, dict, "features.signer-threads", op_errstr);
74096c
+            if (ret)
74096c
+                goto out;
74096c
+            break;
74096c
+
74096c
         case GF_BITROT_CMD_SCRUB_STATUS:
74096c
         case GF_BITROT_CMD_SCRUB_ONDEMAND:
74096c
             break;
74096c
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
74096c
index 13f84ea..094a71f 100644
74096c
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
74096c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
74096c
@@ -4658,6 +4658,12 @@ bitrot_option_handler(volgen_graph_t *graph, struct volopt_map_entry *vme,
74096c
             return -1;
74096c
     }
74096c
 
74096c
+    if (!strcmp(vme->option, "signer-threads")) {
74096c
+        ret = xlator_set_fixed_option(xl, "signer-threads", vme->value);
74096c
+        if (ret)
74096c
+            return -1;
74096c
+    }
74096c
+
74096c
     return ret;
74096c
 }
74096c
 
74096c
@@ -4940,18 +4946,18 @@ glusterd_prepare_shd_volume_options_for_tier(glusterd_volinfo_t *volinfo,
74096c
                                              dict_t *set_dict)
74096c
 {
74096c
     int ret = -1;
74096c
-    char           *key             = NULL;
74096c
+    char *key = NULL;
74096c
 
74096c
-    key = volgen_get_shd_key (volinfo->tier_info.cold_type);
74096c
+    key = volgen_get_shd_key(volinfo->tier_info.cold_type);
74096c
     if (key) {
74096c
-        ret = dict_set_str (set_dict, key, "enable");
74096c
+        ret = dict_set_str(set_dict, key, "enable");
74096c
         if (ret)
74096c
             goto out;
74096c
     }
74096c
 
74096c
-    key = volgen_get_shd_key (volinfo->tier_info.hot_type);
74096c
+    key = volgen_get_shd_key(volinfo->tier_info.hot_type);
74096c
     if (key) {
74096c
-        ret = dict_set_str (set_dict, key, "enable");
74096c
+        ret = dict_set_str(set_dict, key, "enable");
74096c
         if (ret)
74096c
             goto out;
74096c
     }
74096c
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
74096c
index 9001b88..62acadf 100644
74096c
--- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c
74096c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
74096c
@@ -3379,6 +3379,15 @@ struct volopt_map_entry glusterd_volopt_map[] = {
74096c
         .op_version = GD_OP_VERSION_3_7_0,
74096c
         .type = NO_DOC,
74096c
     },
74096c
+    {
74096c
+        .key = "features.signer-threads",
74096c
+        .voltype = "features/bit-rot",
74096c
+        .value = BR_WORKERS,
74096c
+        .option = "signer-threads",
74096c
+        .op_version = GD_OP_VERSION_7_0,
74096c
+        .type = NO_DOC,
74096c
+    },
74096c
+    /* Upcall translator options */
74096c
     /* Upcall translator options */
74096c
     {
74096c
         .key = "features.cache-invalidation",
74096c
-- 
74096c
1.8.3.1
74096c