glusterfs icon indicating copy to clipboard operation
glusterfs copied to clipboard

xlators: use range info option flag for even more options

Open dmantipov opened this issue 3 years ago • 3 comments

Use OPT_FLAG_RANGE for even more options here and there, adjust related option descriptions and comments as well.

Signed-off-by: Dmitry Antipov [email protected] Updates: #1000

dmantipov avatar Sep 17 '21 08:09 dmantipov

CLANG-FORMAT FAILURE: Before merging the patch, this diff needs to be considered for passing clang-format

index 542e26c54..29bf14c39 100644
--- a/xlators/features/shard/src/shard.c
+++ b/xlators/features/shard/src/shard.c
@@ -7655,48 +7655,42 @@ struct volume_options options[] = {
         .op_version = {GD_OP_VERSION_6_0},
         .flags = OPT_FLAG_SETTABLE,
     },
-    {
-        .key = {"shard-block-size"},
-        .type = GF_OPTION_TYPE_SIZET,
-        .op_version = {GD_OP_VERSION_3_7_0},
-        .flags = OPT_FLAG_SETTABLE | OPT_FLAG_CLIENT_OPT | OPT_FLAG_DOC |
-                 OPT_FLAG_RANGE,
-        .tags = {"shard"},
-        .default_value = "64MB",
-        .min = SHARD_MIN_BLOCK_SIZE,
-        .max = SHARD_MAX_BLOCK_SIZE,
-        .description = "The size unit used to break a file into multiple "
-                       "chunks."
-    },
-    {
-        .key = {"shard-deletion-rate"},
-        .type = GF_OPTION_TYPE_INT,
-        .op_version = {GD_OP_VERSION_5_0},
-        .flags = OPT_FLAG_SETTABLE | OPT_FLAG_CLIENT_OPT | OPT_FLAG_DOC |
-                 OPT_FLAG_RANGE,
-        .tags = {"shard"},
-        .default_value = "100",
-        .min = 100,
-        .max = INT_MAX,
-        .description = "The number of shards to send deletes on at a time."
-    },
-    {
-        .key = {"shard-lru-limit"},
-        .type = GF_OPTION_TYPE_INT,
-        .op_version = {GD_OP_VERSION_5_0},
-        .flags = OPT_FLAG_SETTABLE | OPT_FLAG_CLIENT_OPT | OPT_FLAG_RANGE,
-        .tags = {"shard"},
-        .default_value = "16384",
-        .min = 20,
-        .max = INT_MAX,
-        .description = "The number of resolved shard inodes to keep in "
-                       "memory. A higher number means shards that are "
-                       "resolved will remain in memory longer, avoiding "
-                       "frequent lookups on them when they participate in "
-                       "file operations. The option also has a bearing on "
-                       "amount of memory consumed by these inodes and their "
-                       "internal metadata."
-    },
+    {.key = {"shard-block-size"},
+     .type = GF_OPTION_TYPE_SIZET,
+     .op_version = {GD_OP_VERSION_3_7_0},
+     .flags = OPT_FLAG_SETTABLE | OPT_FLAG_CLIENT_OPT | OPT_FLAG_DOC |
+              OPT_FLAG_RANGE,
+     .tags = {"shard"},
+     .default_value = "64MB",
+     .min = SHARD_MIN_BLOCK_SIZE,
+     .max = SHARD_MAX_BLOCK_SIZE,
+     .description = "The size unit used to break a file into multiple "
+                    "chunks."},
+    {.key = {"shard-deletion-rate"},
+     .type = GF_OPTION_TYPE_INT,
+     .op_version = {GD_OP_VERSION_5_0},
+     .flags = OPT_FLAG_SETTABLE | OPT_FLAG_CLIENT_OPT | OPT_FLAG_DOC |
+              OPT_FLAG_RANGE,
+     .tags = {"shard"},
+     .default_value = "100",
+     .min = 100,
+     .max = INT_MAX,
+     .description = "The number of shards to send deletes on at a time."},
+    {.key = {"shard-lru-limit"},
+     .type = GF_OPTION_TYPE_INT,
+     .op_version = {GD_OP_VERSION_5_0},
+     .flags = OPT_FLAG_SETTABLE | OPT_FLAG_CLIENT_OPT | OPT_FLAG_RANGE,
+     .tags = {"shard"},
+     .default_value = "16384",
+     .min = 20,
+     .max = INT_MAX,
+     .description = "The number of resolved shard inodes to keep in "
+                    "memory. A higher number means shards that are "
+                    "resolved will remain in memory longer, avoiding "
+                    "frequent lookups on them when they participate in "
+                    "file operations. The option also has a bearing on "
+                    "amount of memory consumed by these inodes and their "
+                    "internal metadata."},
     {.key = {NULL}},
 };
 
