From 950726dfc8e3171bef625b563c0c6dbba1ec2928 Mon Sep 17 00:00:00 2001 From: Sheetal Pamecha Date: Mon, 19 Nov 2018 22:15:25 +0530 Subject: posix: add storage.reserve-size option storage.reserve-size option will take size as input instead of percentage. If set, priority will be given to storage.reserve-size over storage.reserve. Default value of this option is 0. fixes: bz#1651445 Change-Id: I7a7342c68e436e8bf65bd39c567512ee04abbcea Signed-off-by: Sheetal Pamecha --- xlators/storage/posix/src/posix-common.c | 34 ++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) (limited to 'xlators/storage/posix/src/posix-common.c') diff --git a/xlators/storage/posix/src/posix-common.c b/xlators/storage/posix/src/posix-common.c index 06ff6e631bb..31dc9495af1 100644 --- a/xlators/storage/posix/src/posix-common.c +++ b/xlators/storage/posix/src/posix-common.c @@ -344,11 +344,18 @@ posix_reconfigure(xlator_t *this, dict_t *options) " fallback to :"); } - GF_OPTION_RECONF("reserve", priv->disk_reserve, options, uint32, out); - if (priv->disk_reserve) { + GF_OPTION_RECONF("reserve-size", priv->disk_reserve_size, options, size, + out); + + GF_OPTION_RECONF("reserve", priv->disk_reserve_percent, options, uint32, + out); + if (priv->disk_reserve_size || priv->disk_reserve_percent) { ret = posix_spawn_disk_space_check_thread(this); - if (ret) + if (ret) { + gf_msg(this->name, GF_LOG_INFO, 0, P_MSG_DISK_SPACE_CHECK_FAILED, + "Getting disk space check from thread failed"); goto out; + } } GF_OPTION_RECONF("health-check-interval", priv->health_check_interval, @@ -966,11 +973,17 @@ posix_init(xlator_t *this) _private->disk_space_check_active = _gf_false; _private->disk_space_full = 0; - GF_OPTION_INIT("reserve", _private->disk_reserve, uint32, out); - if (_private->disk_reserve) { + GF_OPTION_INIT("reserve-size", _private->disk_reserve_size, size, out); + + GF_OPTION_INIT("reserve", _private->disk_reserve_percent, uint32, out); + + if (_private->disk_reserve_size || _private->disk_reserve_percent) { ret = posix_spawn_disk_space_check_thread(this); - if (ret) + if (ret) { + gf_msg(this->name, GF_LOG_INFO, 0, P_MSG_DISK_SPACE_CHECK_FAILED, + "Getting disk space check from thread failed "); goto out; + } } _private->health_check_active = _gf_false; @@ -1214,6 +1227,15 @@ struct volume_options posix_options[] = { " 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", -- cgit