linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Robin Dong <hao.bigrat@gmail.com>
To: linux-ext4@vger.kernel.org
Cc: Robin Dong <sanbai@taobao.com>
Subject: [PATCH] e2fsprogs: fix "Illegal block number" for scan_block_bitmap()
Date: Thu, 10 Nov 2011 20:15:24 +0800	[thread overview]
Message-ID: <1320927324-3613-1-git-send-email-hao.bigrat@gmail.com> (raw)

From: Robin Dong <sanbai@taobao.com>

After:
# mke2fs -O ^has_journal,^resize_inode,^uninit_bg,extent,meta_bg,flex_bg,bigalloc /dev/sda
# e2freefrag /dev/sda

It will report error message like:

 Illegal block number passed to ext2fs_test_block_bitmap #1732133 for block bitmap for /dev/sda
 Illegal block number passed to ext2fs_test_block_bitmap #1732134 for block bitmap for /dev/sda
 Illegal block number passed to ext2fs_test_block_bitmap #1732135 for block bitmap for /dev/sda

One bit in bitmap of bigalloc-ext4 means a cluster not a block, therefore ext2fs_fast_test_block_bitmap2
should check cluster.

Signed-off-by: Robin Dong <sanbai@taobao.com>
---
 misc/e2freefrag.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/misc/e2freefrag.c b/misc/e2freefrag.c
index b442f32..a09df6b 100644
--- a/misc/e2freefrag.c
+++ b/misc/e2freefrag.c
@@ -121,7 +121,7 @@ void scan_block_bitmap(ext2_filsys fs, struct chunk_info *info)
 				chunk_start_blk = blk;
 			}
 			used = ext2fs_fast_test_block_bitmap2(fs->block_map,
-							     chunk_start_blk);
+				chunk_start_blk >> fs->cluster_ratio_bits);
 			if (!used) {
 				last_chunk_size++;
 				chunk_free++;
-- 
1.7.3.2


             reply	other threads:[~2011-11-10 12:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-10 12:15 Robin Dong [this message]
2011-11-12  2:16 ` [PATCH] e2fsprogs: fix "Illegal block number" for scan_block_bitmap() Ted Ts'o

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=1320927324-3613-1-git-send-email-hao.bigrat@gmail.com \
    --to=hao.bigrat@gmail.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=sanbai@taobao.com \
    /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;
as well as URLs for NNTP newsgroup(s).