From patchwork Thu May 28 06:39:49 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Dilger X-Patchwork-Id: 27775 Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id E5765B707E for ; Thu, 28 May 2009 16:40:09 +1000 (EST) Received: by ozlabs.org (Postfix) id DA37BDDF8A; Thu, 28 May 2009 16:40:09 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 7319BDDED0 for ; Thu, 28 May 2009 16:40:09 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751079AbZE1GkD (ORCPT ); Thu, 28 May 2009 02:40:03 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751966AbZE1GkD (ORCPT ); Thu, 28 May 2009 02:40:03 -0400 Received: from sca-es-mail-1.Sun.COM ([192.18.43.132]:35410 "EHLO sca-es-mail-1.sun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751079AbZE1GkB (ORCPT ); Thu, 28 May 2009 02:40:01 -0400 Received: from fe-sfbay-10.sun.com ([192.18.43.129]) by sca-es-mail-1.sun.com (8.13.7+Sun/8.12.9) with ESMTP id n4S6e1lt023705 for ; Wed, 27 May 2009 23:40:01 -0700 (PDT) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-disposition: inline Content-type: text/plain; CHARSET=US-ASCII Received: from conversion-daemon.fe-sfbay-10.sun.com by fe-sfbay-10.sun.com (Sun Java(tm) System Messaging Server 7u2-7.02 64bit (built Apr 16 2009)) id <0KKC00C00CQ3P700@fe-sfbay-10.sun.com> for linux-ext4@vger.kernel.org; Wed, 27 May 2009 23:40:01 -0700 (PDT) Received: from webber.adilger.int ([unknown] [68.147.209.238]) by fe-sfbay-10.sun.com (Sun Java(tm) System Messaging Server 7u2-7.02 64bit (built Apr 16 2009)) with ESMTPSA id <0KKC00IJBD6NSD70@fe-sfbay-10.sun.com>; Wed, 27 May 2009 23:40:01 -0700 (PDT) Date: Thu, 28 May 2009 00:39:49 -0600 From: Andreas Dilger Subject: [PATCH] only restart e2fsck once for inodes in uninit range To: "Theodore Ts'o" Cc: linux-ext4@vger.kernel.org Message-id: <20090528063949.GE3218@webber.adilger.int> X-GPG-Key: 1024D/0D35BED6 X-GPG-Fingerprint: 7A37 5D79 BF1B CECA D44F 8A29 A488 39F5 0D35 BED6 User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Restart e2fsck only once in case of multiple inodes in uninit range. Display correct inode number during BG_INO_UNINIT and INOREF_IN_USED errors. Signed-off-by: Kalpak Shah Signed-off-by: Andreas Dilger Cheers, Andreas --- Andreas Dilger Sr. Staff Engineer, Lustre Group Sun Microsystems of Canada, Inc. -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: e2fsprogs-1.41.4/e2fsck/pass2.c =================================================================== --- e2fsprogs-1.41.4.orig/e2fsck/pass2.c 2008-12-09 08:02:37.000000000 +0530 +++ e2fsprogs-1.41.4/e2fsck/pass2.c 2009-04-12 11:25:00.000000000 +0530 @@ -153,6 +153,12 @@ &cd); if (ctx->flags & E2F_FLAG_SIGNAL_MASK || ctx->flags & E2F_FLAG_RESTART) return; + + if (ctx->flags & E2F_FLAG_RESTART_LATER) { + ctx->flags |= E2F_FLAG_RESTART; + return; + } + if (cd.pctx.errcode) { fix_problem(ctx, PR_2_DBLIST_ITERATE, &cd.pctx); ctx->flags |= E2F_FLAG_ABORT; @@ -988,23 +994,24 @@ * newly visible inodes. */ if (fs->group_desc[group].bg_flags & EXT2_BG_INODE_UNINIT) { + pctx.num = dirent->inode; if (fix_problem(ctx, PR_2_INOREF_BG_INO_UNINIT, &cd->pctx)){ fs->group_desc[group].bg_flags &= ~EXT2_BG_INODE_UNINIT; ext2fs_mark_super_dirty(fs); - ctx->flags |= E2F_FLAG_RESTART; + ctx->flags |= E2F_FLAG_RESTART_LATER; } else { ext2fs_unmark_valid(fs); if (problem == PR_2_BAD_INO) goto next; } } else if (dirent->inode >= first_unused_inode) { + pctx.num = dirent->inode; if (fix_problem(ctx, PR_2_INOREF_IN_UNUSED, &cd->pctx)){ fs->group_desc[group].bg_itable_unused = 0; ext2fs_mark_super_dirty(fs); - ctx->flags |= E2F_FLAG_RESTART; - goto restart_fsck; + ctx->flags |= E2F_FLAG_RESTART_LATER; } else { ext2fs_unmark_valid(fs); if (problem == PR_2_BAD_INO) @@ -1145,7 +1152,6 @@ return 0; abort_free_dict: ctx->flags |= E2F_FLAG_ABORT; -restart_fsck: dict_free_nodes(&de_dict); return DIRENT_ABORT; } Index: e2fsprogs-1.41.4/e2fsck/e2fsck.h =================================================================== --- e2fsprogs-1.41.4.orig/e2fsck/e2fsck.h 2009-04-12 11:07:44.000000000 +0530 +++ e2fsprogs-1.41.4/e2fsck/e2fsck.h 2009-04-12 11:20:53.000000000 +0530 @@ -163,6 +163,7 @@ #define E2F_FLAG_CANCEL 0x0002 /* Cancel signaled */ #define E2F_FLAG_SIGNAL_MASK 0x0003 #define E2F_FLAG_RESTART 0x0004 /* Restart signaled */ +#define E2F_FLAG_RESTART_LATER 0x0008 /* Restart after all iterations done */ #define E2F_FLAG_SETJMP_OK 0x0010 /* Setjmp valid for abort */