[RFC 3/13] extents and 48bit ext3: ext3 fsblk types and fixes

[RFC 3/13] extents and 48bit ext3: ext3 fsblk types and fixes

Post by Mingming C » Sat, 10 Jun 2006 10:30:06


Some of the in-kernel ext3 block variable type are treated as signed 4 bytes
int type, thus limited ext3 filesystem to 8TB (4kblock size based). While
trying to fix them, it seems quite confusing in the ext3 code where some
blocks are filesystem-wide blocks, some are group relative offsets that need
to be signed value (as -1 has special meaning). So it seem saner to define two
types of physical blocks: one is filesystem wide blocks, another is
group-relative blocks.

With this series of patches and the percpu counter data type changes in the mm
tree, we are able to extend exts filesystem limit to 16TB.

This work is also a pre-request for the recent >32 bit ext3 work, and makes the
kernel to able to address 48 bit ext3 block a lot easier: Simply
redefine ext3_fsblk_t from unsigned long to sector_t and redefine the format
string for ext3 filesystem block corresponding.

The following patches clarify these two types of blocks in the ext3 code,
and fix the type bugs which limit current 32 bit ext3 filesystem limit to 8TB

Signed-Off-By: Mingming Cao< XXXX@XXXXX.COM >


---

linux-2.6.16-ming/fs/ext3/balloc.c | 215 ++++++++++++++--------------
linux-2.6.16-ming/fs/ext3/ialloc.c | 10 -
linux-2.6.16-ming/fs/ext3/inode.c | 2
linux-2.6.16-ming/fs/ext3/resize.c | 43 +++--
linux-2.6.16-ming/fs/ext3/super.c | 2
linux-2.6.16-ming/fs/ext3/xattr.c | 27 +--
linux-2.6.16-ming/include/linux/ext3_fs.h | 19 +-
linux-2.6.16-ming/include/linux/ext3_fs_i.h | 8 +
8 files changed, 177 insertions(+), 149 deletions(-)

diff -puN fs/ext3/balloc.c~ext3_fsblk_t_fixes fs/ext3/balloc.c
--- linux-2.6.16/fs/ext3/balloc.c~ext3_fsblk_t_fixes 2006-06-07 15:42:55.000000000 -0700
+++ linux-2.6.16-ming/fs/ext3/balloc.c 2006-06-08 16:50:04.103199446 -0700
@@ -163,10 +163,10 @@ restart:
#endif

static int
-goal_in_my_reservation(struct ext3_reserve_window *rsv, int goal,
+goal_in_my_reservation(struct ext3_reserve_window *rsv, ext3_grpblk_t grp_goal,
unsigned int group, struct super_block * sb)
{
- unsigned long group_first_block, group_last_block;
+ ext3_fsblk_t group_first_block, group_last_block;

group_first_block = le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block) +
group * EXT3_BLOCKS_PER_GROUP(sb);
@@ -175,8 +175,8 @@ goal_in_my_reservation(struct ext3_reser
if ((rsv->_rsv_start > group_last_block) ||
(rsv->_rsv_end < group_first_block))
return 0;
- if ((goal >= 0) && ((goal + group_first_block < rsv->_rsv_start)
- || (goal + group_first_block > rsv->_rsv_end)))
+ if ((grp_goal >= 0) && ((grp_goal + group_first_block < rsv->_rsv_start)
+ || (grp_goal + group_first_block > rsv->_rsv_end)))
return 0;
return 1;
}
@@ -187,7 +187,7 @@ goal_in_my_reservation(struct ext3_reser
* Returns NULL if there are no windows or if all windows start after the goal.
*/
static struct ext3_reserve_window_node *
-search_reserve_window(struct rb_root *root, unsigned long goal)
+search_reserve_window(struct rb_root *root, ext3_fsblk_t goal)
{
struct rb_node *n = root->rb_node;
struct ext3_reserve_window_node *rsv;
@@ -223,7 +223,7 @@ void ext3_rsv_window_add(struct super_bl
{
struct rb_root *root = &EXT3_SB(sb)->s_rsv_window_root;
struct rb_node *node = &rsv->rsv_node;
- unsigned int start = rsv->rsv_start;
+ ext3_