1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-12 08:13:48 +03:00

dev_manager: add dev_manager_remove_dm_major_minor

Move DM usage into dev_manager.c source file.
Also convert STATUS to INFO ioctl - as that's enough
to obtain UUID - this also avoid issuing unwanted flush on checked DM
device for being mpath.
This commit is contained in:
Zdenek Kabelac 2019-03-13 12:59:59 +01:00
parent da31541bd8
commit 1eeb2fa3f6
4 changed files with 21 additions and 19 deletions

View File

@ -1,5 +1,6 @@
Version 2.03.02 -
===================================
Use device INFO instead of STATUS when checking for mpath device uuid.
Change default io_memory_size from 4 to 8 MiB.
Add config setting io_memory_size to set bcache size.
Fix pvscan autoactivation for concurrent pvscans.

View File

@ -539,25 +539,7 @@ int target_version(const char *target_name, uint32_t *maj,
int lvm_dm_prefix_check(int major, int minor, const char *prefix)
{
struct dm_task *dmt;
const char *uuid;
int r;
if (!(dmt = dm_task_create(DM_DEVICE_STATUS)))
return_0;
if (!dm_task_set_minor(dmt, minor) ||
!dm_task_set_major(dmt, major) ||
!dm_task_run(dmt) ||
!(uuid = dm_task_get_uuid(dmt))) {
dm_task_destroy(dmt);
return 0;
}
r = strncasecmp(uuid, prefix, strlen(prefix));
dm_task_destroy(dmt);
return r ? 0 : 1;
return dev_manager_check_prefix_dm_major_minor(major, minor, prefix);
}
int module_present(struct cmd_context *cmd, const char *target_name)

View File

@ -943,6 +943,23 @@ static int _info_by_dev(uint32_t major, uint32_t minor, struct dm_info *info)
return _info_run(NULL, info, NULL, 0, 0, 0, major, minor);
}
int dev_manager_check_prefix_dm_major_minor(uint32_t major, uint32_t minor, const char *prefix)
{
struct dm_task *dmt;
const char *uuid;
int r = 1;
if (!(dmt = _setup_task_run(DM_DEVICE_INFO, NULL, NULL, NULL, 0, major, minor, 0, 0, 0)))
return_0;
if (!(uuid = dm_task_get_uuid(dmt)) || strncasecmp(uuid, prefix, strlen(prefix)))
r = 0;
dm_task_destroy(dmt);
return r;
}
int dev_manager_info(struct cmd_context *cmd,
const struct logical_volume *lv, const char *layer,
int with_open_count, int with_read_ahead,

View File

@ -107,6 +107,8 @@ int dev_manager_device_uses_vg(struct device *dev,
int dev_manager_remove_dm_major_minor(uint32_t major, uint32_t minor);
int dev_manager_check_prefix_dm_major_minor(uint32_t major, uint32_t minor, const char *prefix);
int get_cache_vol_meta_data(struct cmd_context *cmd,
struct logical_volume *lv,
struct logical_volume *pool_lv,