Skip to contentSkip to conversation

main - toollib: remove all devices list from process_each_pv

PATCH David Teigland 1 participant 1 message Oct 13, 2021

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=6fb497ef42a5f8324a90cb93734cd8071ed0dc0b
Commit:        6fb497ef42a5f8324a90cb93734cd8071ed0dc0b
Parent:        272d1ccac8654c0d74ecf255d13de0a6222ff96f
Author:        David Teigland <[email protected]>
AuthorDate:    Wed Oct 13 14:13:54 2021 -0500
Committer:     David Teigland <[email protected]>
CommitterDate: Wed Oct 13 17:29:32 2021 -0500

toollib: remove all devices list from process_each_pv

Reporting non-PVs / "all devices" is only done by pvs -a or pvdisplay -a, so avoid the work managing a list of all devices in process_each_pv. In the case when it's needed, use the results of label_scan which already determines which devs are not PVs.

---
 lib/device/device.h |   1 +
 lib/label/label.c   |   1 +
 tools/toollib.c     | 253 ++++++++++++++--------------------------------------
 3 files changed, 71 insertions(+), 184 deletions(-)
lib/device/device.h +1 -0
index a30a1288b..9e471a9b5 100644
@@ -39,6 +39,7 @@
 #define DEV_IS_MD_COMPONENT	0x00020000	/* device is an md component */
 #define DEV_IS_NVME		0x00040000	/* set if dev is nvme */
 #define DEV_MATCHED_USE_ID	0x00080000	/* matched an entry from cmd->use_devices */
+#define DEV_SCAN_FOUND_NOLABEL	0x00100000	/* label_scan read, passed filters, but no lvm label */
 
 /*
  * Support for external device info.
lib/label/label.c +1 -0
index b5804c738..b8f0dc84d 100644
@@ -403,6 +403,7 @@ static int _process_block(struct cmd_context *cmd, struct dev_filter *f,
 			memset(dev->pvid, 0, sizeof(dev->pvid));
 		}
 
+		dev->flags |= DEV_SCAN_FOUND_NOLABEL;
 		*is_lvm_device = 0;
 		goto out;
 	}
tools/toollib.c +69 -184

425 lines not on this page · raw message