mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
pvck: dump headers_only to skip metadata text
pvck --dump headers reads the metadata text area to compute the text metadata checksum to compare with the mda_header checksum. The new header_only will skip reading the metadata text and not validate the mda_header checksum.
This commit is contained in:
parent
be61bd6ff5
commit
5410dd5441
@ -1092,6 +1092,7 @@ int repairtype_arg(struct cmd_context *cmd, struct arg_values *av)
|
||||
int dumptype_arg(struct cmd_context *cmd, struct arg_values *av)
|
||||
{
|
||||
if (!strcmp(av->value, "headers") ||
|
||||
!strcmp(av->value, "headers_only") ||
|
||||
!strcmp(av->value, "metadata") ||
|
||||
!strcmp(av->value, "metadata_all") ||
|
||||
!strcmp(av->value, "metadata_search") ||
|
||||
|
12
tools/pvck.c
12
tools/pvck.c
@ -24,6 +24,7 @@
|
||||
|
||||
#define PRINT_CURRENT 1
|
||||
#define PRINT_ALL 2
|
||||
#define PRINT_NONE 3
|
||||
|
||||
#define ID_STR_SIZE 40 /* uuid formatted with dashes is 38 chars */
|
||||
|
||||
@ -1388,6 +1389,7 @@ static int _dump_headers(struct cmd_context *cmd, const char *dump, struct setti
|
||||
{
|
||||
uint64_t mda1_offset = 0, mda1_size = 0, mda2_offset = 0, mda2_size = 0; /* bytes */
|
||||
uint32_t mda1_checksum, mda2_checksum;
|
||||
int print_metadata = 0;
|
||||
int mda_count = 0;
|
||||
int bad = 0;
|
||||
|
||||
@ -1400,14 +1402,17 @@ static int _dump_headers(struct cmd_context *cmd, const char *dump, struct setti
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!strcmp(dump, "headers_only"))
|
||||
print_metadata = PRINT_NONE;
|
||||
|
||||
/*
|
||||
* The first mda is always 4096 bytes from the start of the device.
|
||||
*/
|
||||
if (!_dump_mda_header(cmd, set, 1, 0, 0, NULL, dev, def, 4096, mda1_size, &mda1_checksum, NULL))
|
||||
if (!_dump_mda_header(cmd, set, 1, print_metadata, 0, NULL, dev, def, 4096, mda1_size, &mda1_checksum, NULL))
|
||||
bad++;
|
||||
|
||||
if (mda2_offset) {
|
||||
if (!_dump_mda_header(cmd, set, 1, 0, 0, NULL, dev, def, mda2_offset, mda2_size, &mda2_checksum, NULL))
|
||||
if (!_dump_mda_header(cmd, set, 1, print_metadata, 0, NULL, dev, def, mda2_offset, mda2_size, &mda2_checksum, NULL))
|
||||
bad++;
|
||||
|
||||
/* This probably indicates that one was committed and the other not. */
|
||||
@ -3083,6 +3088,9 @@ int pvck(struct cmd_context *cmd, int argc, char **argv)
|
||||
else if (!strcmp(dump, "headers"))
|
||||
ret = _dump_headers(cmd, dump, &set, labelsector, dev, def);
|
||||
|
||||
else if (!strcmp(dump, "headers_only"))
|
||||
ret = _dump_headers(cmd, dump, &set, labelsector, dev, def);
|
||||
|
||||
else if (!strcmp(dump, "backup_to_raw")) {
|
||||
ret = _dump_backup_to_raw(cmd, &set);
|
||||
|
||||
|
@ -142,7 +142,7 @@ val(reportformat_VAL, reportformat_arg, "ReportFmt", "basic|json")
|
||||
val(configreport_VAL, configreport_arg, "ConfigReport", "log|vg|lv|pv|pvseg|seg")
|
||||
val(configtype_VAL, configtype_arg, "ConfigType", "current|default|diff|full|list|missing|new|profilable|profilable-command|profilable-metadata")
|
||||
val(repairtype_VAL, repairtype_arg, "RepairType", "pv_header|metadata|label_header")
|
||||
val(dumptype_VAL, dumptype_arg, "DumpType", "headers|metadata|metadata_all|metadata_search")
|
||||
val(dumptype_VAL, dumptype_arg, "DumpType", "headers|headers_only|metadata|metadata_all|metadata_search")
|
||||
|
||||
/* this should always be last */
|
||||
val(VAL_COUNT, NULL, NULL, NULL)
|
||||
|
Loading…
Reference in New Issue
Block a user