Assemble: add --update=no-bitmap
This allows an array with a corrupt internal bitmap to be assembled without the bitmap. Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
parent
321e575910
commit
1f9476aaf8
|
@ -921,6 +921,7 @@ argument given to this flag can be one of
|
||||||
.BR resync ,
|
.BR resync ,
|
||||||
.BR byteorder ,
|
.BR byteorder ,
|
||||||
.BR devicesize ,
|
.BR devicesize ,
|
||||||
|
.BR no\-bitmap ,
|
||||||
or
|
or
|
||||||
.BR super\-minor .
|
.BR super\-minor .
|
||||||
|
|
||||||
|
@ -1003,7 +1004,7 @@ counts of total, working, active, failed, and spare devices.
|
||||||
|
|
||||||
The
|
The
|
||||||
.B devicesize
|
.B devicesize
|
||||||
will rarely be of use. It applies to version 1.1 and 1.2 metadata
|
option will rarely be of use. It applies to version 1.1 and 1.2 metadata
|
||||||
only (where the metadata is at the start of the device) and is only
|
only (where the metadata is at the start of the device) and is only
|
||||||
useful when the component device has changed size (typically become
|
useful when the component device has changed size (typically become
|
||||||
larger). The version 1 metadata records the amount of the device that
|
larger). The version 1 metadata records the amount of the device that
|
||||||
|
@ -1017,6 +1018,12 @@ This will cause
|
||||||
to determine the maximum usable amount of space on each device and
|
to determine the maximum usable amount of space on each device and
|
||||||
update the relevant field in the metadata.
|
update the relevant field in the metadata.
|
||||||
|
|
||||||
|
The
|
||||||
|
.B no\-bitmap
|
||||||
|
option can be used when an array has an internal bitmap which is
|
||||||
|
corrupt in some way so that assembling the array normally fails. It
|
||||||
|
will cause any internal bitmap to be ignored.
|
||||||
|
|
||||||
.ig
|
.ig
|
||||||
.TP
|
.TP
|
||||||
.B \-\-auto\-update\-homehost
|
.B \-\-auto\-update\-homehost
|
||||||
|
|
5
mdadm.c
5
mdadm.c
|
@ -660,6 +660,8 @@ int main(int argc, char *argv[])
|
||||||
continue;
|
continue;
|
||||||
if (strcmp(update, "devicesize")==0)
|
if (strcmp(update, "devicesize")==0)
|
||||||
continue;
|
continue;
|
||||||
|
if (strcmp(update, "no-bitmap")==0)
|
||||||
|
continue;
|
||||||
if (strcmp(update, "byteorder")==0) {
|
if (strcmp(update, "byteorder")==0) {
|
||||||
if (ss) {
|
if (ss) {
|
||||||
fprintf(stderr, Name ": must not set metadata type with --update=byteorder.\n");
|
fprintf(stderr, Name ": must not set metadata type with --update=byteorder.\n");
|
||||||
|
@ -686,7 +688,8 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
fprintf(outf, "Valid --update options are:\n"
|
fprintf(outf, "Valid --update options are:\n"
|
||||||
" 'sparc2.2', 'super-minor', 'uuid', 'name', 'resync',\n"
|
" 'sparc2.2', 'super-minor', 'uuid', 'name', 'resync',\n"
|
||||||
" 'summaries', 'homehost', 'byteorder', 'devicesize'.\n");
|
" 'summaries', 'homehost', 'byteorder', 'devicesize',\n"
|
||||||
|
" 'no-bitmap'\n");
|
||||||
exit(outf == stdout ? 0 : 2);
|
exit(outf == stdout ? 0 : 2);
|
||||||
|
|
||||||
case O(INCREMENTAL,NoDegraded):
|
case O(INCREMENTAL,NoDegraded):
|
||||||
|
|
7
super0.c
7
super0.c
|
@ -402,8 +402,9 @@ static int update_super0(struct supertype *st, struct mdinfo *info,
|
||||||
char *devname, int verbose,
|
char *devname, int verbose,
|
||||||
int uuid_set, char *homehost)
|
int uuid_set, char *homehost)
|
||||||
{
|
{
|
||||||
/* NOTE: for 'assemble' and 'force' we need to return non-zero if any change was made.
|
/* NOTE: for 'assemble' and 'force' we need to return non-zero
|
||||||
* For others, the return value is ignored.
|
* if any change was made. For others, the return value is
|
||||||
|
* ignored.
|
||||||
*/
|
*/
|
||||||
int rv = 0;
|
int rv = 0;
|
||||||
mdp_super_t *sb = st->sb;
|
mdp_super_t *sb = st->sb;
|
||||||
|
@ -556,6 +557,8 @@ static int update_super0(struct supertype *st, struct mdinfo *info,
|
||||||
bm = (struct bitmap_super_s*)(sb+1);
|
bm = (struct bitmap_super_s*)(sb+1);
|
||||||
uuid_from_super0(st, (int*)bm->uuid);
|
uuid_from_super0(st, (int*)bm->uuid);
|
||||||
}
|
}
|
||||||
|
} else if (strcmp(update, "no-bitmap") == 0) {
|
||||||
|
sb->state &= ~(1<<MD_SB_BITMAP_PRESENT);
|
||||||
}
|
}
|
||||||
if (strcmp(update, "_reshape_progress")==0)
|
if (strcmp(update, "_reshape_progress")==0)
|
||||||
sb->reshape_position = info->reshape_progress;
|
sb->reshape_position = info->reshape_progress;
|
||||||
|
|
7
super1.c
7
super1.c
|
@ -643,8 +643,9 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
|
||||||
char *devname, int verbose,
|
char *devname, int verbose,
|
||||||
int uuid_set, char *homehost)
|
int uuid_set, char *homehost)
|
||||||
{
|
{
|
||||||
/* NOTE: for 'assemble' and 'force' we need to return non-zero if any change was made.
|
/* NOTE: for 'assemble' and 'force' we need to return non-zero
|
||||||
* For others, the return value is ignored.
|
* if any change was made. For others, the return value is
|
||||||
|
* ignored.
|
||||||
*/
|
*/
|
||||||
int rv = 0;
|
int rv = 0;
|
||||||
struct mdp_superblock_1 *sb = st->sb;
|
struct mdp_superblock_1 *sb = st->sb;
|
||||||
|
@ -755,6 +756,8 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
|
||||||
bm = (struct bitmap_super_s*)(st->sb+1024);
|
bm = (struct bitmap_super_s*)(st->sb+1024);
|
||||||
memcpy(bm->uuid, sb->set_uuid, 16);
|
memcpy(bm->uuid, sb->set_uuid, 16);
|
||||||
}
|
}
|
||||||
|
} else if (strcmp(update, "no-bitmap") == 0) {
|
||||||
|
sb->feature_map &= ~__cpu_to_le32(MD_FEATURE_BITMAP_OFFSET);
|
||||||
}
|
}
|
||||||
if (strcmp(update, "homehost") == 0 &&
|
if (strcmp(update, "homehost") == 0 &&
|
||||||
homehost) {
|
homehost) {
|
||||||
|
|
Loading…
Reference in New Issue