summaryrefslogtreecommitdiff
path: root/tools/pvscan.c
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2021-07-15 16:33:50 -0500
committerDavid Teigland <teigland@redhat.com>2021-11-04 10:58:16 -0500
commit726dd25969e9e6a3de285a22cea45e9f5f53520f (patch)
treea9e8c5301c897c6b30840c44e025d1d2cafdbbb5 /tools/pvscan.c
parent6ea8d975b23758e6e099bf51cf7334f27f9fd096 (diff)
downloadlvm2-726dd25969e9e6a3de285a22cea45e9f5f53520f.tar.gz
add hints interface to the pvs_online file information
The information in /run/lvm/pvs_online/<pvid> files can be used to build a list of devices for a given VG. The pvscan -aay command has long used this information to activate a VG while scanning only devices in that VG, which is an important optimization for autoactivation. This patch implements the same thing through the existing device hints interface, so that the optimization can be applied elsewhere. A future patch will take advantage of this optimization in vgchange -aay, which is now used in place of pvscan -aay for event activation.
Diffstat (limited to 'tools/pvscan.c')
-rw-r--r--tools/pvscan.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/tools/pvscan.c b/tools/pvscan.c
index 7d84e45d4..01f57af0c 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -21,6 +21,8 @@
#include <dirent.h>
+int online_pvid_file_read(char *path, int *major, int *minor, char *vgname);
+
struct pvscan_params {
int new_pvs_found;
int pvs_found;
@@ -225,7 +227,7 @@ static char *_vgname_in_pvid_file_buf(char *buf)
#define MAX_PVID_FILE_SIZE 512
-static int _online_pvid_file_read(char *path, int *major, int *minor, char *vgname)
+int online_pvid_file_read(char *path, int *major, int *minor, char *vgname)
{
char buf[MAX_PVID_FILE_SIZE] = { 0 };
char *name;
@@ -328,7 +330,7 @@ static void _online_pvid_file_remove_devno(int major, int minor)
file_minor = 0;
memset(file_vgname, 0, sizeof(file_vgname));
- _online_pvid_file_read(path, &file_major, &file_minor, file_vgname);
+ online_pvid_file_read(path, &file_major, &file_minor, file_vgname);
if ((file_major == major) && (file_minor == minor)) {
log_debug("Unlink pv online %s", path);
@@ -447,7 +449,7 @@ check_duplicate:
memset(file_vgname, 0, sizeof(file_vgname));
- _online_pvid_file_read(path, &file_major, &file_minor, file_vgname);
+ online_pvid_file_read(path, &file_major, &file_minor, file_vgname);
if ((file_major == major) && (file_minor == minor)) {
log_debug("Existing online file for %d:%d", major, minor);
@@ -847,7 +849,7 @@ static int _get_devs_from_saved_vg(struct cmd_context *cmd, const char *vgname,
file_minor = 0;
memset(file_vgname, 0, sizeof(file_vgname));
- _online_pvid_file_read(path, &file_major, &file_minor, file_vgname);
+ online_pvid_file_read(path, &file_major, &file_minor, file_vgname);
if (file_vgname[0] && strcmp(vgname, file_vgname)) {
log_error_pvscan(cmd, "Wrong VG found for %d:%d PVID %s: %s vs %s",
@@ -1254,7 +1256,7 @@ static void _set_pv_devices_online(struct cmd_context *cmd, struct volume_group
minor = 0;
file_vgname[0] = '\0';
- _online_pvid_file_read(path, &major, &minor, file_vgname);
+ online_pvid_file_read(path, &major, &minor, file_vgname);
if (file_vgname[0] && strcmp(vg->name, file_vgname)) {
log_warn("WARNING: VG %s PV %s wrong vgname in online file %s",