* flexbg metadata offset
@ 2008-04-23 16:38 Celine Bourde
0 siblings, 0 replies; only message in thread
From: Celine Bourde @ 2008-04-23 16:38 UTC (permalink / raw)
To: linux-ext4; +Cc: jrs, valerie.clement, Solofo.Ramangalahy, celine.bourde
There is a problem on offset metadata. In all flexbg groups the block
between the last block bitmap and the first inode bitmap is not used,
which introduces a hole.
This patch changes this. It corrects the offset of flexbg metadata,
specifically at the end of the disk, if the number of groups isn't
a multiple of the -G option argument.
Céline Bourde.
Signed-off-by: Bourde Celine <celine.bourde@bull.net>
diff -r -u a/lib/ext2fs/alloc_tables.c b/lib/ext2fs/alloc_tables.c
--- a/lib/ext2fs/alloc_tables.c 2008-04-23 17:32:39.000000000 -0400
+++ b/lib/ext2fs/alloc_tables.c 2008-04-23 17:31:52.000000000 -0400
@@ -84,7 +84,7 @@
errcode_t retval;
blk_t group_blk, start_blk, last_blk, new_blk, blk;
dgrp_t last_grp;
- int j, rem_grps, flexbg_size = 0;
+ int j, rem_grps, flexbg_size = 0, last_flexbg_size = 0;
group_blk = ext2fs_group_first_block(fs, group);
last_blk = ext2fs_group_last_block(fs, group);
@@ -96,10 +96,14 @@
EXT4_FEATURE_INCOMPAT_FLEX_BG) &&
fs->super->s_log_groups_per_flex) {
flexbg_size = 1 << fs->super->s_log_groups_per_flex;
+ last_flexbg_size = fs->group_desc_count -
+ ((group / flexbg_size) * flexbg_size);
last_grp = group | (flexbg_size - 1);
- rem_grps = last_grp - group;
if (last_grp > fs->group_desc_count)
last_grp = fs->group_desc_count;
+ if (last_flexbg_size > flexbg_size)
+ last_flexbg_size = flexbg_size;
+ rem_grps = last_grp - group;
}
/*
@@ -151,7 +155,8 @@
if (group && fs->group_desc[group-1].bg_inode_bitmap)
prev_block = fs->group_desc[group-1].bg_inode_bitmap;
start_blk = flexbg_offset(fs, group, prev_block, bmap,
- flexbg_size, rem_grps);
+ last_flexbg_size - 1,
+ rem_grps);
last_blk = ext2fs_group_last_block(fs, last_grp);
}
@@ -182,7 +187,7 @@
if (group && fs->group_desc[group-1].bg_inode_table)
prev_block = fs->group_desc[group-1].bg_inode_table;
group_blk = flexbg_offset(fs, group, prev_block, bmap,
- flexbg_size * 2,
+ last_flexbg_size * 2 - 1,
fs->inode_blocks_per_group *
rem_grps);
last_blk = ext2fs_group_last_block(fs, last_grp);
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-04-23 16:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-23 16:38 flexbg metadata offset Celine Bourde
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.