diff --git a/xlators/performance/io-cache/src/io-cache.c b/xlators/performance/io-cache/src/io-cache.c
index 2656bc66b..97b546a01 100644
--- a/xlators/performance/io-cache/src/io-cache.c
+++ b/xlators/performance/io-cache/src/io-cache.c
@@ -2184,8 +2184,7 @@ struct volume_options options[] = {
                     "re-validation is performed.",
      .op_version = {1},
      .flags = OPT_FLAG_CLIENT_OPT | OPT_FLAG_SETTABLE | OPT_FLAG_DOC |
-              OPT_FLAG_RANGE
-    },
+              OPT_FLAG_RANGE},
     {.key = {"cache-size"},
      .type = GF_OPTION_TYPE_SIZET,
      .min = 4 * GF_UNIT_MB,
diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c
index 3d4420b5d..4ca3fbfcc 100644
--- a/xlators/protocol/client/src/client.c
+++ b/xlators/protocol/client/src/client.c
@@ -2933,8 +2933,7 @@ struct volume_options options[] = {
                     "declared as dead, if the server does not respond for "
                     "a particular (file) operation.",
      .op_version = {1},
-     .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC | OPT_FLAG_RANGE
-    },
+     .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC | OPT_FLAG_RANGE},
     {.key = {"ping-timeout"},
      .type = GF_OPTION_TYPE_TIME,
      .min = 0,
@@ -2943,8 +2942,7 @@ struct volume_options options[] = {
      .description = "Time duration for which the client waits to "
                     "check if the server is responsive.",
      .op_version = {1},
-     .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC | OPT_FLAG_RANGE
-    },
+     .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC | OPT_FLAG_RANGE},
     {.key = {"client-bind-insecure"}, .type = GF_OPTION_TYPE_BOOL},
     {.key = {"tcp-window-size"},
      .type = GF_OPTION_TYPE_SIZET,
@@ -2955,8 +2953,7 @@ struct volume_options options[] = {
                     " for TCP socket. Zero means do not set window size"
                     " explicitly and use default value.",
      .op_version = {1},
-     .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC | OPT_FLAG_RANGE
-    },
+     .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC | OPT_FLAG_RANGE},
     {.key = {"filter-O_DIRECT"},
      .type = GF_OPTION_TYPE_BOOL,
      .default_value = "disable",
diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c
index 948c03453..ae6003abc 100644
--- a/xlators/protocol/server/src/server.c
+++ b/xlators/protocol/server/src/server.c
@@ -1809,8 +1809,7 @@ struct volume_options server_options[] = {
      .description = "Specifies the limit on the number of inodes "
                     "in the lru list of the inode cache.",
      .op_version = {1},
-     .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC | OPT_FLAG_RANGE
-    },
+     .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC | OPT_FLAG_RANGE},
     {.key = {"trace"}, .type = GF_OPTION_TYPE_BOOL},
     {
         .key = {"config-directory", "conf-dir"},
@@ -1847,8 +1846,7 @@ struct volume_options server_options[] = {
      .description = "Value of the uid used for the anonymous "
                     "user/nfsnobody when root-squash/all-squash is enabled.",
      .op_version = {3},
-     .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC | OPT_FLAG_RANGE
-    },
+     .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC | OPT_FLAG_RANGE},
     {.key = {"anongid"},
      .type = GF_OPTION_TYPE_INT,
      .default_value = "65534", /* RPC_NOBODY_GID */
@@ -1857,8 +1855,7 @@ struct volume_options server_options[] = {
      .description = "Value of the gid used for the anonymous "
                     "user/nfsnobody when root-squash/all-squash is enabled.",
      .op_version = {3},
-     .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC | OPT_FLAG_RANGE
-    },
+     .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC | OPT_FLAG_RANGE},
     {.key = {"statedump-path"},
      .type = GF_OPTION_TYPE_PATH,
      .default_value = DEFAULT_VAR_RUN_DIRECTORY,
@@ -1875,8 +1872,7 @@ struct volume_options server_options[] = {
                     " for TCP socket. Zero means do not set window size"
                     " explicitly and use default value.",
      .op_version = {1},
-     .flags = OPT_FLAG_SETTABLE | OPT_FLAG_RANGE
-    },
+     .flags = OPT_FLAG_SETTABLE | OPT_FLAG_RANGE},
 
     /*  The following two options are defined in addr.c, redifined here *
      * for the sake of validation during volume set from cli            */
