1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

dev-cache: check for nvme name while adding alias

Instead of repeated list retest, compare name once during add of alias.
This commit is contained in:
Zdenek Kabelac 2021-02-07 14:04:58 +01:00
parent 9b173bb931
commit be9b731f44
2 changed files with 6 additions and 13 deletions

View File

@ -337,6 +337,11 @@ static int _add_alias(struct device *dev, const char *path)
return 1;
}
if (!strncmp(path, "/dev/nvme", 9)) {
log_debug("Found nvme device %s", dev_name(dev));
dev->flags |= DEV_IS_NVME;
}
sl->str = path;
if (!dm_list_empty(&dev->aliases)) {

View File

@ -78,19 +78,7 @@ int dev_is_pmem(struct device *dev)
int dev_is_nvme(struct dev_types *dt, struct device *dev)
{
struct dm_str_list *strl;
if (dev->flags & DEV_IS_NVME)
return 1;
dm_list_iterate_items(strl, &dev->aliases) {
if (!strncmp(strl->str, "/dev/nvme", 9)) {
log_debug("Found nvme device %s", dev_name(dev));
dev->flags |= DEV_IS_NVME;
return 1;
}
}
return 0;
return (dev->flags & DEV_IS_NVME) ? 1 : 0;
}
int dev_is_lv(struct device *dev)