Add --update=force-no-bbl.

This forcibly removed the bad-block log.  There can be situations where it is hard to
remove bad blocks by writing to them - partiularly on RAID5.

Signed-off-by: NeilBrown <neilb@suse.com>
This commit is contained in:
NeilBrown 2015-12-21 14:56:38 +11:00
parent a0d12d51a7
commit 6dd16dac40
3 changed files with 12 additions and 3 deletions

View File

@ -757,6 +757,8 @@ int main(int argc, char *argv[])
continue;
if (strcmp(c.update, "no-bbl") == 0)
continue;
if (strcmp(c.update, "force-no-bbl") == 0)
continue;
if (strcmp(c.update, "metadata") == 0)
continue;
if (strcmp(c.update, "revert-reshape") == 0)
@ -790,7 +792,7 @@ int main(int argc, char *argv[])
" 'sparc2.2', 'super-minor', 'uuid', 'name', 'nodes', 'resync',\n"
" 'summaries', 'homehost', 'home-cluster', 'byteorder', 'devicesize',\n"
" 'no-bitmap', 'metadata', 'revert-reshape'\n"
" 'bbl', 'no-bbl'\n"
" 'bbl', 'no-bbl', 'force-no-bbl'\n"
);
exit(outf == stdout ? 0 : 2);
@ -808,8 +810,9 @@ int main(int argc, char *argv[])
c.update = optarg;
if (strcmp(c.update, "devicesize") != 0 &&
strcmp(c.update, "bbl") != 0 &&
strcmp(c.update, "force-no-bbl") != 0 &&
strcmp(c.update, "no-bbl") != 0) {
pr_err("only 'devicesize', 'bbl' and 'no-bbl' can be updated with --re-add\n");
pr_err("only 'devicesize', 'bbl', 'no-bbl', and 'force-no-bbl' can be updated with --re-add\n");
exit(2);
}
continue;

View File

@ -820,7 +820,8 @@ extern struct superswitch {
* readwrite - clear the WriteMostly1 bit in the superblock devflags
* no-bitmap - clear any record that a bitmap is present.
* bbl - add a bad-block-log if possible
* no-bbl - remove and bad-block-log is it is empty.
* no-bbl - remove any bad-block-log is it is empty.
* force-no-bbl - remove any bad-block-log even if empty.
* revert-reshape - If a reshape is in progress, modify metadata so
* it will resume going in the opposite direction.
*/

View File

@ -1282,6 +1282,11 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
sb->bblog_shift = 0;
sb->bblog_offset = 0;
}
} else if (strcmp(update, "force-no-bbl") == 0) {
sb->feature_map &= ~ __cpu_to_le32(MD_FEATURE_BAD_BLOCKS);
sb->bblog_size = 0;
sb->bblog_shift = 0;
sb->bblog_offset = 0;
} else if (strcmp(update, "name") == 0) {
if (info->name[0] == 0)
sprintf(info->name, "%d", info->array.md_minor);