@@ -1921,8 +1917,7 @@ struct volume_options server_options[] = {
                     "potentially run out of memory).",
      .op_version = {1},
      .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC | OPT_FLAG_GLOBAL |
-              OPT_FLAG_RANGE
-    },
+              OPT_FLAG_RANGE},
     {.key = {"manage-gids"},
      .type = GF_OPTION_TYPE_BOOL,
      .default_value = "off",

gluster-ant avatar Sep 17 '21 08:09 gluster-ant

CLANG-FORMAT FAILURE: Before merging the patch, this diff needs to be considered for passing clang-format

index 542e26c54..29bf14c39 100644
--- a/xlators/features/shard/src/shard.c
+++ b/xlators/features/shard/src/shard.c
@@ -7655,48 +7655,42 @@ struct volume_options options[] = {
         .op_version = {GD_OP_VERSION_6_0},
         .flags = OPT_FLAG_SETTABLE,
     },
-    {
-        .key = {"shard-block-size"},
-        .type = GF_OPTION_TYPE_SIZET,
-        .op_version = {GD_OP_VERSION_3_7_0},
-        .flags = OPT_FLAG_SETTABLE | OPT_FLAG_CLIENT_OPT | OPT_FLAG_DOC |
-                 OPT_FLAG_RANGE,
-        .tags = {"shard"},
-        .default_value = "64MB",
-        .min = SHARD_MIN_BLOCK_SIZE,
-        .max = SHARD_MAX_BLOCK_SIZE,
-        .description = "The size unit used to break a file into multiple "
-                       "chunks."
-    },
-    {
-        .key = {"shard-deletion-rate"},
-        .type = GF_OPTION_TYPE_INT,
-        .op_version = {GD_OP_VERSION_5_0},
-        .flags = OPT_FLAG_SETTABLE | OPT_FLAG_CLIENT_OPT | OPT_FLAG_DOC |
-                 OPT_FLAG_RANGE,
-        .tags = {"shard"},
-        .default_value = "100",
-        .min = 100,
-        .max = INT_MAX,
-        .description = "The number of shards to send deletes on at a time."
-    },
-    {
-        .key = {"shard-lru-limit"},
-        .type = GF_OPTION_TYPE_INT,
-        .op_version = {GD_OP_VERSION_5_0},
-        .flags = OPT_FLAG_SETTABLE | OPT_FLAG_CLIENT_OPT | OPT_FLAG_RANGE,
-        .tags = {"shard"},
-        .default_value = "16384",
-        .min = 20,
-        .max = INT_MAX,
-        .description = "The number of resolved shard inodes to keep in "
-                       "memory. A higher number means shards that are "
-                       "resolved will remain in memory longer, avoiding "
-                       "frequent lookups on them when they participate in "
-                       "file operations. The option also has a bearing on "
-                       "amount of memory consumed by these inodes and their "
-                       "internal metadata."
-    },
+    {.key = {"shard-block-size"},
+     .type = GF_OPTION_TYPE_SIZET,
+     .op_version = {GD_OP_VERSION_3_7_0},
+     .flags = OPT_FLAG_SETTABLE | OPT_FLAG_CLIENT_OPT | OPT_FLAG_DOC |
+              OPT_FLAG_RANGE,
+     .tags = {"shard"},
+     .default_value = "64MB",
+     .min = SHARD_MIN_BLOCK_SIZE,
+     .max = SHARD_MAX_BLOCK_SIZE,
+     .description = "The size unit used to break a file into multiple "
+                    "chunks."},
+    {.key = {"shard-deletion-rate"},
+     .type = GF_OPTION_TYPE_INT,
+     .op_version = {GD_OP_VERSION_5_0},
+     .flags = OPT_FLAG_SETTABLE | OPT_FLAG_CLIENT_OPT | OPT_FLAG_DOC |
+              OPT_FLAG_RANGE,
+     .tags = {"shard"},
+     .default_value = "100",
+     .min = 100,
+     .max = INT_MAX,
+     .description = "The number of shards to send deletes on at a time."},
+    {.key = {"shard-lru-limit"},
+     .type = GF_OPTION_TYPE_INT,
+     .op_version = {GD_OP_VERSION_5_0},
+     .flags = OPT_FLAG_SETTABLE | OPT_FLAG_CLIENT_OPT | OPT_FLAG_RANGE,
+     .tags = {"shard"},
+     .default_value = "16384",
+     .min = 20,
+     .max = INT_MAX,
+     .description = "The number of resolved shard inodes to keep in "
+                    "memory. A higher number means shards that are "
+                    "resolved will remain in memory longer, avoiding "
+                    "frequent lookups on them when they participate in "
+                    "file operations. The option also has a bearing on "
+                    "amount of memory consumed by these inodes and their "
+                    "internal metadata."},
     {.key = {NULL}},
 };
 
