]> sourceware.org Git - lvm2.git/commitdiff
Add add_pvl_to_vgs() - helper function to add a pv to a vg list.
authorDave Wysochanski <dwysocha@redhat.com>
Tue, 6 Apr 2010 14:04:54 +0000 (14:04 +0000)
committerDave Wysochanski <dwysocha@redhat.com>
Tue, 6 Apr 2010 14:04:54 +0000 (14:04 +0000)
Small refactor of main places in the code where a pv is added to a
vg into a small function which adds the pv to the list and updates
the vg counts.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
lib/format1/import-export.c
lib/format_text/import_vsn1.c
lib/metadata/metadata.c
lib/metadata/metadata.h

index 2ffc19e2146452c52cfb1721f511fa1f64aa57c6..e37d59e73c911d13279b30f61042864f71a21028 100644 (file)
@@ -437,8 +437,7 @@ int import_pvs(const struct format_type *fmt, struct dm_pool *mem,
                        return_0;
 
                pvl->pv->fmt = fmt;
-               dm_list_add(&vg->pvs, &pvl->list);
-               vg->pv_count++;
+               add_pvl_to_vgs(vg, pvl);
        }
 
        return 1;
index cf2c9df58ea1fa97684c238a4010518df344d949..ed508cf9a331312c16cd5885a29219102eb00b24 100644 (file)
@@ -271,8 +271,7 @@ static int _read_pv(struct format_instance *fid, struct dm_pool *mem,
 
        vg->extent_count += pv->pe_count;
        vg->free_count += pv->pe_count;
-       vg->pv_count++;
-       dm_list_add(&vg->pvs, &pvl->list);
+       add_pvl_to_vgs(vg, pvl);
 
        return 1;
 }
index 9e6d9babca59635104853a01e93996a94cbf4697..6ceb793fb7315e8ca8e8bb089cc4ddf5a114279e 100644 (file)
@@ -136,6 +136,13 @@ out:
        return pv->pe_align_offset;
 }
 
+void add_pvl_to_vgs(struct volume_group *vg, struct pv_list *pvl)
+{
+       dm_list_add(&vg->pvs, &pvl->list);
+       vg->pv_count++;
+}
+
+
 /**
  * add_pv_to_vg - Add a physical volume to a volume group
  * @vg - volume group to add to
@@ -230,9 +237,7 @@ int add_pv_to_vg(struct volume_group *vg, const char *pv_name,
        }
 
        pvl->pv = pv;
-       dm_list_add(&vg->pvs, &pvl->list);
-
-       vg->pv_count++;
+       add_pvl_to_vgs(vg, pvl);
        vg->extent_count += pv->pe_count;
        vg->free_count += pv->pe_count;
 
index 782d30017d1dc9c53ac8df158c859c118dde168e..1496252d5ff4c5add612836da210dce3f6daeca3 100644 (file)
@@ -377,5 +377,6 @@ struct id pv_vgid(const struct physical_volume *pv);
 struct physical_volume *pv_by_path(struct cmd_context *cmd, const char *pv_name);
 int add_pv_to_vg(struct volume_group *vg, const char *pv_name,
                 struct physical_volume *pv);
+void add_pvl_to_vgs(struct volume_group *vg, struct pv_list *pvl);
 
 #endif
This page took 0.048838 seconds and 5 git commands to generate.