summaryrefslogtreecommitdiff
path: root/lib/label
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2020-10-21 12:20:17 -0500
committerDavid Teigland <teigland@redhat.com>2020-10-21 16:24:16 -0500
commita7f195b7e8f27c292761c604c1697c1d97cd5c1d (patch)
tree471dba92223e5209ee6da0e17cf468bb44be7b03 /lib/label
parent677f829e540ef0f2fa2781f4facc7571dee1fb83 (diff)
downloadlvm2-a7f195b7e8f27c292761c604c1697c1d97cd5c1d.tar.gz
add label_scan_devs_cached
label_scan_devs without invalidating data first for cases where the caller wants to use any bcache data they have already read.
Diffstat (limited to 'lib/label')
-rw-r--r--lib/label/label.c15
-rw-r--r--lib/label/label.h1
2 files changed, 16 insertions, 0 deletions
diff --git a/lib/label/label.c b/lib/label/label.c
index bc8e60fc9..36eab19f3 100644
--- a/lib/label/label.c
+++ b/lib/label/label.c
@@ -1303,6 +1303,21 @@ int label_read_pvid(struct device *dev)
}
/*
+ * label_scan_devs without invalidating data for the devs first,
+ * when the caller wants to make use of any bcache data that
+ * they may have already read.
+ */
+int label_scan_devs_cached(struct cmd_context *cmd, struct dev_filter *f, struct dm_list *devs)
+{
+ if (!scan_bcache)
+ return 0;
+
+ _scan_list(cmd, f, devs, NULL);
+
+ return 1;
+}
+
+/*
* Scan and cache lvm data from the listed devices. If a device is already
* scanned and cached, this replaces the previously cached lvm data for the
* device. This is called when vg_read() wants to guarantee that it is using
diff --git a/lib/label/label.h b/lib/label/label.h
index ddfb34af5..a98ba32e3 100644
--- a/lib/label/label.h
+++ b/lib/label/label.h
@@ -104,6 +104,7 @@ extern struct bcache *scan_bcache;
int label_scan(struct cmd_context *cmd);
int label_scan_devs(struct cmd_context *cmd, struct dev_filter *f, struct dm_list *devs);
+int label_scan_devs_cached(struct cmd_context *cmd, struct dev_filter *f, struct dm_list *devs);
int label_scan_devs_rw(struct cmd_context *cmd, struct dev_filter *f, struct dm_list *devs);
int label_scan_devs_excl(struct dm_list *devs);
int label_scan_dev(struct device *dev);