summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/pvremove.c10
-rw-r--r--tools/pvresize.c8
-rw-r--r--tools/toollib.c14
3 files changed, 13 insertions, 19 deletions
diff --git a/tools/pvremove.c b/tools/pvremove.c
index a8717e05..ace3c1d0 100644
--- a/tools/pvremove.c
+++ b/tools/pvremove.c
@@ -25,15 +25,12 @@ const char _really_wipe[] =
static int pvremove_check(struct cmd_context *cmd, const char *name)
{
struct physical_volume *pv;
- struct dm_list mdas;
-
- dm_list_init(&mdas);
/* FIXME Check partition type is LVM unless --force is given */
/* Is there a pv here already? */
/* If not, this is an error unless you used -f. */
- if (!(pv = pv_read(cmd, name, &mdas, NULL, 1, 0))) {
+ if (!(pv = pv_read(cmd, name, NULL, 1, 0))) {
if (arg_count(cmd, force_ARG))
return 1;
log_error("Physical Volume %s not found", name);
@@ -47,13 +44,14 @@ static int pvremove_check(struct cmd_context *cmd, const char *name)
* means checking every VG by scanning every
* PV on the system.
*/
- if (is_orphan(pv) && !dm_list_size(&mdas)) {
+ if (is_orphan(pv) && !dm_list_size(&pv->fid->metadata_areas_in_use) &&
+ !dm_list_size(&pv->fid->metadata_areas_ignored)) {
if (!scan_vgs_for_pvs(cmd, 0)) {
log_error("Rescan for PVs without metadata areas "
"failed.");
return 0;
}
- if (!(pv = pv_read(cmd, name, NULL, NULL, 1, 0))) {
+ if (!(pv = pv_read(cmd, name, NULL, 1, 0))) {
log_error("Failed to read physical volume %s", name);
return 0;
}
diff --git a/tools/pvresize.c b/tools/pvresize.c
index a471f368..f347d9d3 100644
--- a/tools/pvresize.c
+++ b/tools/pvresize.c
@@ -32,28 +32,26 @@ static int _pv_resize_single(struct cmd_context *cmd,
uint64_t size = 0;
uint32_t new_pe_count = 0;
int r = 0;
- struct dm_list mdas;
const char *pv_name = pv_dev_name(pv);
const char *vg_name = pv_vg_name(pv);
struct lvmcache_info *info;
int mda_count = 0;
struct volume_group *old_vg = vg;
- dm_list_init(&mdas);
-
if (is_orphan_vg(vg_name)) {
if (!lock_vol(cmd, vg_name, LCK_VG_WRITE)) {
log_error("Can't get lock for orphans");
return 0;
}
- if (!(pv = pv_read(cmd, pv_name, &mdas, NULL, 1, 0))) {
+ if (!(pv = pv_read(cmd, pv_name, NULL, 1, 0))) {
unlock_vg(cmd, vg_name);
log_error("Unable to read PV \"%s\"", pv_name);
return 0;
}
- mda_count = dm_list_size(&mdas);
+ mda_count = dm_list_size(&pv->fid->metadata_areas_in_use) +
+ dm_list_size(&pv->fid->metadata_areas_ignored);
} else {
vg = vg_read_for_update(cmd, vg_name, NULL, 0);
diff --git a/tools/toollib.c b/tools/toollib.c
index 2a52a517..cdd8bb75 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -649,7 +649,7 @@ static int _process_all_devs(struct cmd_context *cmd, void *handle,
}
while ((dev = dev_iter_get(iter))) {
- if (!(pv = pv_read(cmd, dev_name(dev), NULL, NULL, 0, 0))) {
+ if (!(pv = pv_read(cmd, dev_name(dev), NULL, 0, 0))) {
memset(&pv_dummy, 0, sizeof(pv_dummy));
dm_list_init(&pv_dummy.tags);
dm_list_init(&pv_dummy.segments);
@@ -691,7 +691,6 @@ int process_each_pv(struct cmd_context *cmd, int argc, char **argv,
struct str_list *sll;
char *at_sign, *tagname;
int scanned = 0;
- struct dm_list mdas;
dm_list_init(&tags);
@@ -733,10 +732,8 @@ int process_each_pv(struct cmd_context *cmd, int argc, char **argv,
}
pv = pvl->pv;
} else {
-
- dm_list_init(&mdas);
- if (!(pv = pv_read(cmd, argv[opt], &mdas,
- NULL, 1, scan_label_only))) {
+ if (!(pv = pv_read(cmd, argv[opt], NULL,
+ 1, scan_label_only))) {
log_error("Failed to read physical "
"volume \"%s\"", argv[opt]);
ret_max = ECMD_FAILED;
@@ -751,7 +748,8 @@ int process_each_pv(struct cmd_context *cmd, int argc, char **argv,
* PV on the system.
*/
if (!scanned && is_orphan(pv) &&
- !dm_list_size(&mdas)) {
+ !dm_list_size(&pv->fid->metadata_areas_in_use) &&
+ !dm_list_size(&pv->fid->metadata_areas_ignored)) {
if (!scan_label_only &&
!scan_vgs_for_pvs(cmd, 1)) {
stack;
@@ -760,7 +758,7 @@ int process_each_pv(struct cmd_context *cmd, int argc, char **argv,
}
scanned = 1;
if (!(pv = pv_read(cmd, argv[opt],
- NULL, NULL, 1,
+ NULL, 1,
scan_label_only))) {
log_error("Failed to read "
"physical volume "