diff --git a/xlators/performance/io-cache/src/io-cache.c b/xlators/performance/io-cache/src/io-cache.c
index 2656bc66b..97b546a01 100644
--- a/xlators/performance/io-cache/src/io-cache.c
+++ b/xlators/performance/io-cache/src/io-cache.c
@@ -2184,8 +2184,7 @@ struct volume_options options[] = {
                     "re-validation is performed.",
      .op_version = {1},
      .flags = OPT_FLAG_CLIENT_OPT | OPT_FLAG_SETTABLE | OPT_FLAG_DOC |
-              OPT_FLAG_RANGE
-    },
+              OPT_FLAG_RANGE},
     {.key = {"cache-size"},
      .type = GF_OPTION_TYPE_SIZET,
      .min = 4 * GF_UNIT_MB,
diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c
index 3d4420b5d..4ca3fbfcc 100644
--- a/xlators/protocol/client/src/client.c
+++ b/xlators/protocol/client/src/client.c
@@ -2933,8 +2933,7 @@ struct volume_options options[] = {
                     "declared as dead, if the server does not respond for "
                     "a particular (file) operation.",
      .op_version = {1},
-     .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC | OPT_FLAG_RANGE
-    },
+     .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC | OPT_FLAG_RANGE},
     {.key = {"ping-timeout"},
      .type = GF_OPTION_TYPE_TIME,
      .min = 0,
@@ -2943,8 +2942,7 @@ struct volume_options options[] = {
      .description = "Time duration for which the client waits to "
                     "check if the server is responsive.",
      .op_version = {1},
-     .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC | OPT_FLAG_RANGE
-    },
+     .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC | OPT_FLAG_RANGE},
     {.key = {"client-bind-insecure"}, .type = GF_OPTION_TYPE_BOOL},
     {.key = {"tcp-window-size"},
      .type = GF_OPTION_TYPE_SIZET,
@@ -2955,8 +2953,7 @@ struct volume_options options[] = {
                     " for TCP socket. Zero means do not set window size"
                     " explicitly and use default value.",
      .op_version = {1},
-     .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC | OPT_FLAG_RANGE
-    },
+     .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC | OPT_FLAG_RANGE},
     {.key = {"filter-O_DIRECT"},
      .type = GF_OPTION_TYPE_BOOL,
      .default_value = "disable",
diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c
index 948c03453..ae6003abc 100644
--- a/xlators/protocol/server/src/server.c
+++ b/xlators/protocol/server/src/server.c
@@ -1809,8 +1809,7 @@ struct volume_options server_options[] = {
      .description = "Specifies the limit on the number of inodes "
                     "in the lru list of the inode cache.",
      .op_version = {1},
-     .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC | OPT_FLAG_RANGE
-    },
+     .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC | OPT_FLAG_RANGE},
     {.key = {"trace"}, .type = GF_OPTION_TYPE_BOOL},
     {
         .key = {"config-directory", "conf-dir"},
@@ -1847,8 +1846,7 @@ struct volume_options server_options[] = {
      .description = "Value of the uid used for the anonymous "
                     "user/nfsnobody when root-squash/all-squash is enabled.",
      .op_version = {3},
-     .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC | OPT_FLAG_RANGE
-    },
+     .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC | OPT_FLAG_RANGE},
     {.key = {"anongid"},
      .type = GF_OPTION_TYPE_INT,
      .default_value = "65534", /* RPC_NOBODY_GID */
@@ -1857,8 +1855,7 @@ struct volume_options server_options[] = {
      .description = "Value of the gid used for the anonymous "
                     "user/nfsnobody when root-squash/all-squash is enabled.",
      .op_version = {3},
-     .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC | OPT_FLAG_RANGE
-    },
+     .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC | OPT_FLAG_RANGE},
     {.key = {"statedump-path"},
      .type = GF_OPTION_TYPE_PATH,
      .default_value = DEFAULT_VAR_RUN_DIRECTORY,
@@ -1875,8 +1872,7 @@ struct volume_options server_options[] = {
                     " for TCP socket. Zero means do not set window size"
                     " explicitly and use default value.",
      .op_version = {1},
-     .flags = OPT_FLAG_SETTABLE | OPT_FLAG_RANGE
-    },
+     .flags = OPT_FLAG_SETTABLE | OPT_FLAG_RANGE},
 
     /*  The following two options are defined in addr.c, redifined here *
      * for the sake of validation during volume set from cli            */
@@ -1921,8 +1917,7 @@ struct volume_options server_options[] = {
                     "potentially run out of memory).",
      .op_version = {1},
      .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC | OPT_FLAG_GLOBAL |
-              OPT_FLAG_RANGE
-    },
+              OPT_FLAG_RANGE},
     {.key = {"manage-gids"},
      .type = GF_OPTION_TYPE_BOOL,
      .default_value = "off",

gluster-ant avatar Sep 20 '21 07:09 gluster-ant

Thank you for your contributions. Noticed that this issue is not having any activity in last ~6 months! We are marking this issue as stale because it has not had recent activity. It will be closed in 2 weeks if no one responds with a comment here.

stale[bot] avatar Sep 20 '22 19:09 stale[bot]

Closing this issue as there was no update since my last update on issue. If this is an issue which is still valid, feel free to open it.

stale[bot] avatar Oct 16 '22 03:10 stale[bot]