From: Jan Kara <jack@suse.cz>
To: tytso@mit.edu
Cc: linux-ext4@vger.kernel.org
Subject: [PATCH resend] Fix reading of bitmaps from filesystem image
Date: Wed, 9 Jan 2008 20:54:35 +0100 [thread overview]
Message-ID: <20080109195435.GD2215@duck.suse.cz> (raw)
Hi Ted,
I've sent you the attached fix some time ago but it didn't seem to get
merged yet...
Honza
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
---
Subject: Fix reading of bitmaps from filesystem image
Reading of bitmaps from image file could never work with more than one
group in a filesystem... Fix the loops so that we read appropriate number
of blocks.
Signed-off-by: Jan Kara <jack@suse.cz>
diff --git a/lib/ext2fs/rw_bitmaps.c b/lib/ext2fs/rw_bitmaps.c
index 1897ec3..abbe5e8 100644
--- a/lib/ext2fs/rw_bitmaps.c
+++ b/lib/ext2fs/rw_bitmaps.c
@@ -190,7 +190,7 @@ static errcode_t read_bitmaps(ext2_filsy
if (fs->flags & EXT2_FLAG_IMAGE_FILE) {
blk = (fs->image_header->offset_inodemap / fs->blocksize);
ino_cnt = fs->super->s_inodes_count;
- while (inode_nbytes > 0) {
+ while (do_inode && ino_cnt > 0) {
retval = io_channel_read_blk(fs->image_io, blk++,
1, inode_bitmap);
if (retval)
@@ -202,15 +202,14 @@ static errcode_t read_bitmaps(ext2_filsy
ino_itr, cnt, inode_bitmap);
if (retval)
goto cleanup;
- ino_itr += fs->blocksize << 3;
- ino_cnt -= fs->blocksize << 3;
- inode_nbytes -= fs->blocksize;
+ ino_itr += cnt;
+ ino_cnt -= cnt;
}
blk = (fs->image_header->offset_blockmap /
fs->blocksize);
blk_cnt = EXT2_BLOCKS_PER_GROUP(fs->super) *
fs->group_desc_count;
- while (block_nbytes > 0) {
+ while (do_block && blk_cnt > 0) {
retval = io_channel_read_blk(fs->image_io, blk++,
1, block_bitmap);
if (retval)
@@ -222,9 +221,8 @@ static errcode_t read_bitmaps(ext2_filsy
blk_itr, cnt, block_bitmap);
if (retval)
goto cleanup;
- blk_itr += fs->blocksize << 3;
- blk_cnt -= fs->blocksize << 3;
- block_nbytes -= fs->blocksize;
+ blk_itr += cnt;
+ blk_cnt -= cnt;
}
goto success_cleanup;
}
next reply other threads:[~2008-01-09 19:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-09 19:54 Jan Kara [this message]
2008-01-14 15:57 ` [PATCH resend] Fix reading of bitmaps from filesystem image Theodore Tso
2008-01-14 16:17 ` Jan Kara
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=20080109195435.GD2215@duck.suse.cz \
--to=jack@suse.cz \
--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