diff options
author | Ravishankar N <ravishankar@redhat.com> | 2018-03-22 17:55:15 +0530 |
---|---|---|
committer | Ravishankar N <ravishankar@redhat.com> | 2018-03-29 13:07:04 +0530 |
commit | c87bd439ef12adc70dc580e75304121c3cd38e9a (patch) | |
tree | 725e6038e2c821fb1ddf9c3ce0f75ee6a399ec42 /xlators/cluster/afr/src/afr.c | |
parent | 89577d8b0ad7bd1ee2cec2f0e047591b1cd0f7b8 (diff) |
afr: add new value for read-hash-mode volume option
Updates: #363
This new value (3) will try to wind read requests to the child of AFR
having the least amount of pending requests in its queue.
Change-Id: If6bda2aac9bf7aec3fc39622f78659313c4b6508
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr.c')
-rw-r--r-- | xlators/cluster/afr/src/afr.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c index cfba5d5d3c9..22ce0a35ece 100644 --- a/xlators/cluster/afr/src/afr.c +++ b/xlators/cluster/afr/src/afr.c @@ -429,6 +429,9 @@ init (xlator_t *this) } GF_OPTION_INIT ("choose-local", priv->choose_local, bool, out); + priv->pending_reads = GF_CALLOC (sizeof(*priv->pending_reads), + priv->child_count, gf_afr_mt_atomic_t); + GF_OPTION_INIT ("read-hash-mode", priv->hash_mode, uint32, out); priv->favorite_child = -1; @@ -703,18 +706,19 @@ struct volume_options options[] = { { .key = {"read-hash-mode" }, .type = GF_OPTION_TYPE_INT, .min = 0, - .max = 2, + .max = 3, .default_value = "1", .op_version = {2}, .flags = OPT_FLAG_CLIENT_OPT | OPT_FLAG_SETTABLE | OPT_FLAG_DOC, .tags = {"replicate"}, .description = "inode-read fops happen only on one of the bricks in " "replicate. AFR will prefer the one computed using " - "the method specified using this option" - "0 = first up server, " + "the method specified using this option.\n" + "0 = first readable child of AFR, starting from 1st child.\n" "1 = hash by GFID of file (all clients use " - "same subvolume), " - "2 = hash by GFID of file and client PID", + "same subvolume).\n" + "2 = hash by GFID of file and client PID.\n" + "3 = brick having the least outstanding read requests." }, { .key = {"choose-local" }, .type = GF_OPTION_TYPE_BOOL, |