]> sourceware.org Git - lvm2.git/commitdiff
Pass metadataignore to pv_create, pv_setup, _mda_setup, and add_mda.
authorDave Wysochanski <dwysocha@redhat.com>
Thu, 8 Jul 2010 18:24:29 +0000 (18:24 +0000)
committerDave Wysochanski <dwysocha@redhat.com>
Thu, 8 Jul 2010 18:24:29 +0000 (18:24 +0000)
Pass metadataignore through PV creation / setup paths.
As a result of this cleanup, we can remove the unnecessary setting
of mda_ignore bits inside pvcreate_single(), after call to pv_create.
For now, just set metadataignore to '0' in some places.  This is
equivalent to the prior functionality, although the 0 is given
by the caller not hardcoded in _mda_setup() call.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
lib/format1/format1.c
lib/format_pool/format_pool.c
lib/format_text/archiver.c
lib/format_text/format-text.c
lib/metadata/metadata-exported.h
lib/metadata/metadata.c
lib/metadata/metadata.h
tools/vgconvert.c

index e0e5ad07b59f481b2cdb2bb3b53bce278c7d6a3a..7c52d2b05de66b48db73ebcc4bb0ce41f1a631b3 100644 (file)
@@ -294,13 +294,15 @@ static int _format1_pv_read(const struct format_type *fmt, const char *pv_name,
 }
 
 static int _format1_pv_setup(const struct format_type *fmt,
-                    uint64_t pe_start, uint32_t extent_count,
-                    uint32_t extent_size,
-                    unsigned long data_alignment __attribute((unused)),
-                    unsigned long data_alignment_offset __attribute((unused)),
-                    int pvmetadatacopies __attribute((unused)),
-                    uint64_t pvmetadatasize __attribute((unused)), struct dm_list *mdas __attribute((unused)),
-                    struct physical_volume *pv, struct volume_group *vg __attribute((unused)))
+                            uint64_t pe_start, uint32_t extent_count,
+                            uint32_t extent_size,
+                            unsigned long data_alignment __attribute((unused)),
+                            unsigned long data_alignment_offset __attribute((unused)),
+                            int pvmetadatacopies __attribute((unused)),
+                            uint64_t pvmetadatasize __attribute((unused)),
+                            unsigned metadataignore __attribute((unused)),
+                            struct dm_list *mdas __attribute((unused)),
+                            struct physical_volume *pv, struct volume_group *vg __attribute((unused)))
 {
        if (pv->size > MAX_PV_SIZE)
                pv->size--;
index 32b8f4ed8655af7e53c1ccf1dfca4a086513b172..a0eb8278e70e1220e1665fff5aa711a06b36ce29 100644 (file)
@@ -196,6 +196,7 @@ static int _pool_pv_setup(const struct format_type *fmt __attribute((unused)),
                          unsigned long data_alignment_offset __attribute((unused)),
                          int pvmetadatacopies __attribute((unused)),
                          uint64_t pvmetadatasize __attribute((unused)),
+                         unsigned metadataignore __attribute((unused)),
                          struct dm_list *mdas __attribute((unused)),
                          struct physical_volume *pv __attribute((unused)),
                          struct volume_group *vg __attribute((unused)))
index e45d9d2176cf7f6e0761bbb87c4a957580a390be..d8272046dcf22c7b4e2f89d02dc8dfd0a92d8668 100644 (file)
@@ -327,7 +327,8 @@ int backup_restore_vg(struct cmd_context *cmd, struct volume_group *vg)
                }
                if (!vg->fid->fmt->ops->
                    pv_setup(vg->fid->fmt, UINT64_C(0), 0, 0, 0, 0, 0UL,
-                            UINT64_C(0), &vg->fid->metadata_areas_in_use, pv, vg)) {
+                            UINT64_C(0), 0,
+                            &vg->fid->metadata_areas_in_use, pv, vg)) {
                        log_error("Format-specific setup for %s failed",
                                  pv_dev_name(pv));
                        return 0;
index c6594af485650c5b256424733c196ae80f3651b4..7ff5f85820f36a03326ec80ad8d45e36fab67fee 100644 (file)
@@ -1248,8 +1248,8 @@ static int _text_scan(const struct format_type *fmt)
    Always have an mda between end-of-label and pe_align() boundary */
 static int _mda_setup(const struct format_type *fmt,
                      uint64_t pe_start, uint64_t pe_end,
-                     int pvmetadatacopies,
-                     uint64_t pvmetadatasize, struct dm_list *mdas,
+                     int pvmetadatacopies, uint64_t pvmetadatasize,
+                     unsigned metadataignore, struct dm_list *mdas,
                      struct physical_volume *pv,
                      struct volume_group *vg __attribute((unused)))
 {
@@ -1337,7 +1337,7 @@ static int _mda_setup(const struct format_type *fmt,
        /* FIXME If creating new mdas, wipe them! */
        if (mda_size1) {
                if (!add_mda(fmt, fmt->cmd->mem, mdas, pv->dev, start1,
-                            mda_size1, 0))
+                            mda_size1, metadataignore))
                        return 0;
 
                if (!dev_set((struct device *) pv->dev, start1,
@@ -1384,7 +1384,7 @@ static int _mda_setup(const struct format_type *fmt,
 
        if (mda_size2) {
                if (!add_mda(fmt, fmt->cmd->mem, mdas, pv->dev, start2,
-                            mda_size2, 0)) return 0;
+                            mda_size2, metadataignore)) return 0;
                if (!dev_set(pv->dev, start2,
                             (size_t) (mda_size1 >
                                       wipe_size ? : mda_size1), 0)) {
@@ -1766,12 +1766,12 @@ static struct metadata_area_ops _metadata_text_raw_ops = {
  *   setting of pv->pe_start to .pv_write
  */
 static int _text_pv_setup(const struct format_type *fmt,
-                    uint64_t pe_start, uint32_t extent_count,
-                    uint32_t extent_size, unsigned long data_alignment,
-                    unsigned long data_alignment_offset,
-                    int pvmetadatacopies,
-                    uint64_t pvmetadatasize, struct dm_list *mdas,
-                    struct physical_volume *pv, struct volume_group *vg)
+                         uint64_t pe_start, uint32_t extent_count,
+                         uint32_t extent_size, unsigned long data_alignment,
+                         unsigned long data_alignment_offset,
+                         int pvmetadatacopies, uint64_t pvmetadatasize,
+                         unsigned metadataignore, struct dm_list *mdas,
+                         struct physical_volume *pv, struct volume_group *vg)
 {
        struct metadata_area *mda, *mda_new, *mda2;
        struct mda_context *mdac, *mdac2;
@@ -1894,7 +1894,7 @@ static int _text_pv_setup(const struct format_type *fmt,
                if (extent_count)
                        pe_end = pe_start + extent_count * extent_size - 1;
                if (!_mda_setup(fmt, pe_start, pe_end, pvmetadatacopies,
-                               pvmetadatasize, mdas, pv, vg))
+                               pvmetadatasize, metadataignore,  mdas, pv, vg))
                        return_0;
        }
 
index 7824005815b3491fbf4ebf380f8d7047b16d155f..a72a6bfd601b5ee1e487382ffc38a1c2c2cece59 100644 (file)
@@ -522,16 +522,17 @@ uint32_t vg_read_error(struct volume_group *vg_handle);
 /* pe_start and pe_end relate to any existing data so that new metadata
 * areas can avoid overlap */
 struct physical_volume *pv_create(const struct cmd_context *cmd,
-                     struct device *dev,
-                     struct id *id,
-                     uint64_t size,
-                     unsigned long data_alignment,
-                     unsigned long data_alignment_offset,
-                     uint64_t pe_start,
-                     uint32_t existing_extent_count,
-                     uint32_t existing_extent_size,
-                     int pvmetadatacopies,
-                     uint64_t pvmetadatasize, struct dm_list *mdas);
+                                 struct device *dev,
+                                 struct id *id,
+                                 uint64_t size,
+                                 unsigned long data_alignment,
+                                 unsigned long data_alignment_offset,
+                                 uint64_t pe_start,
+                                 uint32_t existing_extent_count,
+                                 uint32_t existing_extent_size,
+                                 int pvmetadatacopies, uint64_t pvmetadatasize,
+                                 unsigned metadataignore,
+                                 struct dm_list *mdas);
 int pv_resize(struct physical_volume *pv, struct volume_group *vg,
              uint32_t new_pe_count);
 int pv_analyze(struct cmd_context *cmd, const char *pv_name,
index 2913ea2d14d4588cba2aeefd2eb89151006531e5..b0958097081836402d77198bf008697c46d79c98 100644 (file)
@@ -234,7 +234,7 @@ int add_pv_to_vg(struct volume_group *vg, const char *pv_name,
 
        if (!fid->fmt->ops->pv_setup(fid->fmt, UINT64_C(0), 0,
                                     vg->extent_size, 0, 0, 0UL, UINT64_C(0),
-                                    mdas, pv, vg)) {
+                                    0, mdas, pv, vg)) {
                log_error("Format-specific setup of physical volume '%s' "
                          "failed.", pv_name);
                return 0;
@@ -1684,7 +1684,6 @@ struct physical_volume * pvcreate_single(struct cmd_context *cmd,
        struct dm_list mdas;
        struct pvcreate_params default_pp;
        char buffer[64] __attribute((aligned(8)));
-       struct metadata_area *mda;
 
        pvcreate_params_set_defaults(&default_pp);
        if (!pp)
@@ -1718,8 +1717,8 @@ struct physical_volume * pvcreate_single(struct cmd_context *cmd,
        if (!(pv = pv_create(cmd, dev, pp->idp, pp->size,
                             pp->data_alignment, pp->data_alignment_offset,
                             pp->pe_start, pp->extent_count, pp->extent_size,
-                            pp->pvmetadatacopies,
-                            pp->pvmetadatasize,&mdas))) {
+                            pp->pvmetadatacopies, pp->pvmetadatasize,
+                            pp->metadataignore, &mdas))) {
                log_error("Failed to setup physical volume \"%s\"", pv_name);
                goto error;
        }
@@ -1751,10 +1750,6 @@ struct physical_volume * pvcreate_single(struct cmd_context *cmd,
        log_very_verbose("Writing physical volume data to disk \"%s\"",
                         pv_name);
 
-       if (pp->metadataignore)
-               dm_list_iterate_items(mda, &mdas)
-                       mda_set_ignored(mda, 1);
-
        if (!(pv_write(cmd, pv, &mdas, pp->labelsector))) {
                log_error("Failed to write physical volume \"%s\"", pv_name);
                goto error;
@@ -1827,8 +1822,8 @@ struct physical_volume *pv_create(const struct cmd_context *cmd,
                                  uint64_t pe_start,
                                  uint32_t existing_extent_count,
                                  uint32_t existing_extent_size,
-                                 int pvmetadatacopies,
-                                 uint64_t pvmetadatasize, struct dm_list *mdas)
+                                 int pvmetadatacopies, uint64_t pvmetadatasize,
+                                 unsigned metadataignore, struct dm_list *mdas)
 {
        const struct format_type *fmt = cmd->fmt;
        struct dm_pool *mem = fmt->cmd->mem;
@@ -1877,8 +1872,8 @@ struct physical_volume *pv_create(const struct cmd_context *cmd,
        if (!fmt->ops->pv_setup(fmt, pe_start, existing_extent_count,
                                existing_extent_size, data_alignment,
                                data_alignment_offset,
-                               pvmetadatacopies, pvmetadatasize, mdas,
-                               pv, NULL)) {
+                               pvmetadatacopies, pvmetadatasize,
+                               metadataignore, mdas, pv, NULL)) {
                log_error("%s: Format-specific setup of physical volume "
                          "failed.", pv_dev_name(pv));
                goto bad;
index 80701b53a122fe0422a8fdaadc31066662092db9..25399c7d950be4f449aee040ac51a5ec8951e0eb 100644 (file)
@@ -244,8 +244,8 @@ struct format_handler {
                         uint64_t pe_start, uint32_t extent_count,
                         uint32_t extent_size, unsigned long data_alignment,
                         unsigned long data_alignment_offset,
-                        int pvmetadatacopies,
-                        uint64_t pvmetadatasize, struct dm_list * mdas,
+                        int pvmetadatacopies, uint64_t pvmetadatasize,
+                        unsigned metadataignore, struct dm_list * mdas,
                         struct physical_volume * pv, struct volume_group * vg);
 
        /*
index 288ccd7e1d308b1b45a7412e7b83f5ac4007d05a..1808454a46e24cfd73d7813c2b137d13dd9534b9 100644 (file)
@@ -127,7 +127,7 @@ static int vgconvert_single(struct cmd_context *cmd, const char *vg_name,
                                     &existing_pv->id, size, 0, 0,
                                     pe_start, pv_pe_count(existing_pv),
                                     pv_pe_size(existing_pv), pvmetadatacopies,
-                                    pvmetadatasize, &mdas))) {
+                                    pvmetadatasize, 0, &mdas))) {
                        log_error("Failed to setup physical volume \"%s\"",
                                  pv_dev_name(existing_pv));
                        if (change_made)
This page took 0.05476 seconds and 5 git commands to generate.