[Parted-commits] GNU Parted Official Repository: Changes to 'master'
Jim Meyering
meyering at alioth.debian.org
Tue Jul 10 10:07:04 UTC 2007
libparted/fs/ext2/ext2_block_relocator.c | 8 ++++++--
libparted/fs/ext2/ext2_meta.c | 2 +-
tests/t3100-resize-ext2-partion.sh | 8 ++------
3 files changed, 9 insertions(+), 9 deletions(-)
New commits:
commit 848a669a7f0d6e5f82ad4935295a5fae7f5f72ad
Author: Jim Meyering <jim at meyering.net>
Date: Tue Jul 10 12:03:49 2007 +0200
Flip the switch (expected-failure -> expected-success) in tests/t3100-
resize-ext2-partion.sh, now that this bug is fixed.
diff --git a/tests/t3100-resize-ext2-partion.sh b/tests/t3100-resize-ext2-partion.sh
index 0e763db..f3ba7f4 100755
--- a/tests/t3100-resize-ext2-partion.sh
+++ b/tests/t3100-resize-ext2-partion.sh
@@ -46,13 +46,9 @@ test_expect_success \
'parted -s $dev mkpartfs primary ext2 0 $ORIG_SIZE > out 2>&1'
test_expect_success 'check for empty output' '$compare out /dev/null'
-# FIXME: this test currently fails with the diagnostic "error: block
-# relocator should have relocated 64".
-# Eventually, when this bug is fixed, change each of the following
-# expected failures to "test_expect_success".
-test_expect_failure \
+test_expect_success \
'resize ext2 primary partition' \
'parted -s $dev resize 1 0 $NEW_SIZE > out 2>&1'
-test_expect_failure 'check for empty output' '$compare out /dev/null'
+test_expect_success 'check for empty output' '$compare out /dev/null'
test_done
commit 986d88f0f5174aa044fe5d5dad6eb84db11e18fc
Author: Flavio Leitner <flavio.leitner at gmail.com>
Date: Tue Jun 12 14:54:26 2007 -0300
Fix block state checking for realocated blocks
A busy block should be realocated and it's correct in
ext2_block_relocator_mark(), but not in ext2_metadata_push().
Signed-off-by: Flavio Leitner <flavio.leitner at gmail.com>
Signed-off-by: Jim Meyering <jim at meyering.net>
diff --git a/libparted/fs/ext2/ext2_meta.c b/libparted/fs/ext2/ext2_meta.c
index d48097c..dd871c8 100644
--- a/libparted/fs/ext2/ext2_meta.c
+++ b/libparted/fs/ext2/ext2_meta.c
@@ -65,7 +65,7 @@ int ext2_metadata_push(struct ext2_fs *fs, blk_t newsize)
if (fs->opt_debug)
{
for (j=0;j<diff;j++)
- if (ext2_get_block_state(fs, fromblock+j))
+ if (!ext2_get_block_state(fs, fromblock+j))
{
fprintf(stderr,
"error: block relocator "
commit 640f523b9e200874bc46348370f56e68dfe7107c
Author: Flavio Leitner <flavio.leitner at gmail.com>
Date: Tue Jun 12 14:53:20 2007 -0300
Fix block number used when checking for state
Hi there,
The ext2_bread() returns a descriptor containing a
pointer ->data representing the contents of 1 block.
In ext2_block_relocate_grow(), it reads the block bitmap from
a group descriptor representing a range of blocks:
bh = ext2_bread(fs, EXT2_GROUP_BLOCK_BITMAP(fs->gd[i]));
Then it does:
k = EXT2_GROUP_INODE_TABLE(fs->gd[i]) + fs->inodeblocks + j;
k is the absolute block number and then checks the state doing:
if (bh->data[k>>3] & _bitmap[k&7])
The k should be the offset inside of group descriptor and not
the absolute block number. Example:
. Block bitmap represents 512 blocks
. Block absolute number is 1023.
GrpDesc = Block absolute number / block bitmap size = 1
bh = ext2_bread(fs, EXT2_GROUP_BLOCK_BITMAP(fs->gd[GrpDesc]))
bh->data[] contains a bitmap of 512 blocks from 512-1024
relative = absolute block number % block bitmap size
relative = 1023/512 = 511
The block state is in bitmap bh->data[relative>>3] & ...
Signed-off-by: Flavio Leitner <flavio.leitner at gmail.com>
Signed-off-by: Jim Meyering <jim at meyering.net>
diff --git a/libparted/fs/ext2/ext2_block_relocator.c b/libparted/fs/ext2/ext2_block_relocator.c
index 1f71d10..7b1dc72 100644
--- a/libparted/fs/ext2/ext2_block_relocator.c
+++ b/libparted/fs/ext2/ext2_block_relocator.c
@@ -797,17 +797,21 @@ static int ext2_block_relocate_grow(struct ext2_fs *fs, struct ext2_block_reloca
for (j=0;j<diff;j++)
{
+ blk_t block;
blk_t k;
k = EXT2_GROUP_INODE_TABLE(fs->gd[i])
+ fs->inodeblocks + j;
- if (bh->data[k>>3] & _bitmap[k&7])
+ block = k % EXT2_SUPER_BLOCKS_PER_GROUP(fs->sb);
+ if (bh->data[block>>3] & _bitmap[block&7]) {
+ k += EXT2_SUPER_FIRST_DATA_BLOCK(fs->sb);
if (!ext2_block_relocator_mark(fs,
- state, start + k))
+ state, k))
{
ext2_brelse(bh, 0);
return 0;
}
+ }
}
}
More information about the Parted-commits
mailing list