Re: [PATCH 10/14] Make e2fsck uninit block group aware.

2007-10-22 Thread Theodore Tso
On Mon, Oct 22, 2007 at 11:02:02AM -0500, Jose R. Santos wrote:
> Hi Ted,
> 
> Aneesh was nice enough to explain how to checkout the next branch.
> This is the only patch that broke so I'm attaching one that applies
> cleanly

Thanks, I was able to clean that up fairly easily myself.  I noticed
though that after applying the patch series, "make check" blew up:

making check in lib/ext2fs
make[1]: Entering directory `/usr/projects/e2fsprogs/e2fsprogs/build/lib/ext2fs'
CC ../../../lib/ext2fs/tst_bitops.c
LD tst_bitops
CC ../../../lib/ext2fs/tst_badblocks.c
LD tst_badblocks
rw_bitmaps.o: In function `read_bitmaps':
/usr/projects/e2fsprogs/e2fsprogs/build/lib/ext2fs/../../../lib/ext2fs/rw_bitmaps.c:237:
 undefined reference to `ext2fs_group_desc_csum_verify'
/usr/projects/e2fsprogs/e2fsprogs/build/lib/ext2fs/../../../lib/ext2fs/rw_bitmaps.c:260:
 undefined reference to `ext2fs_group_desc_csum_verify'
