1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

archiver: do not archive vg more then once

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.
This commit is contained in:
Zdenek Kabelac 2013-06-30 18:01:19 +02:00
parent afea2bf598
commit e30028004b
4 changed files with 10 additions and 0 deletions

View File

@ -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.

View 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;
}

View 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}
};

View 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 */
@ -140,6 +141,8 @@
#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)