From 3ddf2f662eaccf2376dd99c65a2fe93fcf75c3e7 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Tue, 2 Dec 2003 07:56:42 -0500 Subject: [PATCH] When testing a disk using e2fsck -c, use the list of new bad blocks to replace the current list of bad blocks. This way "e2fsck -c" can be used to recover from a corrupted bad block inode. --- e2fsck/ChangeLog | 11 +++++++++++ e2fsck/badblocks.c | 5 ----- e2fsck/e2fsck.h | 1 - e2fsck/unix.c | 2 +- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog index 31c9001..5c9427b 100644 --- a/e2fsck/ChangeLog +++ b/e2fsck/ChangeLog @@ -1,3 +1,14 @@ +2003-12-02 Theodore Ts'o + + * unix.c (main): When testing a disk using e2fsck -c, use the list + of new bad blocks to replace the current list of bad + blocks. This way "e2fsck -c" can be used to recover from + a corrupted bad block inode. + + * badblocks.c (test_disk): Remove the test_disk() file; e2fsck + will just call read_bad_blocks_file() directly with the + file parameter set to NULL. + 2003-09-14 Theodore Ts'o * unix.c (is_on_batt, check_if_skip): If running on battery, then diff --git a/e2fsck/badblocks.c b/e2fsck/badblocks.c index 92aa3c1..572af20 100644 --- a/e2fsck/badblocks.c +++ b/e2fsck/badblocks.c @@ -113,11 +113,6 @@ fatal: } -void test_disk(e2fsck_t ctx) -{ - read_bad_blocks_file(ctx, 0, 0); -} - static int check_bb_inode_blocks(ext2_filsys fs, blk_t *block_nr, int blockcnt, void *priv_data) { diff --git a/e2fsck/e2fsck.h b/e2fsck/e2fsck.h index 779835c..695f463 100644 --- a/e2fsck/e2fsck.h +++ b/e2fsck/e2fsck.h @@ -359,7 +359,6 @@ extern int e2fsck_run(e2fsck_t ctx); /* badblock.c */ extern void read_bad_blocks_file(e2fsck_t ctx, const char *bad_blocks_file, int replace_bad_blocks); -extern void test_disk(e2fsck_t ctx); /* dirinfo.c */ extern void e2fsck_add_dir_info(e2fsck_t ctx, ext2_ino_t ino, ext2_ino_t parent); diff --git a/e2fsck/unix.c b/e2fsck/unix.c index c61f3e4..91511bf 100644 --- a/e2fsck/unix.c +++ b/e2fsck/unix.c @@ -1034,7 +1034,7 @@ restart: if (bad_blocks_file) read_bad_blocks_file(ctx, bad_blocks_file, replace_bad_blocks); else if (cflag) - test_disk(ctx); + read_bad_blocks_file(ctx, 0, 1); /* Test disk */ if (ctx->flags & E2F_FLAG_SIGNAL_MASK) fatal_error(ctx, 0); #ifdef ENABLE_SWAPFS -- 1.8.3.1