collect2: ld returned 1 exit status
make[1]: *** [tst_badblocks] Error 1
make[1]: Leaving directory `/usr/projects/e2fsprogs/e2fsprogs/build/lib/ext2fs'
make: *** [check-recursive] Error 1

That's a relatively straightforward adjustment to lib/ext2fs/Makefile.in; 
but please do make sure you run "make check" at the end of each patch series.

In fact, something I will normally try to do is make sure that "make
check" runs cleanly after every single patch in a patch series.  That
makes it a lot easier to do git bisect runs.

Thanks,

- Ted
-
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 10/14] Make e2fsck uninit block group aware.

2007-10-22 Thread Jose R. Santos
Hi Ted,

Aneesh was nice enough to explain how to checkout the next branch.
This is the only patch that broke so I'm attaching one that applies
cleanly.

-JRS





uninit_e2fsck_support
Description: Binary data


[PATCH 10/14] Make e2fsck uninit block group aware.

2007-10-21 Thread Jose R. Santos

Make e2fsck uninit block group aware.

This patch has all the necesary pieces to open and fix filesystems created
with the uninit block group feature.

Signed-off-by: Jose R. Santos <[EMAIL PROTECTED]>
Signed-Off-By: Andreas Dilger <[EMAIL PROTECTED]>
--

 e2fsck/e2fsck.h  |2 +
 e2fsck/journal.c |2 +
 e2fsck/pass2.c   |   77 --
 e2fsck/pass5.c   |   61 +++
 e2fsck/problem.c |   42 +
 e2fsck/problem.h |   26 ++
 e2fsck/super.c   |   40 
 e2fsck/unix.c|   11 ++--
 e2fsck/util.c|   61 +++
 9 files changed, 292 insertions(+), 30 deletions(-)

diff --git a/e2fsck/e2fsck.h b/e2fsck/e2fsck.h
index 9ccffd8..a67322d 100644
--- a/e2fsck/e2fsck.h
+++ b/e2fsck/e2fsck.h
@@ -468,6 +468,8 @@ extern void e2fsck_read_bitmaps(e2fsck_t ctx);
 extern void e2fsck_write_bitmaps(e2fsck_t ctx);
 extern void preenhalt(e2fsck_t ctx);
 extern char *string_copy(e2fsck_t ctx, const char *str, int len);
+extern errcode_t e2fsck_zero_blocks(ext2_filsys fs, blk_t blk, int num,
+   blk_t *ret_blk, int *ret_count);
 #ifdef RESOURCE_TRACK
 extern void print_resource_track(const char *desc,
 struct resource_track *track,
diff --git a/e2fsck/journal.c b/e2fsck/journal.c
index f5f4647..ceade93 100644
--- a/e2fsck/journal.c
+++ b/e2fsck/journal.c
@@ -988,6 +988,8 @@ void e2fsck_move_ext3_journal(e2fsck_t ctx)
ext2fs_unmark_inode_bitmap(fs->inode_map, ino);
ext2fs_mark_ib_dirty(fs);
fs->group_desc[group].bg_free_inodes_count++;
+   fs->group_desc[group].bg_checksum =
+   ext2fs_group_desc_csum(fs->super, group,&fs->group_desc[group]);
fs->super->s_free_inodes_count++;
return;
 
diff --git a/e2fsck/pass2.c b/e2fsck/pass2.c
index 27f7136..047b5ca 100644
--- a/e2fsck/pass2.c
+++ b/e2fsck/pass2.c
@@ -151,7 +151,7 @@ void e2fsck_pass2(e2fsck_t ctx)

cd.pctx.errcode = ext2fs_dblist_iterate(fs->dblist, check_dir_block,
&cd);
-   if (ctx->flags & E2F_FLAG_SIGNAL_MASK)
+   if (ctx->flags & E2F_FLAG_SIGNAL_MASK || ctx->flags & E2F_FLAG_RESTART)
return;
if (cd.pctx.errcode) {
fix_problem(ctx, PR_2_DBLIST_ITERATE, &cd.pctx);
@@ -736,7 +736,7 @@ static int check_dir_block(ext2_filsys fs,
buf = cd->buf;
ctx = cd->ctx;
 
-   if (ctx->flags & E2F_FLAG_SIGNAL_MASK)
+   if (ctx->flags & E2F_FLAG_SIGNAL_MASK || ctx->flags & E2F_FLAG_RESTART)
return DIRENT_ABORT;

if (ctx->progress && (ctx->progress)(ctx, 2, cd->count++, cd->max))
@@ -833,6 +833,9 @@ static int check_dir_block(ext2_filsys fs,
dict_init(&de_dict, DICTCOUNT_T_MAX, dict_de_cmp);
prev = 0;
do {
+   int group;
+   ext2_ino_t first_unused_inode;
+
problem = 0;
dirent = (struct ext2_dir_entry *) (buf + offset);
cd->pctx.dirent = dirent;
@@ -882,12 +885,6 @@ static int check_dir_block(ext2_filsys fs,
 (dirent->inode < EXT2_FIRST_INODE(fs->super))) ||
(dirent->inode > fs->super->s_inodes_count)) {
problem = PR_2_BAD_INO;
-   } else if (!(ext2fs_test_inode_bitmap(ctx->inode_used_map,
-  dirent->inode))) {
-   /*
-* If the inode is unused, offer to clear it.
-*/
-   problem = PR_2_UNUSED_INODE;
} else if (ctx->inode_bb_map &&
   (ext2fs_test_inode_bitmap(ctx->inode_bb_map,
 dirent->inode))) {
@@ -964,6 +961,67 @@ static int check_dir_block(ext2_filsys fs,
return DIRENT_ABORT;
}
 
+   group = ext2fs_group_of_ino(fs, dirent->inode);
+   first_unused_inode = group * fs->super->s_inodes_per_group +
+   1 + fs->super->s_inodes_per_group -
+   fs->group_desc[group].bg_itable_unused;
+   cd->pctx.group = group;
+
+   /*
+* Check if the inode was missed out because _INODE_UNINIT
+* flag was set or bg_itable_unused was incorrect.
+* If that is the case restart e2fsck.
+* XXX Optimisations TODO:
+* 1. only restart e2fsck once
+* 2. only exposed inodes are checked again.
+*/
+   if (fs->group_desc[group].bg_flags & EXT2_BG_INODE_UNINIT) {
+   if (fix_problem(ctx, PR_2_INOREF_BG_INO_UNINIT,
+