* main - dev-cache: check for nvme name while adding alias
@ 2021-02-08 22:45 Zdenek Kabelac
0 siblings, 0 replies; only message in thread
From: Zdenek Kabelac @ 2021-02-08 22:45 UTC (permalink / raw)
To: lvm-devel
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=be9b731f440243df8fb42f6f2a506bf27de5ac64
Commit: be9b731f440243df8fb42f6f2a506bf27de5ac64
Parent: 9b173bb931426cd1d35beb5ec5151289112b2568
Author: Zdenek Kabelac <zkabelac@redhat.com>
AuthorDate: Sun Feb 7 14:04:58 2021 +0100
Committer: Zdenek Kabelac <zkabelac@redhat.com>
CommitterDate: Mon Feb 8 23:43:38 2021 +0100
dev-cache: check for nvme name while adding alias
Instead of repeated list retest, compare name once during add of alias.
---
lib/device/dev-cache.c | 5 +++++
lib/device/dev-type.c | 14 +-------------
2 files changed, 6 insertions(+), 13 deletions(-)
diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c
index 8082efac4..a93600965 100644
--- a/lib/device/dev-cache.c
+++ b/lib/device/dev-cache.c
@@ -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)) {
diff --git a/lib/device/dev-type.c b/lib/device/dev-type.c
index 379afa89c..8eacbf096 100644
--- a/lib/device/dev-type.c
+++ b/lib/device/dev-type.c
@@ -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)
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2021-02-08 22:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-08 22:45 main - dev-cache: check for nvme name while adding alias Zdenek Kabelac
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.