public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Jim Garlick <garlick@llnl.gov>
To: tytso@mit.edu
Cc: linux-ext4@vger.kernel.org
Subject: [PATCH] e2fsprogs - e2fsck pass1c does extra work if root dir has shared blocks
Date: Tue, 10 Apr 2007 15:39:56 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.61.0704101538020.31519@webb> (raw)
In-Reply-To: <Pine.LNX.4.61.0704101344050.29750@webb>

Ted,

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>

Index: e2fsprogs+chaos/e2fsck/pass1b.c
===================================================================
--- e2fsprogs+chaos.orig/e2fsck/pass1b.c
+++ e2fsprogs+chaos/e2fsck/pass1b.c
@@ -96,6 +96,7 @@ static void pass1c(e2fsck_t ctx, char *b
  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_
  	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 *b
  	 * 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,

  reply	other threads:[~2007-04-10 22:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-10 20:51 [PATCH] e2fsprogs - pass1c terminates early if hard links Jim Garlick
2007-04-10 22:39 ` Jim Garlick [this message]
2007-04-20 12:14   ` [PATCH] e2fsprogs - e2fsck pass1c does extra work if root dir has shared blocks Theodore Tso
2007-04-11  3:40 ` [PATCH] e2fsprogs - pass1c terminates early if hard links Theodore Tso
2007-04-11  4:22   ` Andreas Dilger
2007-04-11 10:42     ` Theodore Tso
2007-04-11 11:51       ` Andreas Dilger
2007-04-11 12:57         ` Theodore Tso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.61.0704101538020.31519@webb \
    --to=garlick@llnl.gov \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox