]> sourceware.org Git - lvm2.git/commitdiff
Store transaction_id with created thin lv
authorZdenek Kabelac <zkabelac@redhat.com>
Fri, 21 Oct 2011 11:38:35 +0000 (11:38 +0000)
committerZdenek Kabelac <zkabelac@redhat.com>
Fri, 21 Oct 2011 11:38:35 +0000 (11:38 +0000)
So we know the creation history and this should be useful with vgcfgrestore.

lib/metadata/lv_manip.c
lib/metadata/metadata-exported.h
lib/thin/thin.c

index e0681795faf379c89a4a7a019161dd4b3e16af14..8ca1715e2d8363f972a5b38f422b66245a95ac72 100644 (file)
@@ -253,8 +253,11 @@ struct lv_segment *alloc_lv_segment(struct dm_pool *mem,
        dm_list_init(&seg->tags);
        dm_list_init(&seg->thin_messages);
 
-       if (thin_pool_lv && !attach_pool_lv(seg, thin_pool_lv))
-               return_NULL;
+       if (thin_pool_lv) {
+               seg->transaction_id = first_seg(thin_pool_lv)->transaction_id;
+               if (!attach_pool_lv(seg, thin_pool_lv))
+                       return_NULL;
+       }
 
        if (log_lv && !attach_mirror_log(seg, log_lv))
                return_NULL;
index baee9ee9e0fdf4a0516d6f9b5064fcfb25c2be3e..c65fc8466c534f47d57f5a982bfab8a8cbafcf24 100644 (file)
@@ -343,7 +343,7 @@ struct lv_segment {
        struct lv_segment_area *areas;
        struct lv_segment_area *meta_areas;     /* For RAID */
        struct logical_volume *pool_metadata_lv;/* For thin_pool */
-       uint64_t transaction_id;                /* For thin_pool */
+       uint64_t transaction_id;                /* For thin_pool, thin */
        uint64_t low_water_mark;                /* For thin_pool */
        uint32_t data_block_size;               /* For thin_pool, 128..2097152 */
        unsigned zero_new_blocks;               /* For thin_pool */
index 3daaf756afbfe4a4da5eec7e935e443776105b97..cbea944350cc841ad20e40039078a38d06d1816e 100644 (file)
@@ -310,6 +310,9 @@ static int _thin_text_import(struct lv_segment *seg,
        if (!attach_pool_lv(seg, pool_lv))
                return_0;
 
+       if (!dm_config_get_uint64(sn, "transaction_id", &seg->transaction_id))
+               return SEG_LOG_ERROR("Could not read transaction_id for");
+
        if (dm_config_has_node(sn, "origin")) {
                if (!dm_config_get_str(sn, "origin", &lv_name))
                        return SEG_LOG_ERROR("Origin must be a string in");
@@ -331,6 +334,7 @@ static int _thin_text_import(struct lv_segment *seg,
 static int _thin_text_export(const struct lv_segment *seg, struct formatter *f)
 {
        outf(f, "thin_pool = \"%s\"", seg->pool_lv->name);
+       outf(f, "transaction_id = %" PRIu64, seg->transaction_id);
        outf(f, "device_id = %d", seg->device_id);
 
        if (seg->origin)
This page took 0.043291 seconds and 5 git commands to generate.