aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/balloc.c
diff options
context:
space:
mode:
authorMingming Cao <cmm@us.ibm.com>2006-10-11 04:21:05 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-11 14:14:16 -0400
commit3a5b2ecdd1fa63a8f25bd769223bc1c2564ce45d (patch)
treedc80fdde9ed01e77ef0ed6fdef7573d303bd07db /fs/ext4/balloc.c
parenta86c61812637c7dd0c57e29880cffd477b62f2e7 (diff)
[PATCH] ext4: switch fsblk to sector_t
Redefine ext3 in-kernel filesystem block type (ext3_fsblk_t) from unsigned long to sector_t, to allow kernel to handle >32 bit ext3 blocks. Signed-off-by: Mingming Cao <cmm@us.ibm.com> Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/ext4/balloc.c')
-rw-r--r--fs/ext4/balloc.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index e9e98449137b..aa33ff271fa9 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -147,7 +147,7 @@ restart:
147 rsv = list_entry(n, struct ext4_reserve_window_node, rsv_node); 147 rsv = list_entry(n, struct ext4_reserve_window_node, rsv_node);
148 if (verbose) 148 if (verbose)
149 printk("reservation window 0x%p " 149 printk("reservation window 0x%p "
150 "start: %lu, end: %lu\n", 150 "start: "E3FSBLK", end: "E3FSBLK"\n",
151 rsv, rsv->rsv_start, rsv->rsv_end); 151 rsv, rsv->rsv_start, rsv->rsv_end);
152 if (rsv->rsv_start && rsv->rsv_start >= rsv->rsv_end) { 152 if (rsv->rsv_start && rsv->rsv_start >= rsv->rsv_end) {
153 printk("Bad reservation %p (start >= end)\n", 153 printk("Bad reservation %p (start >= end)\n",
@@ -443,10 +443,7 @@ void ext4_free_blocks_sb(handle_t *handle, struct super_block *sb,
443 443
444do_more: 444do_more:
445 overflow = 0; 445 overflow = 0;
446 block_group = (block - le32_to_cpu(es->s_first_data_block)) / 446 ext4_get_group_no_and_offset(sb, block, &block_group, &bit);
447 EXT4_BLOCKS_PER_GROUP(sb);
448 bit = (block - le32_to_cpu(es->s_first_data_block)) %
449 EXT4_BLOCKS_PER_GROUP(sb);
450 /* 447 /*
451 * Check to see if we are freeing blocks across a group 448 * Check to see if we are freeing blocks across a group
452 * boundary. 449 * boundary.
@@ -1404,7 +1401,7 @@ ext4_fsblk_t ext4_new_blocks(handle_t *handle, struct inode *inode,
1404{ 1401{
1405 struct buffer_head *bitmap_bh = NULL; 1402 struct buffer_head *bitmap_bh = NULL;
1406 struct buffer_head *gdp_bh; 1403 struct buffer_head *gdp_bh;
1407 int group_no; 1404 unsigned long group_no;
1408 int goal_group; 1405 int goal_group;
1409 ext4_grpblk_t grp_target_blk; /* blockgroup relative goal block */ 1406 ext4_grpblk_t grp_target_blk; /* blockgroup relative goal block */
1410 ext4_grpblk_t grp_alloc_blk; /* blockgroup-relative allocated block*/ 1407 ext4_grpblk_t grp_alloc_blk; /* blockgroup-relative allocated block*/
@@ -1467,8 +1464,7 @@ ext4_fsblk_t ext4_new_blocks(handle_t *handle, struct inode *inode,
1467 if (goal < le32_to_cpu(es->s_first_data_block) || 1464 if (goal < le32_to_cpu(es->s_first_data_block) ||
1468 goal >= le32_to_cpu(es->s_blocks_count)) 1465 goal >= le32_to_cpu(es->s_blocks_count))
1469 goal = le32_to_cpu(es->s_first_data_block); 1466 goal = le32_to_cpu(es->s_first_data_block);
1470 group_no = (goal - le32_to_cpu(es->s_first_data_block)) / 1467 ext4_get_group_no_and_offset(sb, goal, &group_no, &grp_target_blk);
1471 EXT4_BLOCKS_PER_GROUP(sb);
1472 goal_group = group_no; 1468 goal_group = group_no;
1473retry_alloc: 1469retry_alloc:
1474 gdp = ext4_get_group_desc(sb, group_no, &gdp_bh); 1470 gdp = ext4_get_group_desc(sb, group_no, &gdp_bh);
@@ -1485,8 +1481,6 @@ retry_alloc:
1485 my_rsv = NULL; 1481 my_rsv = NULL;
1486 1482
1487 if (free_blocks > 0) { 1483 if (free_blocks > 0) {
1488 grp_target_blk = ((goal - le32_to_cpu(es->s_first_data_block)) %
1489 EXT4_BLOCKS_PER_GROUP(sb));
1490 bitmap_bh = read_block_bitmap(sb, group_no); 1484 bitmap_bh = read_block_bitmap(sb, group_no);
1491 if (!bitmap_bh) 1485 if (!bitmap_bh)
1492 goto io_error; 1486 goto io_error;
@@ -1613,7 +1607,7 @@ allocated:
1613 if (ret_block + num - 1 >= le32_to_cpu(es->s_blocks_count)) { 1607 if (ret_block + num - 1 >= le32_to_cpu(es->s_blocks_count)) {
1614 ext4_error(sb, "ext4_new_block", 1608 ext4_error(sb, "ext4_new_block",
1615 "block("E3FSBLK") >= blocks count(%d) - " 1609 "block("E3FSBLK") >= blocks count(%d) - "
1616 "block_group = %d, es == %p ", ret_block, 1610 "block_group = %lu, es == %p ", ret_block,
1617 le32_to_cpu(es->s_blocks_count), group_no, es); 1611 le32_to_cpu(es->s_blocks_count), group_no, es);
1618 goto out; 1612 goto out;
1619 } 1613 }
@@ -1733,9 +1727,10 @@ ext4_fsblk_t ext4_count_free_blocks(struct super_block *sb)
1733static inline int 1727static inline int
1734block_in_use(ext4_fsblk_t block, struct super_block *sb, unsigned char *map) 1728block_in_use(ext4_fsblk_t block, struct super_block *sb, unsigned char *map)
1735{ 1729{
1736 return ext4_test_bit ((block - 1730 ext4_grpblk_t offset;
1737 le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block)) % 1731
1738 EXT4_BLOCKS_PER_GROUP(sb), map); 1732 ext4_get_group_no_and_offset(sb, block, NULL, &offset);
1733 return ext4_test_bit (offset, map);
1739} 1734}
1740 1735
1741static inline int test_root(int a, int b) 1736static inline int test_root(int a, int b)