diff options
author | Laurent Vivier <Laurent.Vivier@bull.net> | 2006-10-11 04:21:10 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-11 14:14:17 -0400 |
commit | bd81d8eec043094d3ff729a8ff6d5b3a06d3c4b1 (patch) | |
tree | 6813a81b8d8453536839d8bcdc8ed924fdab3f44 /fs/ext4/balloc.c | |
parent | a1ddeb7eaecea6a924e3a79aa386797020cb436f (diff) |
[PATCH] ext4: 64bit metadata
In-kernel super block changes to support >32 bit free blocks numbers.
Signed-off-by: Laurent Vivier <Laurent.Vivier@bull.net>
Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com>
Signed-off-by: Alexandre Ratchov <alexandre.ratchov@bull.net>
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.c | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c index aa33ff271fa9..6887151ccc47 100644 --- a/fs/ext4/balloc.c +++ b/fs/ext4/balloc.c | |||
@@ -99,12 +99,13 @@ read_block_bitmap(struct super_block *sb, unsigned int block_group) | |||
99 | desc = ext4_get_group_desc (sb, block_group, NULL); | 99 | desc = ext4_get_group_desc (sb, block_group, NULL); |
100 | if (!desc) | 100 | if (!desc) |
101 | goto error_out; | 101 | goto error_out; |
102 | bh = sb_bread(sb, le32_to_cpu(desc->bg_block_bitmap)); | 102 | bh = sb_bread(sb, ext4_block_bitmap(desc)); |
103 | if (!bh) | 103 | if (!bh) |
104 | ext4_error (sb, "read_block_bitmap", | 104 | ext4_error (sb, "read_block_bitmap", |
105 | "Cannot read block bitmap - " | 105 | "Cannot read block bitmap - " |
106 | "block_group = %d, block_bitmap = %u", | 106 | "block_group = %d, block_bitmap = "E3FSBLK, |
107 | block_group, le32_to_cpu(desc->bg_block_bitmap)); | 107 | block_group, |
108 | ext4_block_bitmap(desc)); | ||
108 | error_out: | 109 | error_out: |
109 | return bh; | 110 | return bh; |
110 | } | 111 | } |
@@ -432,14 +433,14 @@ void ext4_free_blocks_sb(handle_t *handle, struct super_block *sb, | |||
432 | es = sbi->s_es; | 433 | es = sbi->s_es; |
433 | if (block < le32_to_cpu(es->s_first_data_block) || | 434 | if (block < le32_to_cpu(es->s_first_data_block) || |
434 | block + count < block || | 435 | block + count < block || |
435 | block + count > le32_to_cpu(es->s_blocks_count)) { | 436 | block + count > ext4_blocks_count(es)) { |
436 | ext4_error (sb, "ext4_free_blocks", | 437 | ext4_error (sb, "ext4_free_blocks", |
437 | "Freeing blocks not in datazone - " | 438 | "Freeing blocks not in datazone - " |
438 | "block = "E3FSBLK", count = %lu", block, count); | 439 | "block = "E3FSBLK", count = %lu", block, count); |
439 | goto error_return; | 440 | goto error_return; |
440 | } | 441 | } |
441 | 442 | ||
442 | ext4_debug ("freeing block(s) %lu-%lu\n", block, block + count - 1); | 443 | ext4_debug ("freeing block(s) %llu-%llu\n", block, block + count - 1); |
443 | 444 | ||
444 | do_more: | 445 | do_more: |
445 | overflow = 0; | 446 | overflow = 0; |
@@ -460,12 +461,11 @@ do_more: | |||
460 | if (!desc) | 461 | if (!desc) |
461 | goto error_return; | 462 | goto error_return; |
462 | 463 | ||
463 | if (in_range (le32_to_cpu(desc->bg_block_bitmap), block, count) || | 464 | if (in_range(ext4_block_bitmap(desc), block, count) || |
464 | in_range (le32_to_cpu(desc->bg_inode_bitmap), block, count) || | 465 | in_range(ext4_inode_bitmap(desc), block, count) || |
465 | in_range (block, le32_to_cpu(desc->bg_inode_table), | 466 | in_range(block, ext4_inode_table(desc), sbi->s_itb_per_group) || |
466 | sbi->s_itb_per_group) || | 467 | in_range(block + count - 1, ext4_inode_table(desc), |
467 | in_range (block + count - 1, le32_to_cpu(desc->bg_inode_table), | 468 | sbi->s_itb_per_group)) |
468 | sbi->s_itb_per_group)) | ||
469 | ext4_error (sb, "ext4_free_blocks", | 469 | ext4_error (sb, "ext4_free_blocks", |
470 | "Freeing blocks in system zones - " | 470 | "Freeing blocks in system zones - " |
471 | "Block = "E3FSBLK", count = %lu", | 471 | "Block = "E3FSBLK", count = %lu", |
@@ -552,8 +552,8 @@ do_more: | |||
552 | bit + i, bitmap_bh->b_data)) { | 552 | bit + i, bitmap_bh->b_data)) { |
553 | jbd_unlock_bh_state(bitmap_bh); | 553 | jbd_unlock_bh_state(bitmap_bh); |
554 | ext4_error(sb, __FUNCTION__, | 554 | ext4_error(sb, __FUNCTION__, |
555 | "bit already cleared for block "E3FSBLK, | 555 | "bit already cleared for block "E3FSBLK, |
556 | block + i); | 556 | (ext4_fsblk_t)(block + i)); |
557 | jbd_lock_bh_state(bitmap_bh); | 557 | jbd_lock_bh_state(bitmap_bh); |
558 | BUFFER_TRACE(bitmap_bh, "bit already cleared"); | 558 | BUFFER_TRACE(bitmap_bh, "bit already cleared"); |
559 | } else { | 559 | } else { |
@@ -1351,7 +1351,7 @@ static int ext4_has_free_blocks(struct ext4_sb_info *sbi) | |||
1351 | ext4_fsblk_t free_blocks, root_blocks; | 1351 | ext4_fsblk_t free_blocks, root_blocks; |
1352 | 1352 | ||
1353 | free_blocks = percpu_counter_read_positive(&sbi->s_freeblocks_counter); | 1353 | free_blocks = percpu_counter_read_positive(&sbi->s_freeblocks_counter); |
1354 | root_blocks = le32_to_cpu(sbi->s_es->s_r_blocks_count); | 1354 | root_blocks = ext4_r_blocks_count(sbi->s_es); |
1355 | if (free_blocks < root_blocks + 1 && !capable(CAP_SYS_RESOURCE) && | 1355 | if (free_blocks < root_blocks + 1 && !capable(CAP_SYS_RESOURCE) && |
1356 | sbi->s_resuid != current->fsuid && | 1356 | sbi->s_resuid != current->fsuid && |
1357 | (sbi->s_resgid == 0 || !in_group_p (sbi->s_resgid))) { | 1357 | (sbi->s_resgid == 0 || !in_group_p (sbi->s_resgid))) { |
@@ -1462,7 +1462,7 @@ ext4_fsblk_t ext4_new_blocks(handle_t *handle, struct inode *inode, | |||
1462 | * First, test whether the goal block is free. | 1462 | * First, test whether the goal block is free. |
1463 | */ | 1463 | */ |
1464 | if (goal < le32_to_cpu(es->s_first_data_block) || | 1464 | if (goal < le32_to_cpu(es->s_first_data_block) || |
1465 | goal >= le32_to_cpu(es->s_blocks_count)) | 1465 | goal >= ext4_blocks_count(es)) |
1466 | goal = le32_to_cpu(es->s_first_data_block); | 1466 | goal = le32_to_cpu(es->s_first_data_block); |
1467 | ext4_get_group_no_and_offset(sb, goal, &group_no, &grp_target_blk); | 1467 | ext4_get_group_no_and_offset(sb, goal, &group_no, &grp_target_blk); |
1468 | goal_group = group_no; | 1468 | goal_group = group_no; |
@@ -1561,12 +1561,12 @@ allocated: | |||
1561 | 1561 | ||
1562 | ret_block = grp_alloc_blk + ext4_group_first_block_no(sb, group_no); | 1562 | ret_block = grp_alloc_blk + ext4_group_first_block_no(sb, group_no); |
1563 | 1563 | ||
1564 | if (in_range(le32_to_cpu(gdp->bg_block_bitmap), ret_block, num) || | 1564 | if (in_range(ext4_block_bitmap(gdp), ret_block, num) || |
1565 | in_range(le32_to_cpu(gdp->bg_inode_bitmap), ret_block, num) || | 1565 | in_range(ext4_block_bitmap(gdp), ret_block, num) || |
1566 | in_range(ret_block, le32_to_cpu(gdp->bg_inode_table), | 1566 | in_range(ret_block, ext4_inode_table(gdp), |
1567 | EXT4_SB(sb)->s_itb_per_group) || | 1567 | EXT4_SB(sb)->s_itb_per_group) || |
1568 | in_range(ret_block + num - 1, le32_to_cpu(gdp->bg_inode_table), | 1568 | in_range(ret_block + num - 1, ext4_inode_table(gdp), |
1569 | EXT4_SB(sb)->s_itb_per_group)) | 1569 | EXT4_SB(sb)->s_itb_per_group)) |
1570 | ext4_error(sb, "ext4_new_block", | 1570 | ext4_error(sb, "ext4_new_block", |
1571 | "Allocating block in system zone - " | 1571 | "Allocating block in system zone - " |
1572 | "blocks from "E3FSBLK", length %lu", | 1572 | "blocks from "E3FSBLK", length %lu", |
@@ -1604,11 +1604,11 @@ allocated: | |||
1604 | jbd_unlock_bh_state(bitmap_bh); | 1604 | jbd_unlock_bh_state(bitmap_bh); |
1605 | #endif | 1605 | #endif |
1606 | 1606 | ||
1607 | if (ret_block + num - 1 >= le32_to_cpu(es->s_blocks_count)) { | 1607 | if (ret_block + num - 1 >= ext4_blocks_count(es)) { |
1608 | ext4_error(sb, "ext4_new_block", | 1608 | ext4_error(sb, "ext4_new_block", |
1609 | "block("E3FSBLK") >= blocks count(%d) - " | 1609 | "block("E3FSBLK") >= blocks count("E3FSBLK") - " |
1610 | "block_group = %lu, es == %p ", ret_block, | 1610 | "block_group = %lu, es == %p ", ret_block, |
1611 | le32_to_cpu(es->s_blocks_count), group_no, es); | 1611 | ext4_blocks_count(es), group_no, es); |
1612 | goto out; | 1612 | goto out; |
1613 | } | 1613 | } |
1614 | 1614 | ||
@@ -1707,7 +1707,7 @@ ext4_fsblk_t ext4_count_free_blocks(struct super_block *sb) | |||
1707 | brelse(bitmap_bh); | 1707 | brelse(bitmap_bh); |
1708 | printk("ext4_count_free_blocks: stored = "E3FSBLK | 1708 | printk("ext4_count_free_blocks: stored = "E3FSBLK |
1709 | ", computed = "E3FSBLK", "E3FSBLK"\n", | 1709 | ", computed = "E3FSBLK", "E3FSBLK"\n", |
1710 | le32_to_cpu(es->s_free_blocks_count), | 1710 | EXT4_FREE_BLOCKS_COUNT(es), |
1711 | desc_count, bitmap_count); | 1711 | desc_count, bitmap_count); |
1712 | return bitmap_count; | 1712 | return bitmap_count; |
1713 | #else | 1713 | #else |