summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2017-08-16 13:34:57 -0500
committerDavid Teigland <teigland@redhat.com>2017-10-18 14:09:12 -0500
commit2989789433140ba5fe75b1f4d93c3e602289f3dd (patch)
treebe8d9a601ade76138a6f34a78804f50448c5d9b2
parent796e0b1357e14149496b4aa9e72c3f30f4f8d3b0 (diff)
downloadlvm2-2989789433140ba5fe75b1f4d93c3e602289f3dd.tar.gz
label_scan: remove async/sync distinction from callers
-rw-r--r--lib/cache/lvmcache.c12
-rw-r--r--lib/cache/lvmetad.c9
-rw-r--r--lib/label/label.c70
-rw-r--r--lib/label/label.h16
4 files changed, 58 insertions, 49 deletions
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index b3c899e4f..7846ce461 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -1178,8 +1178,7 @@ int lvmcache_label_rescan_vg(struct cmd_context *cmd, const char *vgname, const
dm_list_add(&devs, &devl->list);
}
- if (!cmd->use_aio || !label_scan_devs_async(cmd, &devs))
- label_scan_devs_sync(cmd, &devs);
+ label_scan_devs(cmd, &devs);
/*
* TODO: grab vginfo again, and compare vginfo->infos
@@ -1246,14 +1245,11 @@ int lvmcache_label_scan(struct cmd_context *cmd)
* with infos/vginfos based on reading headers from
* each device, and a vg summary from each mda.
*
- * Note that these will *skip* scanning a device if
+ * Note that this will *skip* scanning a device if
* an info struct already exists in lvmcache for
- * the device. To really scan every device here,
- * you need to destroy lvmcache first.
- * (even "force" does not force this to scan devices.)
+ * the device.
*/
- if (!cmd->use_aio || !label_scan_async(cmd))
- label_scan_sync(cmd);
+ label_scan(cmd);
/*
* _choose_preferred_devs() returns:
diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c
index 9f88441f4..8ece90e0f 100644
--- a/lib/cache/lvmetad.c
+++ b/lib/cache/lvmetad.c
@@ -1881,8 +1881,7 @@ static struct volume_group *_lvmetad_pvscan_vg(struct cmd_context *cmd, struct v
*/
log_debug_lvmetad("Rescan VG %s scanning data from devs in previous metadata.", vg->name);
- if (!cmd->use_aio || !label_scan_devs_async(cmd, &pvs_scan))
- label_scan_devs_sync(cmd, &pvs_scan);
+ label_scan_devs(cmd, &pvs_scan);
/*
* Check if any pvs_scan entries are no longer PVs.
@@ -2149,8 +2148,7 @@ static struct volume_group *_lvmetad_pvscan_vg(struct cmd_context *cmd, struct v
if (found_new_pvs)
log_debug_lvmetad("Rescan VG %s scanning all devs to find new PVs.", vg->name);
- if (!cmd->use_aio || !label_scan_async_force(cmd))
- label_scan_sync_force(cmd);
+ label_scan_force(cmd);
if (!(vginfo = lvmcache_vginfo_from_vgname(vg->name, NULL))) {
log_error("VG %s vg info not found after rescanning devices.", vg->name);
@@ -2365,8 +2363,7 @@ int lvmetad_pvscan_all_devs(struct cmd_context *cmd, int do_wait)
replacing_other_update = 1;
}
- if (!cmd->use_aio || !label_scan_async(cmd))
- label_scan_sync(cmd);
+ label_scan(cmd);
log_verbose("Scanning all devices to update lvmetad.");
diff --git a/lib/label/label.c b/lib/label/label.c
index 45ec7a5fc..418a1418d 100644
--- a/lib/label/label.c
+++ b/lib/label/label.c
@@ -786,16 +786,6 @@ bad:
return 0;
}
-int label_scan_async(struct cmd_context *cmd)
-{
- return _label_scan_async(cmd, 1);
-}
-
-int label_scan_async_force(struct cmd_context *cmd)
-{
- return _label_scan_async(cmd, 0);
-}
-
/*
* Read or reread label/metadata from selected devs (async).
*
@@ -807,7 +797,7 @@ int label_scan_async_force(struct cmd_context *cmd)
* its info is removed from lvmcache.
*/
-int label_scan_devs_async(struct cmd_context *cmd, struct dm_list *devs)
+static int _label_scan_devs_async(struct cmd_context *cmd, struct dm_list *devs)
{
struct dm_list tmp_label_read_list;
struct label_read_data *ld, *ld2;
@@ -1102,16 +1092,6 @@ static int _label_scan_sync(struct cmd_context *cmd, int skip_cached)
return 1;
}
-int label_scan_sync(struct cmd_context *cmd)
-{
- return _label_scan_sync(cmd, 1);
-}
-
-int label_scan_sync_force(struct cmd_context *cmd)
-{
- return _label_scan_sync(cmd, 0);
-}
-
/*
* Read or reread label/metadata from selected devs (sync).
*
@@ -1123,7 +1103,7 @@ int label_scan_sync_force(struct cmd_context *cmd)
* its info is removed from lvmcache.
*/
-int label_scan_devs_sync(struct cmd_context *cmd, struct dm_list *devs)
+static int _label_scan_devs_sync(struct cmd_context *cmd, struct dm_list *devs)
{
struct device_list *devl;
int dev_count = 0;
@@ -1148,3 +1128,49 @@ int label_scan_devs_sync(struct cmd_context *cmd, struct dm_list *devs)
return 1;
}
+/*
+ * FIXME: get rid of the force variations by making label_scan
+ * never skip scanning when info is cached.
+ * _force versions don't skip scanning label when info exists
+ * in lvmcache.
+ */
+
+int label_scan_force(struct cmd_context *cmd)
+{
+ int ret = 0;
+
+ if (cmd->use_aio)
+ ret = _label_scan_async(cmd, 0);
+
+ if (!ret)
+ ret = _label_scan_sync(cmd, 0);
+
+ return ret;
+}
+
+int label_scan(struct cmd_context *cmd)
+{
+ int ret = 0;
+
+ if (cmd->use_aio)
+ ret = _label_scan_async(cmd, 1);
+
+ if (!ret)
+ ret = _label_scan_sync(cmd, 1);
+
+ return ret;
+}
+
+int label_scan_devs(struct cmd_context *cmd, struct dm_list *devs)
+{
+ int ret = 0;
+
+ if (cmd->use_aio)
+ ret = _label_scan_devs_async(cmd, devs);
+
+ if (!ret)
+ ret = _label_scan_devs_sync(cmd, devs);
+
+ return ret;
+}
+
diff --git a/lib/label/label.h b/lib/label/label.h
index e9cfcda92..b8913b816 100644
--- a/lib/label/label.h
+++ b/lib/label/label.h
@@ -125,19 +125,9 @@ int label_verify(struct device *dev);
struct label *label_create(struct labeller *labeller);
void label_destroy(struct label *label);
-int label_scan_async(struct cmd_context *cmd);
-int label_scan_sync(struct cmd_context *cmd);
-int label_scan_devs_async(struct cmd_context *cmd, struct dm_list *devs);
-int label_scan_devs_sync(struct cmd_context *cmd, struct dm_list *devs);
+int label_scan_force(struct cmd_context *cmd);
+int label_scan(struct cmd_context *cmd);
+int label_scan_devs(struct cmd_context *cmd, struct dm_list *devs);
struct label_read_data *get_label_read_data(struct cmd_context *cmd, struct device *dev);
-/*
- * FIXME: get rid of these force variations by making label_scan
- * never skip scanning when info is cached.
- * _force versions don't skip scanning label when info exists
- * in lvmcache.
- */
-int label_scan_async_force(struct cmd_context *cmd);
-int label_scan_sync_force(struct cmd_context *cmd);
-
#endif