]> sourceware.org Git - lvm2.git/commitdiff
pvresize: Do not use pv_read (get the PV from orphan VG).
authorPetr Rockai <prockai@redhat.com>
Tue, 19 Feb 2013 00:54:34 +0000 (01:54 +0100)
committerPetr Rockai <prockai@redhat.com>
Sun, 17 Nov 2013 20:41:27 +0000 (21:41 +0100)
lib/metadata/pv_manip.c

index fb29ef459f546a64c33e31516884419dff4c7e8d..b7a4b430bda135bb99c3e1c94e72cb5d4001cec2 100644 (file)
@@ -549,9 +549,9 @@ static int pv_resize(struct physical_volume *pv,
 }
 
 int pv_resize_single(struct cmd_context *cmd,
-                            struct volume_group *vg,
-                            struct physical_volume *pv,
-                            const uint64_t new_size)
+                    struct volume_group *vg,
+                    struct physical_volume *pv,
+                    const uint64_t new_size)
 {
        struct pv_list *pvl;
        uint64_t size = 0;
@@ -561,38 +561,25 @@ int pv_resize_single(struct cmd_context *cmd,
        struct volume_group *old_vg = vg;
        int vg_needs_pv_write = 0;
 
-       if (is_orphan_vg(vg_name)) {
-               if (!lock_vol(cmd, vg_name, LCK_VG_WRITE, NULL)) {
-                       log_error("Can't get lock for orphans");
-                       return 0;
-               }
-
-               if (!(pv = pv_read(cmd, pv_name, 1, 0))) {
-                       unlock_vg(cmd, vg_name);
-                       log_error("Unable to read PV \"%s\"", pv_name);
-                       return 0;
-               }
-       } else {
-               vg = vg_read_for_update(cmd, vg_name, NULL, 0);
+       vg = vg_read_for_update(cmd, vg_name, NULL, 0);
 
-               if (vg_read_error(vg)) {
-                       release_vg(vg);
-                       log_error("Unable to read volume group \"%s\".",
-                                 vg_name);
-                       return 0;
-               }
+       if (vg_read_error(vg)) {
+               release_vg(vg);
+               log_error("Unable to read volume group \"%s\".",
+                         vg_name);
+               return 0;
+       }
 
-               if (!(pvl = find_pv_in_vg(vg, pv_name))) {
-                       log_error("Unable to find \"%s\" in volume group \"%s\"",
-                                 pv_name, vg->name);
-                       goto out;
-               }
+       if (!(pvl = find_pv_in_vg(vg, pv_name))) {
+               log_error("Unable to find \"%s\" in volume group \"%s\"",
+                         pv_name, vg->name);
+               goto out;
+       }
 
-               pv = pvl->pv;
+       pv = pvl->pv;
 
-               if (!archive(vg))
-                       goto out;
-       }
+       if (!archive(vg))
+               goto out;
 
        if (!(pv->fmt->features & FMT_RESIZE_PV)) {
                log_error("Physical volume %s format does not support resizing.",
@@ -650,8 +637,6 @@ out:
                log_error("Use pvcreate and vgcfgrestore "
                          "to repair from archived metadata.");
        unlock_vg(cmd, vg_name);
-       if (is_orphan_vg(vg_name))
-               free_pv_fid(pv);
        if (!old_vg)
                release_vg(vg);
        return r;
This page took 0.038 seconds and 5 git commands to generate.