mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
targets: use target_present_version
Skip duplicated dm version ioctl() on every startup.
This commit is contained in:
parent
6373f39092
commit
9b173bb931
@ -240,9 +240,8 @@ static int _target_present(struct cmd_context *cmd,
|
||||
|
||||
if (!_integrity_checked) {
|
||||
_integrity_checked = 1;
|
||||
_integrity_present = target_present(cmd, TARGET_NAME_INTEGRITY, 1);
|
||||
|
||||
if (!target_version(TARGET_NAME_INTEGRITY, &maj, &min, &patchlevel))
|
||||
if (!(_integrity_present = target_present_version(cmd, TARGET_NAME_INTEGRITY, 1,
|
||||
&maj, &min, &patchlevel)))
|
||||
return 0;
|
||||
|
||||
if (maj < 1 || min < 6) {
|
||||
|
@ -405,7 +405,8 @@ static int _mirrored_target_present(struct cmd_context *cmd,
|
||||
if (!_mirrored_checked) {
|
||||
_mirrored_checked = 1;
|
||||
|
||||
if (!(_mirrored_present = target_present(cmd, TARGET_NAME_MIRROR, 1)))
|
||||
if (!(_mirrored_present = target_present_version(cmd, TARGET_NAME_MIRROR, 1,
|
||||
&maj, &min, &patchlevel)))
|
||||
return 0;
|
||||
|
||||
/*
|
||||
|
@ -551,10 +551,8 @@ static int _raid_target_present(struct cmd_context *cmd,
|
||||
if (!_raid_checked) {
|
||||
_raid_checked = 1;
|
||||
|
||||
if (!(_raid_present = target_present(cmd, TARGET_NAME_RAID, 1)))
|
||||
return 0;
|
||||
|
||||
if (!target_version("raid", &maj, &min, &patchlevel))
|
||||
if (!(_raid_present = target_present_version(cmd, TARGET_NAME_RAID, 1,
|
||||
&maj, &min, &patchlevel)))
|
||||
return_0;
|
||||
|
||||
for (i = 0; i < DM_ARRAY_SIZE(_features); ++i)
|
||||
|
@ -152,12 +152,12 @@ static int _snap_target_present(struct cmd_context *cmd,
|
||||
if (!_snap_checked) {
|
||||
_snap_checked = 1;
|
||||
|
||||
if (!(_snap_present = target_present(cmd, TARGET_NAME_SNAPSHOT, 1) &&
|
||||
target_present(cmd, TARGET_NAME_SNAPSHOT_ORIGIN, 0)))
|
||||
if (!(_snap_present = (target_present_version(cmd, TARGET_NAME_SNAPSHOT, 1,
|
||||
&maj, &min, &patchlevel) &&
|
||||
target_present(cmd, TARGET_NAME_SNAPSHOT_ORIGIN, 0)))
|
||||
return 0;
|
||||
|
||||
if (target_version(TARGET_NAME_SNAPSHOT, &maj, &min, &patchlevel) &&
|
||||
(maj > 1 ||
|
||||
if ((maj > 1 ||
|
||||
(maj == 1 && (min >= 12 || (min == 10 && patchlevel >= 2)))))
|
||||
_snap_attrs |= SNAPSHOT_FEATURE_FIXED_LEAK;
|
||||
else
|
||||
|
@ -690,12 +690,10 @@ static int _thin_target_present(struct cmd_context *cmd,
|
||||
if (!_checked) {
|
||||
_checked = 1;
|
||||
|
||||
if (!(_present = target_present(cmd, _thin_pool_module, 1)))
|
||||
if (!(_present = target_present_version(cmd, _thin_pool_module, 1,
|
||||
&maj, &min, &patchlevel)))
|
||||
return 0;
|
||||
|
||||
if (!target_version(_thin_pool_module, &maj, &min, &patchlevel))
|
||||
return_0;
|
||||
|
||||
for (i = 0; i < DM_ARRAY_SIZE(_features); ++i)
|
||||
if ((maj > _features[i].maj) ||
|
||||
(maj == _features[i].maj && min >= _features[i].min))
|
||||
|
@ -419,7 +419,7 @@ static int _vdo_target_present(struct cmd_context *cmd,
|
||||
/* Try to load kmod VDO module */
|
||||
if (!module_present(cmd, MODULE_NAME_VDO) ||
|
||||
!target_version(TARGET_NAME_VDO, &maj, &min, &patchlevel))
|
||||
return_0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (maj < 6 || (maj == 6 && min < 2)) {
|
||||
|
@ -238,17 +238,9 @@ static int _target_present(struct cmd_context *cmd,
|
||||
|
||||
if (!_writecache_checked) {
|
||||
_writecache_checked = 1;
|
||||
_writecache_present = target_present(cmd, TARGET_NAME_WRITECACHE, 1);
|
||||
|
||||
if (!_writecache_present) {
|
||||
log_error("dm-writecache module not found in kernel.");
|
||||
if (!(_writecache_present = target_present_version(cmd, TARGET_NAME_WRITECACHE, 1.
|
||||
&maj, &min, &patchlevel)))
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!target_version(TARGET_NAME_WRITECACHE, &maj, &min, &patchlevel)) {
|
||||
log_error("dm-writecache module version not found.");
|
||||
return_0;
|
||||
}
|
||||
|
||||
if (maj < 1) {
|
||||
log_error("dm-writecache module version older than minimum 1.0.0");
|
||||
|
Loading…
Reference in New Issue
Block a user