aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext3/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext3/inode.c')
-rw-r--r--fs/ext3/inode.c55
1 files changed, 28 insertions, 27 deletions
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index b02bc32c57a4..0321e1b9034a 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -407,13 +407,13 @@ no_block:
407 * 407 *
408 * Caller must make sure that @ind is valid and will stay that way. 408 * Caller must make sure that @ind is valid and will stay that way.
409 */ 409 */
410static unsigned long ext3_find_near(struct inode *inode, Indirect *ind) 410static ext3_fsblk_t ext3_find_near(struct inode *inode, Indirect *ind)
411{ 411{
412 struct ext3_inode_info *ei = EXT3_I(inode); 412 struct ext3_inode_info *ei = EXT3_I(inode);
413 __le32 *start = ind->bh ? (__le32*) ind->bh->b_data : ei->i_data; 413 __le32 *start = ind->bh ? (__le32*) ind->bh->b_data : ei->i_data;
414 __le32 *p; 414 __le32 *p;
415 unsigned long bg_start; 415 ext3_fsblk_t bg_start;
416 unsigned long colour; 416 ext3_grpblk_t colour;
417 417
418 /* Try to find previous block */ 418 /* Try to find previous block */
419 for (p = ind->p - 1; p >= start; p--) { 419 for (p = ind->p - 1; p >= start; p--) {
@@ -429,8 +429,7 @@ static unsigned long ext3_find_near(struct inode *inode, Indirect *ind)
429 * It is going to be referred to from the inode itself? OK, just put it 429 * It is going to be referred to from the inode itself? OK, just put it
430 * into the same cylinder group then. 430 * into the same cylinder group then.
431 */ 431 */
432 bg_start = (ei->i_block_group * EXT3_BLOCKS_PER_GROUP(inode->i_sb)) + 432 bg_start = ext3_group_first_block_no(inode->i_sb, ei->i_block_group);
433 le32_to_cpu(EXT3_SB(inode->i_sb)->s_es->s_first_data_block);
434 colour = (current->pid % 16) * 433 colour = (current->pid % 16) *
435 (EXT3_BLOCKS_PER_GROUP(inode->i_sb) / 16); 434 (EXT3_BLOCKS_PER_GROUP(inode->i_sb) / 16);
436 return bg_start + colour; 435 return bg_start + colour;
@@ -448,7 +447,7 @@ static unsigned long ext3_find_near(struct inode *inode, Indirect *ind)
448 * stores it in *@goal and returns zero. 447 * stores it in *@goal and returns zero.
449 */ 448 */
450 449
451static unsigned long ext3_find_goal(struct inode *inode, long block, 450static ext3_fsblk_t ext3_find_goal(struct inode *inode, long block,
452 Indirect chain[4], Indirect *partial) 451 Indirect chain[4], Indirect *partial)
453{ 452{
454 struct ext3_block_alloc_info *block_i; 453 struct ext3_block_alloc_info *block_i;
@@ -516,13 +515,13 @@ static int ext3_blks_to_allocate(Indirect *branch, int k, unsigned long blks,
516 * direct blocks 515 * direct blocks
517 */ 516 */
518static int ext3_alloc_blocks(handle_t *handle, struct inode *inode, 517static int ext3_alloc_blocks(handle_t *handle, struct inode *inode,
519 unsigned long goal, int indirect_blks, int blks, 518 ext3_fsblk_t goal, int indirect_blks, int blks,
520 unsigned long long new_blocks[4], int *err) 519 ext3_fsblk_t new_blocks[4], int *err)
521{ 520{
522 int target, i; 521 int target, i;
523 unsigned long count = 0; 522 unsigned long count = 0;
524 int index = 0; 523 int index = 0;
525 unsigned long current_block = 0; 524 ext3_fsblk_t current_block = 0;
526 int ret = 0; 525 int ret = 0;
527 526
528 /* 527 /*
@@ -592,7 +591,7 @@ failed_out:
592 * as described above and return 0. 591 * as described above and return 0.
593 */ 592 */
594static int ext3_alloc_branch(handle_t *handle, struct inode *inode, 593static int ext3_alloc_branch(handle_t *handle, struct inode *inode,
595 int indirect_blks, int *blks, unsigned long goal, 594 int indirect_blks, int *blks, ext3_fsblk_t goal,
596 int *offsets, Indirect *branch) 595 int *offsets, Indirect *branch)
597{ 596{
598 int blocksize = inode->i_sb->s_blocksize; 597 int blocksize = inode->i_sb->s_blocksize;
@@ -600,8 +599,8 @@ static int ext3_alloc_branch(handle_t *handle, struct inode *inode,
600 int err = 0; 599 int err = 0;
601 struct buffer_head *bh; 600 struct buffer_head *bh;
602 int num; 601 int num;
603 unsigned long long new_blocks[4]; 602 ext3_fsblk_t new_blocks[4];
604 unsigned long long current_block; 603 ext3_fsblk_t current_block;
605 604
606 num = ext3_alloc_blocks(handle, inode, goal, indirect_blks, 605 num = ext3_alloc_blocks(handle, inode, goal, indirect_blks,
607 *blks, new_blocks, &err); 606 *blks, new_blocks, &err);
@@ -688,7 +687,7 @@ static int ext3_splice_branch(handle_t *handle, struct inode *inode,
688 int i; 687 int i;
689 int err = 0; 688 int err = 0;
690 struct ext3_block_alloc_info *block_i; 689 struct ext3_block_alloc_info *block_i;
691 unsigned long current_block; 690 ext3_fsblk_t current_block;
692 691
693 block_i = EXT3_I(inode)->i_block_alloc_info; 692 block_i = EXT3_I(inode)->i_block_alloc_info;
694 /* 693 /*
@@ -795,13 +794,13 @@ int ext3_get_blocks_handle(handle_t *handle, struct inode *inode,
795 int offsets[4]; 794 int offsets[4];
796 Indirect chain[4]; 795 Indirect chain[4];
797 Indirect *partial; 796 Indirect *partial;
798 unsigned long goal; 797 ext3_fsblk_t goal;
799 int indirect_blks; 798 int indirect_blks;
800 int blocks_to_boundary = 0; 799 int blocks_to_boundary = 0;
801 int depth; 800 int depth;
802 struct ext3_inode_info *ei = EXT3_I(inode); 801 struct ext3_inode_info *ei = EXT3_I(inode);
803 int count = 0; 802 int count = 0;
804 unsigned long first_block = 0; 803 ext3_fsblk_t first_block = 0;
805 804
806 805
807 J_ASSERT(handle != NULL || create == 0); 806 J_ASSERT(handle != NULL || create == 0);
@@ -819,7 +818,7 @@ int ext3_get_blocks_handle(handle_t *handle, struct inode *inode,
819 count++; 818 count++;
820 /*map more blocks*/ 819 /*map more blocks*/
821 while (count < maxblocks && count <= blocks_to_boundary) { 820 while (count < maxblocks && count <= blocks_to_boundary) {
822 unsigned long blk; 821 ext3_fsblk_t blk;
823 822
824 if (!verify_chain(chain, partial)) { 823 if (!verify_chain(chain, partial)) {
825 /* 824 /*
@@ -1759,7 +1758,7 @@ void ext3_set_aops(struct inode *inode)
1759static int ext3_block_truncate_page(handle_t *handle, struct page *page, 1758static int ext3_block_truncate_page(handle_t *handle, struct page *page,
1760 struct address_space *mapping, loff_t from) 1759 struct address_space *mapping, loff_t from)
1761{ 1760{
1762 unsigned long index = from >> PAGE_CACHE_SHIFT; 1761 ext3_fsblk_t index = from >> PAGE_CACHE_SHIFT;
1763 unsigned offset = from & (PAGE_CACHE_SIZE-1); 1762 unsigned offset = from & (PAGE_CACHE_SIZE-1);
1764 unsigned blocksize, iblock, length, pos; 1763 unsigned blocksize, iblock, length, pos;
1765 struct inode *inode = mapping->host; 1764 struct inode *inode = mapping->host;
@@ -1960,7 +1959,7 @@ no_top:
1960 * than `count' because there can be holes in there. 1959 * than `count' because there can be holes in there.
1961 */ 1960 */
1962static void ext3_clear_blocks(handle_t *handle, struct inode *inode, 1961static void ext3_clear_blocks(handle_t *handle, struct inode *inode,
1963 struct buffer_head *bh, unsigned long block_to_free, 1962 struct buffer_head *bh, ext3_fsblk_t block_to_free,
1964 unsigned long count, __le32 *first, __le32 *last) 1963 unsigned long count, __le32 *first, __le32 *last)
1965{ 1964{
1966 __le32 *p; 1965 __le32 *p;
@@ -2022,12 +2021,12 @@ static void ext3_free_data(handle_t *handle, struct inode *inode,
2022 struct buffer_head *this_bh, 2021 struct buffer_head *this_bh,
2023 __le32 *first, __le32 *last) 2022 __le32 *first, __le32 *last)
2024{ 2023{
2025 unsigned long block_to_free = 0; /* Starting block # of a run */ 2024 ext3_fsblk_t block_to_free = 0; /* Starting block # of a run */
2026 unsigned long count = 0; /* Number of blocks in the run */ 2025 unsigned long count = 0; /* Number of blocks in the run */
2027 __le32 *block_to_free_p = NULL; /* Pointer into inode/ind 2026 __le32 *block_to_free_p = NULL; /* Pointer into inode/ind
2028 corresponding to 2027 corresponding to
2029 block_to_free */ 2028 block_to_free */
2030 unsigned long nr; /* Current block # */ 2029 ext3_fsblk_t nr; /* Current block # */
2031 __le32 *p; /* Pointer into inode/ind 2030 __le32 *p; /* Pointer into inode/ind
2032 for current block */ 2031 for current block */
2033 int err; 2032 int err;
@@ -2089,7 +2088,7 @@ static void ext3_free_branches(handle_t *handle, struct inode *inode,
2089 struct buffer_head *parent_bh, 2088 struct buffer_head *parent_bh,
2090 __le32 *first, __le32 *last, int depth) 2089 __le32 *first, __le32 *last, int depth)
2091{ 2090{
2092 unsigned long nr; 2091 ext3_fsblk_t nr;
2093 __le32 *p; 2092 __le32 *p;
2094 2093
2095 if (is_handle_aborted(handle)) 2094 if (is_handle_aborted(handle))
@@ -2113,7 +2112,7 @@ static void ext3_free_branches(handle_t *handle, struct inode *inode,
2113 */ 2112 */
2114 if (!bh) { 2113 if (!bh) {
2115 ext3_error(inode->i_sb, "ext3_free_branches", 2114 ext3_error(inode->i_sb, "ext3_free_branches",
2116 "Read failure, inode=%ld, block=%ld", 2115 "Read failure, inode=%ld, block="E3FSBLK,
2117 inode->i_ino, nr); 2116 inode->i_ino, nr);
2118 continue; 2117 continue;
2119 } 2118 }
@@ -2394,11 +2393,12 @@ out_stop:
2394 ext3_journal_stop(handle); 2393 ext3_journal_stop(handle);
2395} 2394}
2396 2395
2397static unsigned long ext3_get_inode_block(struct super_block *sb, 2396static ext3_fsblk_t ext3_get_inode_block(struct super_block *sb,
2398 unsigned long ino, struct ext3_iloc *iloc) 2397 unsigned long ino, struct ext3_iloc *iloc)
2399{ 2398{
2400 unsigned long desc, group_desc, block_group; 2399 unsigned long desc, group_desc, block_group;
2401 unsigned long offset, block; 2400 unsigned long offset;
2401 ext3_fsblk_t block;
2402 struct buffer_head *bh; 2402 struct buffer_head *bh;
2403 struct ext3_group_desc * gdp; 2403 struct ext3_group_desc * gdp;
2404 2404
@@ -2448,7 +2448,7 @@ static unsigned long ext3_get_inode_block(struct super_block *sb,
2448static int __ext3_get_inode_loc(struct inode *inode, 2448static int __ext3_get_inode_loc(struct inode *inode,
2449 struct ext3_iloc *iloc, int in_mem) 2449 struct ext3_iloc *iloc, int in_mem)
2450{ 2450{
2451 unsigned long block; 2451 ext3_fsblk_t block;
2452 struct buffer_head *bh; 2452 struct buffer_head *bh;
2453 2453
2454 block = ext3_get_inode_block(inode->i_sb, inode->i_ino, iloc); 2454 block = ext3_get_inode_block(inode->i_sb, inode->i_ino, iloc);
@@ -2459,7 +2459,8 @@ static int __ext3_get_inode_loc(struct inode *inode,
2459 if (!bh) { 2459 if (!bh) {
2460 ext3_error (inode->i_sb, "ext3_get_inode_loc", 2460 ext3_error (inode->i_sb, "ext3_get_inode_loc",
2461 "unable to read inode block - " 2461 "unable to read inode block - "
2462 "inode=%lu, block=%lu", inode->i_ino, block); 2462 "inode=%lu, block="E3FSBLK,
2463 inode->i_ino, block);
2463 return -EIO; 2464 return -EIO;
2464 } 2465 }
2465 if (!buffer_uptodate(bh)) { 2466 if (!buffer_uptodate(bh)) {
@@ -2540,7 +2541,7 @@ make_io:
2540 if (!buffer_uptodate(bh)) { 2541 if (!buffer_uptodate(bh)) {
2541 ext3_error(inode->i_sb, "ext3_get_inode_loc", 2542 ext3_error(inode->i_sb, "ext3_get_inode_loc",
2542 "unable to read inode block - " 2543 "unable to read inode block - "
2543 "inode=%lu, block=%lu", 2544 "inode=%lu, block="E3FSBLK,
2544 inode->i_ino, block); 2545 inode->i_ino, block);
2545 brelse(bh); 2546 brelse(bh);
2546 return -EIO; 2547 return -EIO;