]> sourceware.org Git - lvm2.git/commitdiff
lvmcache/lvmetad: cache PV extension flags
authorPeter Rajnoha <prajnoha@redhat.com>
Mon, 9 Mar 2015 11:52:07 +0000 (12:52 +0100)
committerPeter Rajnoha <prajnoha@redhat.com>
Mon, 15 Feb 2016 11:44:46 +0000 (12:44 +0100)
Store PV extension flags in lvmcache/lvmetad for use throughout the code.

lib/cache/lvmcache.c
lib/cache/lvmcache.h
lib/cache/lvmetad.c
lib/format1/lvm1-label.c
lib/format_pool/disk_rep.c
lib/format_text/text_label.c

index 4a4b53f90d6260ddfc589b699a398cc8b5744aa9..32186196336e1370e223762de70d6ea9ce07df9a 100644 (file)
@@ -42,6 +42,7 @@ struct lvmcache_info {
        const struct format_type *fmt;
        struct device *dev;
        uint64_t device_size;   /* Bytes */
+       uint32_t ext_flags;     /* Extension flags */
        uint32_t status;
 };
 
@@ -2366,6 +2367,14 @@ struct device *lvmcache_device(struct lvmcache_info *info) {
        return info->dev;
 }
 
+void lvmcache_set_ext_flags(struct lvmcache_info *info, uint32_t flags) {
+       info->ext_flags = flags;
+}
+
+uint32_t lvmcache_ext_flags(struct lvmcache_info *info) {
+       return info->ext_flags;
+}
+
 int lvmcache_is_orphan(struct lvmcache_info *info) {
        if (!info->vginfo)
                return 1; /* FIXME? */
index 371ac8eb88d2bab6a4be54c31556ee47ab0cd1ae..7de4e145091a042abbe782c3d8fedcccba564400 100644 (file)
@@ -156,6 +156,9 @@ int lvmcache_add_mda(struct lvmcache_info *info, struct device *dev,
 int lvmcache_add_da(struct lvmcache_info *info, uint64_t start, uint64_t size);
 int lvmcache_add_ba(struct lvmcache_info *info, uint64_t start, uint64_t size);
 
+void lvmcache_set_ext_flags(struct lvmcache_info *info, uint32_t flags);
+uint32_t lvmcache_ext_flags(struct lvmcache_info *info);
+
 const struct format_type *lvmcache_fmt(struct lvmcache_info *info);
 struct label *lvmcache_get_label(struct lvmcache_info *info);
 
index 90ff4cb5061209d1acfcfb8f5cd2d9506bac91b0..70ab44f95e967e10ae18256cc323fc2ab6dffb1f 100644 (file)
@@ -368,6 +368,7 @@ static int _pv_populate_lvmcache(struct cmd_context *cmd,
        dev_t devt = dm_config_find_int(cn->child, "device", 0);
        uint64_t devsize = dm_config_find_int64(cn->child, "dev_size", 0),
                 label_sector = dm_config_find_int64(cn->child, "label_sector", 0);
+       uint32_t ext_flags = (uint32_t) dm_config_find_int64(cn->child, "ext_flags", 0);
 
        if (!fmt && fmt_name)
                fmt = get_format_by_name(cmd, fmt_name);
@@ -478,6 +479,9 @@ static int _pv_populate_lvmcache(struct cmd_context *cmd,
        }
 
        lvmcache_set_preferred_duplicates((const char *)&vgid);
+
+       lvmcache_set_ext_flags(info, ext_flags);
+
        return 1;
 }
 
@@ -1047,6 +1051,7 @@ int lvmetad_pv_found(const struct id *pvid, struct device *dev, const struct for
                               "format = %s", fmt->name,
                               "label_sector = %"PRId64, (int64_t) label_sector,
                               "id = %s", uuid,
+                              "ext_flags = %"PRId64, (int64_t) lvmcache_ext_flags(info),
                               NULL))
        {
                dm_config_destroy(pvmeta);
index b600bd712d294df1ffa6cbb36daf3b412725e736..903a4308a897de61db9ba9a5757868684e45970b 100644 (file)
@@ -80,6 +80,7 @@ static int _lvm1_read(struct labeller *l, struct device *dev, void *buf,
        *label = lvmcache_get_label(info);
 
        lvmcache_set_device_size(info, ((uint64_t)xlate32(pvd->pv_size)) << SECTOR_SHIFT);
+       lvmcache_set_ext_flags(info, 0);
        lvmcache_del_mdas(info);
        lvmcache_del_bas(info);
        lvmcache_make_valid(info);
index 688c521908512a3b657dd99517f4d29849e513bf..6d8787ef8e3b92858a2ef6921f434fee0fb47dbf 100644 (file)
@@ -104,6 +104,7 @@ int read_pool_label(struct pool_list *pl, struct labeller *l,
                *label = lvmcache_get_label(info);
 
        lvmcache_set_device_size(info, ((uint64_t)xlate32_be(pd->pl_blocks)) << SECTOR_SHIFT);
+       lvmcache_set_ext_flags(info, 0);
        lvmcache_del_mdas(info);
        lvmcache_del_bas(info);
        lvmcache_make_valid(info);
index 2865226ba5f5d3991aa36cab27c505ee170cd9c2..c62cf5ab30c40f7f73e57502dbdb9b67465bee44 100644 (file)
@@ -124,7 +124,7 @@ static int _text_write(struct label *label, void *buf)
         */
        pvhdr_ext = (struct pv_header_extension *) ((char *) baton.pvh_dlocn_xl);
        pvhdr_ext->version = xlate32(PV_HEADER_EXTENSION_VSN);
-       pvhdr_ext->flags = 0; /* no flags yet */
+       pvhdr_ext->flags = xlate32(lvmcache_ext_flags(info));
 
        /* List of bootloader area locations */
        baton.pvh_dlocn_xl = &pvhdr_ext->bootloader_areas_xl[0];
@@ -421,6 +421,9 @@ static int _text_read(struct labeller *l, struct device *dev, void *buf,
        log_debug_metadata("%s: PV header extension version %" PRIu32 " found",
                           dev_name(dev), ext_version);
 
+       /* Extension flags */
+       lvmcache_set_ext_flags(info, xlate32(pvhdr_ext->flags));
+
        /* Bootloader areas */
        dlocn_xl = pvhdr_ext->bootloader_areas_xl;
        while ((offset = xlate64(dlocn_xl->offset))) {
This page took 0.208609 seconds and 5 git commands to generate.