char vgname[NAME_LEN+1];
char id_str[ID_STR_SIZE];
char id_first[ID_STR_SIZE];
+ char latest_vgname[NAME_LEN+1];
+ char latest_id_str[ID_STR_SIZE];
char *text_buf;
char *p;
uint32_t buf_off; /* offset with buf which begins with mda_header */
uint32_t buf_off_first = 0;
uint32_t seqno;
+ uint32_t latest_seqno;
uint32_t crc;
uint64_t text_size;
uint64_t meta_size;
+ uint64_t latest_offset;
int metadata_offset_found = 0;
int multiple_vgs = 0;
int bad_end;
}
}
+ memset(latest_vgname, 0, sizeof(latest_vgname));
+ memset(latest_id_str, 0, sizeof(latest_id_str));
+ latest_offset = 0;
+ latest_seqno = 0;
+
/*
* If metadata has not wrapped, and the metadata area beginning
* has not been damaged, the text area will begin with vgname {.
(unsigned long long)text_size,
crc, vgname, seqno, id_str);
+ if (!latest_seqno || (seqno > latest_seqno)) {
+ latest_seqno = seqno;
+ latest_offset = mda_offset + buf_off;
+ memcpy(latest_vgname, vgname, NAME_LEN);
+ memcpy(latest_id_str, id_str, ID_STR_SIZE);
+ }
+
/*
* save the location of the first metadata we've found so
* we know where to stop after wrapping buf.
_copy_line(str1, line, &len);
log_print("%s", line);
}
- if ((str2 = strstr(str1, "creation_time = "))) {
+ if (str1 && (str2 = strstr(str1, "creation_time = "))) {
memset(line, 0, sizeof(line));
_copy_line(str2, line, &len);
log_print("%s\n", line);
if (multiple_vgs)
log_warn("WARNING: metadata from multiple VGs was found.");
+ if (!set->metadata_offset_set)
+ log_print("Most recent metadata found at %llu seqno %u for vg %s id %s",
+ (unsigned long long)latest_offset, latest_seqno,
+ latest_vgname, latest_id_str);
+
+
if (fp) {
if (fflush(fp))
stack;