* [PATCH] e2image: skip uninitialized bitmaps and inode tables
@ 2012-02-21 21:47 Phillip Susi
2012-02-27 5:59 ` Ted Ts'o
0 siblings, 1 reply; 2+ messages in thread
From: Phillip Susi @ 2012-02-21 21:47 UTC (permalink / raw)
To: tytso; +Cc: linux-ext4
When the block bitmap is uninitialized, skip copying it.
When the inode bitmap is uninitialized, skip copying it,
as well as the inode table. When there are unused inodes
towards the end of the table, skip those blocks too.
Signed-off-by: Phillip Susi <psusi@ubuntu.com>
---
misc/e2image.c | 22 ++++++++++++++++------
1 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/misc/e2image.c b/misc/e2image.c
index 4343a3d..79c8afb 100644
--- a/misc/e2image.c
+++ b/misc/e2image.c
@@ -342,18 +342,27 @@ static void mark_table_blocks(ext2_filsys fs)
/*
* Mark the blocks used for the inode table
*/
- if (ext2fs_inode_table_loc(fs, i)) {
+ if (!ext2fs_bg_flags_test(fs, i, EXT2_BG_INODE_UNINIT) &&
+ ext2fs_inode_table_loc(fs, i)) {
+ unsigned int end = (unsigned) fs->inode_blocks_per_group;
+ /* skip unused blocks */
+ if (EXT2_HAS_RO_COMPAT_FEATURE(fs->super,
+ EXT4_FEATURE_RO_COMPAT_GDT_CSUM))
+ end -= (ext2fs_bg_itable_unused(fs, i) /
+ EXT2_INODES_PER_BLOCK(fs->super));
for (j = 0, b = ext2fs_inode_table_loc(fs, i);
- j < (unsigned) fs->inode_blocks_per_group;
- j++, b++)
+ j < end;
+ j++, b++) {
ext2fs_mark_block_bitmap2(meta_block_map, b);
- meta_blocks_count += fs->inode_blocks_per_group;
+ meta_blocks_count++;
+ }
}
/*
* Mark block used for the block bitmap
*/
- if (ext2fs_block_bitmap_loc(fs, i)) {
+ if (!ext2fs_bg_flags_test(fs, i, EXT2_BG_BLOCK_UNINIT) &&
+ ext2fs_block_bitmap_loc(fs, i)) {
ext2fs_mark_block_bitmap2(meta_block_map,
ext2fs_block_bitmap_loc(fs, i));
meta_blocks_count++;
@@ -362,7 +371,8 @@ static void mark_table_blocks(ext2_filsys fs)
/*
* Mark block used for the inode bitmap
*/
- if (ext2fs_inode_bitmap_loc(fs, i)) {
+ if (!ext2fs_bg_flags_test(fs, i, EXT2_BG_INODE_UNINIT) &&
+ ext2fs_inode_bitmap_loc(fs, i)) {
ext2fs_mark_block_bitmap2(meta_block_map,
ext2fs_inode_bitmap_loc(fs, i));
meta_blocks_count++;
--
1.7.5.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] e2image: skip uninitialized bitmaps and inode tables
2012-02-21 21:47 [PATCH] e2image: skip uninitialized bitmaps and inode tables Phillip Susi
@ 2012-02-27 5:59 ` Ted Ts'o
0 siblings, 0 replies; 2+ messages in thread
From: Ted Ts'o @ 2012-02-27 5:59 UTC (permalink / raw)
To: Phillip Susi; +Cc: linux-ext4
On Tue, Feb 21, 2012 at 04:47:29PM -0500, Phillip Susi wrote:
> When the block bitmap is uninitialized, skip copying it.
> When the inode bitmap is uninitialized, skip copying it,
> as well as the inode table. When there are unused inodes
> towards the end of the table, skip those blocks too.
>
> Signed-off-by: Phillip Susi <psusi@ubuntu.com>
Thanks, applied.
- Ted
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-02-27 6:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-21 21:47 [PATCH] e2image: skip uninitialized bitmaps and inode tables Phillip Susi
2012-02-27 5:59 ` Ted Ts'o
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).