]> sourceware.org Git - lvm2.git/commitdiff
archiver: do not archive vg more then once
authorZdenek Kabelac <zkabelac@redhat.com>
Sun, 30 Jun 2013 16:01:19 +0000 (18:01 +0200)
committerZdenek Kabelac <zkabelac@redhat.com>
Mon, 1 Jul 2013 21:09:26 +0000 (23:09 +0200)
Do not keep multiple archives for the executed command.
Reuse the ALLOCATABLE_PV from pv status for
ARCHIVED_VG vg status. Mark VG with the bit with the
first archivation.

WHATS_NEW
lib/format_text/archiver.c
lib/format_text/flags.c
lib/metadata/metadata-exported.h

index c24f576d4130531691faa153ace662d3864ecb5e..b50112180b5e1735a7a9b3628298b2fa64fa4482 100644 (file)
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
 Version 2.02.99 - 
 ===================================
+  Avoid creation of multiple archives for one command.
   Use mirror_segtype_default if type not specified for linear->mirror upconvert.
   Fix use of too big chunks of memory when communication with lvmetad.
   Fix vgcfgrestore crash when specified incorrect vg name.
index 8599e3b28e32d8ba94905bf60d0448a56ddb8a40..c012c8fd7291f0598e9f88925e1ab2963fca02dc 100644 (file)
@@ -110,6 +110,9 @@ static int __archive(struct volume_group *vg)
 
 int archive(struct volume_group *vg)
 {
+       if (vg_is_archived(vg))
+               return 1; /* VG has been already archived */
+
        if (!vg->cmd->archive_params->enabled || !vg->cmd->archive_params->dir)
                return 1;
 
@@ -134,6 +137,8 @@ int archive(struct volume_group *vg)
                return 0;
        }
 
+       vg->status |= ARCHIVED_VG;
+
        return 1;
 }
 
index 28a7dc4fda2a9a85026d19b240e17e18636fa293..cbccdfdd0890f02fdccc809cdfa55dfa1a0cfbb3 100644 (file)
@@ -38,6 +38,7 @@ static const struct flag _vg_flags[] = {
        {SHARED, "SHARED", STATUS_FLAG},
        {PARTIAL_VG, NULL, 0},
        {PRECOMMITTED, NULL, 0},
+       {ARCHIVED_VG, NULL, 0},
        {0, NULL, 0}
 };
 
index 6fa0c5b5c05eccb2857ced2d004627f11e114dfa..98216d4d9b392432cfb748e41b42641b1f9623f2 100644 (file)
@@ -48,6 +48,7 @@
 
 /* May any free extents on this PV be used or must they be left free? */
 #define ALLOCATABLE_PV         UINT64_C(0x00000008)    /* PV */
+#define ARCHIVED_VG            ALLOCATABLE_PV          /* VG, reuse same bit */
 
 //#define SPINDOWN_LV          UINT64_C(0x00000010)    /* LV */
 //#define BADBLOCK_ON          UINT64_C(0x00000020)    /* LV */
 #define VGMETADATACOPIES_ALL UINT32_MAX
 #define VGMETADATACOPIES_UNMANAGED 0
 
+#define vg_is_archived(vg)     (((vg)->status & ARCHIVED_VG) ? 1 : 0)
+
 #define lv_is_external_origin(lv)      (((lv)->external_count > 0) ? 1 : 0)
 #define lv_is_thin_volume(lv)  ((lv)->status & THIN_VOLUME ? 1 : 0)
 #define lv_is_thin_pool(lv)    ((lv)->status & THIN_POOL ? 1 : 0)
This page took 0.050618 seconds and 5 git commands to generate.