1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-23 21:35:29 +03:00

Make vg->mda_copies persistent in on disk vg metadata.

This patch adds the ability to read/write the vg->mda_copies values
from/to the vg metadata.

If we read the VG metadata and this field does not exist, we set
mda_copies to the default value of 0.  Later in the code, we use
this special '0' value to indicate a disable of metadata balancing.
This should preserve existing LVM behavior and ensure metadata balancing
can be turned off should the need arise.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
This commit is contained in:
Dave Wysochanski 2010-06-28 20:37:10 +00:00
parent 12910a5a29
commit 36d07a5cea
2 changed files with 6 additions and 0 deletions

View File

@ -397,6 +397,7 @@ static int _print_vg(struct formatter *f, struct volume_group *vg)
outf(f, "allocation_policy = \"%s\"", outf(f, "allocation_policy = \"%s\"",
get_alloc_string(vg->alloc)); get_alloc_string(vg->alloc));
} }
outf(f, "metadata_copies = %u", vg->mda_copies);
return 1; return 1;
} }

View File

@ -23,6 +23,7 @@
#include "pv_alloc.h" #include "pv_alloc.h"
#include "segtype.h" #include "segtype.h"
#include "text_import.h" #include "text_import.h"
#include "defaults.h"
typedef int (*section_fn) (struct format_instance * fid, struct dm_pool * mem, typedef int (*section_fn) (struct format_instance * fid, struct dm_pool * mem,
struct volume_group * vg, struct config_node * pvn, struct volume_group * vg, struct config_node * pvn,
@ -745,6 +746,10 @@ static struct volume_group *_read_vg(struct format_instance *fid,
return_0; return_0;
} }
if (!_read_uint32(vgn, "metadata_copies", &vg->mda_copies)) {
vg->mda_copies = DEFAULT_VGMETADATACOPIES;
}
/* /*
* The pv hash memorises the pv section names -> pv * The pv hash memorises the pv section names -> pv
* structures. * structures.