]> sourceware.org Git - lvm2.git/commitdiff
Add new pv_remove_metadata_area interface function.
authorPeter Rajnoha <prajnoha@redhat.com>
Mon, 21 Feb 2011 12:17:54 +0000 (12:17 +0000)
committerPeter Rajnoha <prajnoha@redhat.com>
Mon, 21 Feb 2011 12:17:54 +0000 (12:17 +0000)
lib/format_text/format-text.c
lib/format_text/format-text.h
lib/metadata/metadata.h

index e11ab52c39d5bfbb0504bfb2077959c46f0d41fd..c50f398a931a4e8cd1bb7d4b9a8150126e78cff2 100644 (file)
@@ -2272,6 +2272,29 @@ bad:
        return 0;
 }
 
+int remove_metadata_area_from_pv(struct physical_volume *pv,
+                                unsigned mda_index)
+{
+       if (mda_index >= FMT_TEXT_MAX_MDAS_PER_PV) {
+               log_error(INTERNAL_ERROR "can't remove metadata area with "
+                                        "index %u from PV %s. Metadata "
+                                        "layou not supported by %s format.",
+                                         mda_index, dev_name(pv->dev),
+                                         pv->fmt->name);
+               return 0;
+       }
+
+       return fid_remove_mda(pv->fid, NULL, (const char *) &pv->id,
+                             ID_LEN, mda_index);
+}
+
+static int _text_pv_remove_metadata_area(const struct format_type *fmt,
+                                        struct physical_volume *pv,
+                                        unsigned mda_index)
+{
+       return remove_metadata_area_from_pv(pv, mda_index);
+}
+
 /* NULL vgname means use only the supplied context e.g. an archive file */
 static struct format_instance *_text_create_text_instance(const struct format_type *fmt,
                                                           const struct format_instance_ctx *fic)
@@ -2347,6 +2370,7 @@ static struct format_handler _text_handler = {
        .pv_read = _text_pv_read,
        .pv_setup = _text_pv_setup,
        .pv_add_metadata_area = _text_pv_add_metadata_area,
+       .pv_remove_metadata_area = _text_pv_remove_metadata_area,
        .pv_write = _text_pv_write,
        .vg_setup = _text_vg_setup,
        .lv_setup = _text_lv_setup,
index f65be745d9e2510c6b77f9a687958cf718cf3622..694b5c1b4bd0721be20395574e8636b1d056a1f4 100644 (file)
@@ -61,6 +61,8 @@ int add_metadata_area_to_pv(struct physical_volume *pv,
                            uint64_t mda_start,
                            uint64_t mda_size,
                            unsigned mda_ignored);
+int remove_metadata_area_from_pv(struct physical_volume *pv,
+                                unsigned mda_index);
 int add_mda(const struct format_type *fmt, struct dm_pool *mem, struct dm_list *mdas,
            struct device *dev, uint64_t start, uint64_t size, unsigned ignored);
 void del_mdas(struct dm_list *mdas);
index e112007a08987fa49268d102ac18d3bc26bcedea..beb6834f60f11c5c9263c5b28f198987ec98eb92 100644 (file)
@@ -277,6 +277,13 @@ struct format_handler {
                                     uint64_t metadata_size,
                                     unsigned metadata_ignored);
 
+       /*
+        * Remove metadata area from a PV. Changes will take effect on pv_write.
+        */
+       int (*pv_remove_metadata_area) (const struct format_type *fmt,
+                                       struct physical_volume *pv,
+                                       unsigned metadata_index);
+
        /*
         * Write a PV structure to disk. Fails if the PV is in a VG ie
         * pv->vg_name must be a valid orphan VG name
This page took 0.035172 seconds and 5 git commands to generate.