summaryrefslogtreecommitdiff
path: root/e2fsck/pass1b.c
diff options
context:
space:
mode:
authorJim Garlick <garlick@llnl.gov>2007-04-20 08:14:27 -0400
committerTheodore Ts'o <tytso@mit.edu>2007-04-20 08:14:27 -0400
commit81cae650b7356ce493f93a33370d6a8c00f5948e (patch)
tree591ac86a4aa0422517442d351e4fd07cf6aa5c12 /e2fsck/pass1b.c
parentd362a3fb7ec1a2b46601f55f4dbae83563c27717 (diff)
downloade2fsprogs-81cae650b7356ce493f93a33370d6a8c00f5948e.tar.gz
e2fsck: Count the root directory as found if it has shared blocks in pass1c
Another small bug I think: if the root directory contains shared blocks, e2fsck pass1c search_dirent_proc() will be looking for one more containing directory than it will ever find, and thus loses an opportunity to terminate early. Signed-off-by: Jim Garlick <garlick@llnl.gov>
Diffstat (limited to 'e2fsck/pass1b.c')
-rw-r--r--e2fsck/pass1b.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/e2fsck/pass1b.c b/e2fsck/pass1b.c
index 578c1fe6..118f9560 100644
--- a/e2fsck/pass1b.c
+++ b/e2fsck/pass1b.c
@@ -96,6 +96,7 @@ static void pass1c(e2fsck_t ctx, char *block_buf);
static void pass1d(e2fsck_t ctx, char *block_buf);
static int dup_inode_count = 0;
+static int dup_inode_founddir = 0;
static dict_t blk_dict, ino_dict;
@@ -146,7 +147,12 @@ static void add_dupe(e2fsck_t ctx, ext2_ino_t ino, blk_t blk,
else {
di = (struct dup_inode *) e2fsck_allocate_memory(ctx,
sizeof(struct dup_inode), "duplicate inode header");
- di->dir = (ino == EXT2_ROOT_INO) ? EXT2_ROOT_INO : 0 ;
+ if (ino == EXT2_ROOT_INO) {
+ di->dir = EXT2_ROOT_INO;
+ dup_inode_founddir++;
+ } else
+ di->dir = 0;
+
di->num_dupblocks = 0;
di->block_list = 0;
di->inode = *inode;
@@ -396,7 +402,7 @@ static void pass1c(e2fsck_t ctx, char *block_buf)
* Search through all directories to translate inodes to names
* (by searching for the containing directory for that inode.)
*/
- sd.count = dup_inode_count;
+ sd.count = dup_inode_count - dup_inode_founddir;
sd.first_inode = EXT2_FIRST_INODE(fs->super);
sd.max_inode = fs->super->s_inodes_count;
ext2fs_dblist_dir_iterate(fs->dblist, 0, block_buf,