summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix/src/posix-common.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/storage/posix/src/posix-common.c')
-rw-r--r--xlators/storage/posix/src/posix-common.c33
1 files changed, 15 insertions, 18 deletions
diff --git a/xlators/storage/posix/src/posix-common.c b/xlators/storage/posix/src/posix-common.c
index a2b94256e3f..a80cf963d89 100644
--- a/xlators/storage/posix/src/posix-common.c
+++ b/xlators/storage/posix/src/posix-common.c
@@ -335,12 +335,14 @@ posix_reconfigure(xlator_t *this, dict_t *options)
" fallback to <hostname>:<export>");
}
- GF_OPTION_RECONF("reserve-size", priv->disk_reserve_size, options, size,
+ GF_OPTION_RECONF("reserve", priv->disk_reserve, options, percent_or_size,
out);
+ /* option can be any one of percent or bytes */
+ priv->disk_unit = 0;
+ if (priv->disk_reserve < 100.0)
+ priv->disk_unit = 'p';
- GF_OPTION_RECONF("reserve", priv->disk_reserve_percent, options, uint32,
- out);
- if (priv->disk_reserve_size || priv->disk_reserve_percent) {
+ if (priv->disk_reserve) {
ret = posix_spawn_disk_space_check_thread(this);
if (ret) {
gf_msg(this->name, GF_LOG_INFO, 0, P_MSG_DISK_SPACE_CHECK_FAILED,
@@ -964,11 +966,15 @@ posix_init(xlator_t *this)
_private->disk_space_check_active = _gf_false;
_private->disk_space_full = 0;
- GF_OPTION_INIT("reserve-size", _private->disk_reserve_size, size, out);
- GF_OPTION_INIT("reserve", _private->disk_reserve_percent, uint32, out);
+ GF_OPTION_INIT("reserve", _private->disk_reserve, percent_or_size, out);
+
+ /* option can be any one of percent or bytes */
+ _private->disk_unit = 0;
+ if (_private->disk_reserve < 100.0)
+ _private->disk_unit = 'p';
- if (_private->disk_reserve_size || _private->disk_reserve_percent) {
+ if (_private->disk_reserve) {
ret = posix_spawn_disk_space_check_thread(this);
if (ret) {
gf_msg(this->name, GF_LOG_INFO, 0, P_MSG_DISK_SPACE_CHECK_FAILED,
@@ -1210,23 +1216,14 @@ struct volume_options posix_options[] = {
.op_version = {GD_OP_VERSION_4_0_0},
.flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC},
{.key = {"reserve"},
- .type = GF_OPTION_TYPE_INT,
+ .type = GF_OPTION_TYPE_PERCENT_OR_SIZET,
.min = 0,
.default_value = "1",
.validate = GF_OPT_VALIDATE_MIN,
- .description = "Percentage of disk space to be reserved."
+ .description = "Percentage/Size of disk space to be reserved."
" Set to 0 to disable",
.op_version = {GD_OP_VERSION_3_13_0},
.flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC},
- {.key = {"reserve-size"},
- .type = GF_OPTION_TYPE_SIZET,
- .min = 0,
- .default_value = "0",
- .validate = GF_OPT_VALIDATE_MIN,
- .description = "size in megabytes to be reserved for disk space."
- " Set to 0 to disable",
- .op_version = {GD_OP_VERSION_7_0},
- .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC},
{.key = {"batch-fsync-mode"},
.type = GF_OPTION_TYPE_STR,
.default_value = "reverse-fsync",