mirror of
git://sourceware.org/git/lvm2.git
synced 2025-10-16 23:33:16 +03:00
Replace PV_MIN_SIZE with function pv_min_size()
Add configurable option to define minimal size of of block device usable as a PV. pv_min_size() is added to lvm-globals and it's being initialized through _process_config. Macro PV_MIN_SIZE is unused and removed. New define DEFAULT_PV_MIN_SIZE_KB is added to lvm-global and unlike PV_MIN_SIZE it uses KB units. Should help users with various slow devices attached to the system, which cannot be easily filtered out (like FDD on /dev/sdX): https://bugzilla.redhat.com/show_bug.cgi?id=644578
This commit is contained in:
@@ -205,6 +205,7 @@ static int _process_config(struct cmd_context *cmd)
|
||||
struct stat st;
|
||||
const struct config_node *cn;
|
||||
const struct config_value *cv;
|
||||
int64_t pv_min_kb;
|
||||
|
||||
/* umask */
|
||||
cmd->default_settings.umask = find_config_tree_int(cmd,
|
||||
@@ -318,6 +319,15 @@ static int _process_config(struct cmd_context *cmd)
|
||||
cmd->metadata_read_only = find_config_tree_int(cmd, "global/metadata_read_only",
|
||||
DEFAULT_METADATA_READ_ONLY);
|
||||
|
||||
pv_min_kb = find_config_tree_int64(cmd, "devices/pv_min_size", DEFAULT_PV_MIN_SIZE_KB);
|
||||
if (pv_min_kb < DEFAULT_PV_MIN_SIZE_KB) {
|
||||
log_warn("Ignoring too small pv_min_size %" PRId64 "KB, using default %dKB.",
|
||||
pv_min_kb, DEFAULT_PV_MIN_SIZE_KB);
|
||||
pv_min_kb = DEFAULT_PV_MIN_SIZE_KB;
|
||||
}
|
||||
/* lvm internally works with device size in 512b sectors */
|
||||
init_pv_min_size((uint64_t)pv_min_kb * (1024 >> SECTOR_SHIFT));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1113,7 +1123,6 @@ static void _init_globals(struct cmd_context *cmd)
|
||||
{
|
||||
init_full_scan_done(0);
|
||||
init_mirror_in_sync(0);
|
||||
|
||||
}
|
||||
|
||||
/* Entry point */
|
||||
|
Reference in New Issue
Block a user