From patchwork Wed May 16 08:50:25 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tao Ma X-Patchwork-Id: 159550 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id A6313B6FC5 for ; Wed, 16 May 2012 18:50:42 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932600Ab2EPIuk (ORCPT ); Wed, 16 May 2012 04:50:40 -0400 Received: from oproxy5-pub.bluehost.com ([67.222.38.55]:48011 "HELO oproxy5-pub.bluehost.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S932298Ab2EPIuj (ORCPT ); Wed, 16 May 2012 04:50:39 -0400 Received: (qmail 6252 invoked by uid 0); 16 May 2012 08:50:37 -0000 Received: from unknown (HELO box585.bluehost.com) (66.147.242.185) by cpoproxy2.bluehost.com with SMTP; 16 May 2012 08:50:37 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tao.ma; s=default; h=Message-Id:Date:Subject:Cc:To:From; bh=V0rKa8fXciVrRQCsFD4pszOBECghFn4kxPji9sPCtlk=; b=k6BgHofinRAmB5qOrTYI04GV6b9H6ELu8zzckykIQFjz48E7LLoDcUjY2ev17f5JMQkrov3CPzbFzvNvqmsiwuqKBk50HjToIWR+J0ma37wLZ32qrtnIp6/B/IZwP4+t; Received: from [182.92.247.2] (helo=tma-laptop1.taobao.ali.com) by box585.bluehost.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1SUZwL-0003X9-2C; Wed, 16 May 2012 02:50:37 -0600 From: Tao Ma To: linux-ext4@vger.kernel.org Cc: Theodore Ts'o Subject: [PATCH] e2fsck: Let end_blk to be the maximum value of u32. Date: Wed, 16 May 2012 16:50:25 +0800 Message-Id: <1337158225-4627-1-git-send-email-tm@tao.ma> X-Mailer: git-send-email 1.7.4.1 X-Identified-User: {1390:box585.bluehost.com:colyli:tao.ma} {sentby:smtp auth 182.92.247.2 authed with tm@tao.ma} Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Tao Ma Now we can use fallocate to create a large file while keep the size to be small. It will cause the e2fsck complain about it. The test script is simple and I have pasted it here. DEVICE=/dev/sdb1 mount -t ext4 $DEVICE /mnt/ext4 for((i=0;i<10;i++))do fallocate -n -o $[$i*8192] -l 4096 /mnt/ext4/a;done umount $DEVICE e2fsck -fn $DEVICE The error message will be like this: e2fsck 1.42.3 (14-May-2012) Pass 1: Checking inodes, blocks, and sizes Inode 12 has zero length extent (invalid logical block 0, physical block 32775) Clear? no Inode 12, i_blocks is 88, should be 0. Fix? no Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information Block bitmap differences: -(8231--8232) -(32770--32778) Fix? no Now actually the end_blk can be any value which is less than u32, so make end_blk be the maximum value of u32. Cc: Theodore Ts'o Signed-off-by: Tao Ma --- lib/ext2fs/extent.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/lib/ext2fs/extent.c b/lib/ext2fs/extent.c index eb096d6..e2815c2 100644 --- a/lib/ext2fs/extent.c +++ b/lib/ext2fs/extent.c @@ -253,9 +253,7 @@ extern errcode_t ext2fs_extent_open2(ext2_filsys fs, ext2_ino_t ino, ext2fs_le16_to_cpu(eh->eh_entries); handle->path[0].max_entries = ext2fs_le16_to_cpu(eh->eh_max); handle->path[0].curr = 0; - handle->path[0].end_blk = - (EXT2_I_SIZE(handle->inode) + fs->blocksize - 1) >> - EXT2_BLOCK_SIZE_BITS(fs->super); + handle->path[0].end_blk = ((((unsigned long long) 1) << 32) - 1); handle->path[0].visit_num = 1; handle->level = 0; handle->magic = EXT2_ET_MAGIC_EXTENT_HANDLE;