diff options
author | Dave Jones <davej@redhat.com> | 2006-06-29 16:01:54 -0400 |
---|---|---|
committer | Dave Jones <davej@redhat.com> | 2006-06-29 16:01:54 -0400 |
commit | 55b4d6a52195a8f277ffddf755ddaff359878f41 (patch) | |
tree | 06a3183a562f8da4688f65023f7a18dcad702956 /fs/ext3 | |
parent | adf8a287150667feb5747f8beade62acacc17d4e (diff) | |
parent | 1f1332f727c3229eb2166a83fec5d3de6a73dce2 (diff) |
Merge ../linus
Conflicts:
drivers/char/agp/Kconfig
Diffstat (limited to 'fs/ext3')
-rw-r--r-- | fs/ext3/balloc.c | 242 | ||||
-rw-r--r-- | fs/ext3/dir.c | 2 | ||||
-rw-r--r-- | fs/ext3/ialloc.c | 10 | ||||
-rw-r--r-- | fs/ext3/inode.c | 63 | ||||
-rw-r--r-- | fs/ext3/ioctl.c | 2 | ||||
-rw-r--r-- | fs/ext3/namei.c | 4 | ||||
-rw-r--r-- | fs/ext3/resize.c | 81 | ||||
-rw-r--r-- | fs/ext3/super.c | 122 | ||||
-rw-r--r-- | fs/ext3/xattr.c | 27 |
9 files changed, 298 insertions, 255 deletions
diff --git a/fs/ext3/balloc.c b/fs/ext3/balloc.c index 77927d6938..96172e89dd 100644 --- a/fs/ext3/balloc.c +++ b/fs/ext3/balloc.c | |||
@@ -163,20 +163,19 @@ restart: | |||
163 | #endif | 163 | #endif |
164 | 164 | ||
165 | static int | 165 | static int |
166 | goal_in_my_reservation(struct ext3_reserve_window *rsv, int goal, | 166 | goal_in_my_reservation(struct ext3_reserve_window *rsv, ext3_grpblk_t grp_goal, |
167 | unsigned int group, struct super_block * sb) | 167 | unsigned int group, struct super_block * sb) |
168 | { | 168 | { |
169 | unsigned long group_first_block, group_last_block; | 169 | ext3_fsblk_t group_first_block, group_last_block; |
170 | 170 | ||
171 | group_first_block = le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block) + | 171 | group_first_block = ext3_group_first_block_no(sb, group); |
172 | group * EXT3_BLOCKS_PER_GROUP(sb); | ||
173 | group_last_block = group_first_block + EXT3_BLOCKS_PER_GROUP(sb) - 1; | 172 | group_last_block = group_first_block + EXT3_BLOCKS_PER_GROUP(sb) - 1; |
174 | 173 | ||
175 | if ((rsv->_rsv_start > group_last_block) || | 174 | if ((rsv->_rsv_start > group_last_block) || |
176 | (rsv->_rsv_end < group_first_block)) | 175 | (rsv->_rsv_end < group_first_block)) |
177 | return 0; | 176 | return 0; |
178 | if ((goal >= 0) && ((goal + group_first_block < rsv->_rsv_start) | 177 | if ((grp_goal >= 0) && ((grp_goal + group_first_block < rsv->_rsv_start) |
179 | || (goal + group_first_block > rsv->_rsv_end))) | 178 | || (grp_goal + group_first_block > rsv->_rsv_end))) |
180 | return 0; | 179 | return 0; |
181 | return 1; | 180 | return 1; |
182 | } | 181 | } |
@@ -187,7 +186,7 @@ goal_in_my_reservation(struct ext3_reserve_window *rsv, int goal, | |||
187 | * Returns NULL if there are no windows or if all windows start after the goal. | 186 | * Returns NULL if there are no windows or if all windows start after the goal. |
188 | */ | 187 | */ |
189 | static struct ext3_reserve_window_node * | 188 | static struct ext3_reserve_window_node * |
190 | search_reserve_window(struct rb_root *root, unsigned long goal) | 189 | search_reserve_window(struct rb_root *root, ext3_fsblk_t goal) |
191 | { | 190 | { |
192 | struct rb_node *n = root->rb_node; | 191 | struct rb_node *n = root->rb_node; |
193 | struct ext3_reserve_window_node *rsv; | 192 | struct ext3_reserve_window_node *rsv; |
@@ -223,7 +222,7 @@ void ext3_rsv_window_add(struct super_block *sb, | |||
223 | { | 222 | { |
224 | struct rb_root *root = &EXT3_SB(sb)->s_rsv_window_root; | 223 | struct rb_root *root = &EXT3_SB(sb)->s_rsv_window_root; |
225 | struct rb_node *node = &rsv->rsv_node; | 224 | struct rb_node *node = &rsv->rsv_node; |
226 | unsigned int start = rsv->rsv_start; | 225 | ext3_fsblk_t start = rsv->rsv_start; |
227 | 226 | ||
228 | struct rb_node ** p = &root->rb_node; | 227 | struct rb_node ** p = &root->rb_node; |
229 | struct rb_node * parent = NULL; | 228 | struct rb_node * parent = NULL; |
@@ -310,20 +309,20 @@ void ext3_discard_reservation(struct inode *inode) | |||
310 | 309 | ||
311 | /* Free given blocks, update quota and i_blocks field */ | 310 | /* Free given blocks, update quota and i_blocks field */ |
312 | void ext3_free_blocks_sb(handle_t *handle, struct super_block *sb, | 311 | void ext3_free_blocks_sb(handle_t *handle, struct super_block *sb, |
313 | unsigned long block, unsigned long count, | 312 | ext3_fsblk_t block, unsigned long count, |
314 | int *pdquot_freed_blocks) | 313 | unsigned long *pdquot_freed_blocks) |
315 | { | 314 | { |
316 | struct buffer_head *bitmap_bh = NULL; | 315 | struct buffer_head *bitmap_bh = NULL; |
317 | struct buffer_head *gd_bh; | 316 | struct buffer_head *gd_bh; |
318 | unsigned long block_group; | 317 | unsigned long block_group; |
319 | unsigned long bit; | 318 | ext3_grpblk_t bit; |
320 | unsigned long i; | 319 | unsigned long i; |
321 | unsigned long overflow; | 320 | unsigned long overflow; |
322 | struct ext3_group_desc * desc; | 321 | struct ext3_group_desc * desc; |
323 | struct ext3_super_block * es; | 322 | struct ext3_super_block * es; |
324 | struct ext3_sb_info *sbi; | 323 | struct ext3_sb_info *sbi; |
325 | int err = 0, ret; | 324 | int err = 0, ret; |
326 | unsigned group_freed; | 325 | ext3_grpblk_t group_freed; |
327 | 326 | ||
328 | *pdquot_freed_blocks = 0; | 327 | *pdquot_freed_blocks = 0; |
329 | sbi = EXT3_SB(sb); | 328 | sbi = EXT3_SB(sb); |
@@ -333,7 +332,7 @@ void ext3_free_blocks_sb(handle_t *handle, struct super_block *sb, | |||
333 | block + count > le32_to_cpu(es->s_blocks_count)) { | 332 | block + count > le32_to_cpu(es->s_blocks_count)) { |
334 | ext3_error (sb, "ext3_free_blocks", | 333 | ext3_error (sb, "ext3_free_blocks", |
335 | "Freeing blocks not in datazone - " | 334 | "Freeing blocks not in datazone - " |
336 | "block = %lu, count = %lu", block, count); | 335 | "block = "E3FSBLK", count = %lu", block, count); |
337 | goto error_return; | 336 | goto error_return; |
338 | } | 337 | } |
339 | 338 | ||
@@ -369,7 +368,7 @@ do_more: | |||
369 | sbi->s_itb_per_group)) | 368 | sbi->s_itb_per_group)) |
370 | ext3_error (sb, "ext3_free_blocks", | 369 | ext3_error (sb, "ext3_free_blocks", |
371 | "Freeing blocks in system zones - " | 370 | "Freeing blocks in system zones - " |
372 | "Block = %lu, count = %lu", | 371 | "Block = "E3FSBLK", count = %lu", |
373 | block, count); | 372 | block, count); |
374 | 373 | ||
375 | /* | 374 | /* |
@@ -453,7 +452,8 @@ do_more: | |||
453 | bit + i, bitmap_bh->b_data)) { | 452 | bit + i, bitmap_bh->b_data)) { |
454 | jbd_unlock_bh_state(bitmap_bh); | 453 | jbd_unlock_bh_state(bitmap_bh); |
455 | ext3_error(sb, __FUNCTION__, | 454 | ext3_error(sb, __FUNCTION__, |
456 | "bit already cleared for block %lu", block + i); | 455 | "bit already cleared for block "E3FSBLK, |
456 | block + i); | ||
457 | jbd_lock_bh_state(bitmap_bh); | 457 | jbd_lock_bh_state(bitmap_bh); |
458 | BUFFER_TRACE(bitmap_bh, "bit already cleared"); | 458 | BUFFER_TRACE(bitmap_bh, "bit already cleared"); |
459 | } else { | 459 | } else { |
@@ -493,10 +493,10 @@ error_return: | |||
493 | 493 | ||
494 | /* Free given blocks, update quota and i_blocks field */ | 494 | /* Free given blocks, update quota and i_blocks field */ |
495 | void ext3_free_blocks(handle_t *handle, struct inode *inode, | 495 | void ext3_free_blocks(handle_t *handle, struct inode *inode, |
496 | unsigned long block, unsigned long count) | 496 | ext3_fsblk_t block, unsigned long count) |
497 | { | 497 | { |
498 | struct super_block * sb; | 498 | struct super_block * sb; |
499 | int dquot_freed_blocks; | 499 | unsigned long dquot_freed_blocks; |
500 | 500 | ||
501 | sb = inode->i_sb; | 501 | sb = inode->i_sb; |
502 | if (!sb) { | 502 | if (!sb) { |
@@ -525,7 +525,7 @@ void ext3_free_blocks(handle_t *handle, struct inode *inode, | |||
525 | * data-writes at some point, and disable it for metadata allocations or | 525 | * data-writes at some point, and disable it for metadata allocations or |
526 | * sync-data inodes. | 526 | * sync-data inodes. |
527 | */ | 527 | */ |
528 | static int ext3_test_allocatable(int nr, struct buffer_head *bh) | 528 | static int ext3_test_allocatable(ext3_grpblk_t nr, struct buffer_head *bh) |
529 | { | 529 | { |
530 | int ret; | 530 | int ret; |
531 | struct journal_head *jh = bh2jh(bh); | 531 | struct journal_head *jh = bh2jh(bh); |
@@ -542,11 +542,11 @@ static int ext3_test_allocatable(int nr, struct buffer_head *bh) | |||
542 | return ret; | 542 | return ret; |
543 | } | 543 | } |
544 | 544 | ||
545 | static int | 545 | static ext3_grpblk_t |
546 | bitmap_search_next_usable_block(int start, struct buffer_head *bh, | 546 | bitmap_search_next_usable_block(ext3_grpblk_t start, struct buffer_head *bh, |
547 | int maxblocks) | 547 | ext3_grpblk_t maxblocks) |
548 | { | 548 | { |
549 | int next; | 549 | ext3_grpblk_t next; |
550 | struct journal_head *jh = bh2jh(bh); | 550 | struct journal_head *jh = bh2jh(bh); |
551 | 551 | ||
552 | /* | 552 | /* |
@@ -576,10 +576,11 @@ bitmap_search_next_usable_block(int start, struct buffer_head *bh, | |||
576 | * the initial goal; then for a free byte somewhere in the bitmap; then | 576 | * the initial goal; then for a free byte somewhere in the bitmap; then |
577 | * for any free bit in the bitmap. | 577 | * for any free bit in the bitmap. |
578 | */ | 578 | */ |
579 | static int | 579 | static ext3_grpblk_t |
580 | find_next_usable_block(int start, struct buffer_head *bh, int maxblocks) | 580 | find_next_usable_block(ext3_grpblk_t start, struct buffer_head *bh, |
581 | ext3_grpblk_t maxblocks) | ||
581 | { | 582 | { |
582 | int here, next; | 583 | ext3_grpblk_t here, next; |
583 | char *p, *r; | 584 | char *p, *r; |
584 | 585 | ||
585 | if (start > 0) { | 586 | if (start > 0) { |
@@ -591,7 +592,7 @@ find_next_usable_block(int start, struct buffer_head *bh, int maxblocks) | |||
591 | * less than EXT3_BLOCKS_PER_GROUP. Aligning up to the | 592 | * less than EXT3_BLOCKS_PER_GROUP. Aligning up to the |
592 | * next 64-bit boundary is simple.. | 593 | * next 64-bit boundary is simple.. |
593 | */ | 594 | */ |
594 | int end_goal = (start + 63) & ~63; | 595 | ext3_grpblk_t end_goal = (start + 63) & ~63; |
595 | if (end_goal > maxblocks) | 596 | if (end_goal > maxblocks) |
596 | end_goal = maxblocks; | 597 | end_goal = maxblocks; |
597 | here = ext3_find_next_zero_bit(bh->b_data, end_goal, start); | 598 | here = ext3_find_next_zero_bit(bh->b_data, end_goal, start); |
@@ -628,7 +629,7 @@ find_next_usable_block(int start, struct buffer_head *bh, int maxblocks) | |||
628 | * zero (failure). | 629 | * zero (failure). |
629 | */ | 630 | */ |
630 | static inline int | 631 | static inline int |
631 | claim_block(spinlock_t *lock, int block, struct buffer_head *bh) | 632 | claim_block(spinlock_t *lock, ext3_grpblk_t block, struct buffer_head *bh) |
632 | { | 633 | { |
633 | struct journal_head *jh = bh2jh(bh); | 634 | struct journal_head *jh = bh2jh(bh); |
634 | int ret; | 635 | int ret; |
@@ -651,19 +652,18 @@ claim_block(spinlock_t *lock, int block, struct buffer_head *bh) | |||
651 | * new bitmap. In that case we must release write access to the old one via | 652 | * new bitmap. In that case we must release write access to the old one via |
652 | * ext3_journal_release_buffer(), else we'll run out of credits. | 653 | * ext3_journal_release_buffer(), else we'll run out of credits. |
653 | */ | 654 | */ |
654 | static int | 655 | static ext3_grpblk_t |
655 | ext3_try_to_allocate(struct super_block *sb, handle_t *handle, int group, | 656 | ext3_try_to_allocate(struct super_block *sb, handle_t *handle, int group, |
656 | struct buffer_head *bitmap_bh, int goal, | 657 | struct buffer_head *bitmap_bh, ext3_grpblk_t grp_goal, |
657 | unsigned long *count, struct ext3_reserve_window *my_rsv) | 658 | unsigned long *count, struct ext3_reserve_window *my_rsv) |
658 | { | 659 | { |
659 | int group_first_block, start, end; | 660 | ext3_fsblk_t group_first_block; |
661 | ext3_grpblk_t start, end; | ||
660 | unsigned long num = 0; | 662 | unsigned long num = 0; |
661 | 663 | ||
662 | /* we do allocation within the reservation window if we have a window */ | 664 | /* we do allocation within the reservation window if we have a window */ |
663 | if (my_rsv) { | 665 | if (my_rsv) { |
664 | group_first_block = | 666 | group_first_block = ext3_group_first_block_no(sb, group); |
665 | le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block) + | ||
666 | group * EXT3_BLOCKS_PER_GROUP(sb); | ||
667 | if (my_rsv->_rsv_start >= group_first_block) | 667 | if (my_rsv->_rsv_start >= group_first_block) |
668 | start = my_rsv->_rsv_start - group_first_block; | 668 | start = my_rsv->_rsv_start - group_first_block; |
669 | else | 669 | else |
@@ -673,13 +673,13 @@ ext3_try_to_allocate(struct super_block *sb, handle_t *handle, int group, | |||
673 | if (end > EXT3_BLOCKS_PER_GROUP(sb)) | 673 | if (end > EXT3_BLOCKS_PER_GROUP(sb)) |
674 | /* reservation window crosses group boundary */ | 674 | /* reservation window crosses group boundary */ |
675 | end = EXT3_BLOCKS_PER_GROUP(sb); | 675 | end = EXT3_BLOCKS_PER_GROUP(sb); |
676 | if ((start <= goal) && (goal < end)) | 676 | if ((start <= grp_goal) && (grp_goal < end)) |
677 | start = goal; | 677 | start = grp_goal; |
678 | else | 678 | else |
679 | goal = -1; | 679 | grp_goal = -1; |
680 | } else { | 680 | } else { |
681 | if (goal > 0) | 681 | if (grp_goal > 0) |
682 | start = goal; | 682 | start = grp_goal; |
683 | else | 683 | else |
684 | start = 0; | 684 | start = 0; |
685 | end = EXT3_BLOCKS_PER_GROUP(sb); | 685 | end = EXT3_BLOCKS_PER_GROUP(sb); |
@@ -688,43 +688,43 @@ ext3_try_to_allocate(struct super_block *sb, handle_t *handle, int group, | |||
688 | BUG_ON(start > EXT3_BLOCKS_PER_GROUP(sb)); | 688 | BUG_ON(start > EXT3_BLOCKS_PER_GROUP(sb)); |
689 | 689 | ||
690 | repeat: | 690 | repeat: |
691 | if (goal < 0 || !ext3_test_allocatable(goal, bitmap_bh)) { | 691 | if (grp_goal < 0 || !ext3_test_allocatable(grp_goal, bitmap_bh)) { |
692 | goal = find_next_usable_block(start, bitmap_bh, end); | 692 | grp_goal = find_next_usable_block(start, bitmap_bh, end); |
693 | if (goal < 0) | 693 | if (grp_goal < 0) |
694 | goto fail_access; | 694 | goto fail_access; |
695 | if (!my_rsv) { | 695 | if (!my_rsv) { |
696 | int i; | 696 | int i; |
697 | 697 | ||
698 | for (i = 0; i < 7 && goal > start && | 698 | for (i = 0; i < 7 && grp_goal > start && |
699 | ext3_test_allocatable(goal - 1, | 699 | ext3_test_allocatable(grp_goal - 1, |
700 | bitmap_bh); | 700 | bitmap_bh); |
701 | i++, goal--) | 701 | i++, grp_goal--) |
702 | ; | 702 | ; |
703 | } | 703 | } |
704 | } | 704 | } |
705 | start = goal; | 705 | start = grp_goal; |
706 | 706 | ||
707 | if (!claim_block(sb_bgl_lock(EXT3_SB(sb), group), goal, bitmap_bh)) { | 707 | if (!claim_block(sb_bgl_lock(EXT3_SB(sb), group), grp_goal, bitmap_bh)) { |
708 | /* | 708 | /* |
709 | * The block was allocated by another thread, or it was | 709 | * The block was allocated by another thread, or it was |
710 | * allocated and then freed by another thread | 710 | * allocated and then freed by another thread |
711 | */ | 711 | */ |
712 | start++; | 712 | start++; |
713 | goal++; | 713 | grp_goal++; |
714 | if (start >= end) | 714 | if (start >= end) |
715 | goto fail_access; | 715 | goto fail_access; |
716 | goto repeat; | 716 | goto repeat; |
717 | } | 717 | } |
718 | num++; | 718 | num++; |
719 | goal++; | 719 | grp_goal++; |
720 | while (num < *count && goal < end | 720 | while (num < *count && grp_goal < end |
721 | && ext3_test_allocatable(goal, bitmap_bh) | 721 | && ext3_test_allocatable(grp_goal, bitmap_bh) |
722 | && claim_block(sb_bgl_lock(EXT3_SB(sb), group), goal, bitmap_bh)) { | 722 | && claim_block(sb_bgl_lock(EXT3_SB(sb), group), grp_goal, bitmap_bh)) { |
723 | num++; | 723 | num++; |
724 | goal++; | 724 | grp_goal++; |
725 | } | 725 | } |
726 | *count = num; | 726 | *count = num; |
727 | return goal - num; | 727 | return grp_goal - num; |
728 | fail_access: | 728 | fail_access: |
729 | *count = num; | 729 | *count = num; |
730 | return -1; | 730 | return -1; |
@@ -766,12 +766,13 @@ fail_access: | |||
766 | static int find_next_reservable_window( | 766 | static int find_next_reservable_window( |
767 | struct ext3_reserve_window_node *search_head, | 767 | struct ext3_reserve_window_node *search_head, |
768 | struct ext3_reserve_window_node *my_rsv, | 768 | struct ext3_reserve_window_node *my_rsv, |
769 | struct super_block * sb, int start_block, | 769 | struct super_block * sb, |
770 | int last_block) | 770 | ext3_fsblk_t start_block, |
771 | ext3_fsblk_t last_block) | ||
771 | { | 772 | { |
772 | struct rb_node *next; | 773 | struct rb_node *next; |
773 | struct ext3_reserve_window_node *rsv, *prev; | 774 | struct ext3_reserve_window_node *rsv, *prev; |
774 | int cur; | 775 | ext3_fsblk_t cur; |
775 | int size = my_rsv->rsv_goal_size; | 776 | int size = my_rsv->rsv_goal_size; |
776 | 777 | ||
777 | /* TODO: make the start of the reservation window byte-aligned */ | 778 | /* TODO: make the start of the reservation window byte-aligned */ |
@@ -873,10 +874,10 @@ static int find_next_reservable_window( | |||
873 | * | 874 | * |
874 | * @rsv: the reservation | 875 | * @rsv: the reservation |
875 | * | 876 | * |
876 | * @goal: The goal (group-relative). It is where the search for a | 877 | * @grp_goal: The goal (group-relative). It is where the search for a |
877 | * free reservable space should start from. | 878 | * free reservable space should start from. |
878 | * if we have a goal(goal >0 ), then start from there, | 879 | * if we have a grp_goal(grp_goal >0 ), then start from there, |
879 | * no goal(goal = -1), we start from the first block | 880 | * no grp_goal(grp_goal = -1), we start from the first block |
880 | * of the group. | 881 | * of the group. |
881 | * | 882 | * |
882 | * @sb: the super block | 883 | * @sb: the super block |
@@ -885,25 +886,24 @@ static int find_next_reservable_window( | |||
885 | * | 886 | * |
886 | */ | 887 | */ |
887 | static int alloc_new_reservation(struct ext3_reserve_window_node *my_rsv, | 888 | static int alloc_new_reservation(struct ext3_reserve_window_node *my_rsv, |
888 | int goal, struct super_block *sb, | 889 | ext3_grpblk_t grp_goal, struct super_block *sb, |
889 | unsigned int group, struct buffer_head *bitmap_bh) | 890 | unsigned int group, struct buffer_head *bitmap_bh) |
890 | { | 891 | { |
891 | struct ext3_reserve_window_node *search_head; | 892 | struct ext3_reserve_window_node *search_head; |
892 | int group_first_block, group_end_block, start_block; | 893 | ext3_fsblk_t group_first_block, group_end_block, start_block; |
893 | int first_free_block; | 894 | ext3_grpblk_t first_free_block; |
894 | struct rb_root *fs_rsv_root = &EXT3_SB(sb)->s_rsv_window_root; | 895 | struct rb_root *fs_rsv_root = &EXT3_SB(sb)->s_rsv_window_root; |
895 | unsigned long size; | 896 | unsigned long size; |
896 | int ret; | 897 | int ret; |
897 | spinlock_t *rsv_lock = &EXT3_SB(sb)->s_rsv_window_lock; | 898 | spinlock_t *rsv_lock = &EXT3_SB(sb)->s_rsv_window_lock; |
898 | 899 | ||
899 | group_first_block = le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block) + | 900 | group_first_block = ext3_group_first_block_no(sb, group); |
900 | group * EXT3_BLOCKS_PER_GROUP(sb); | ||
901 | group_end_block = group_first_block + EXT3_BLOCKS_PER_GROUP(sb) - 1; | 901 | group_end_block = group_first_block + EXT3_BLOCKS_PER_GROUP(sb) - 1; |
902 | 902 | ||
903 | if (goal < 0) | 903 | if (grp_goal < 0) |
904 | start_block = group_first_block; | 904 | start_block = group_first_block; |
905 | else | 905 | else |
906 | start_block = goal + group_first_block; | 906 | start_block = grp_goal + group_first_block; |
907 | 907 | ||
908 | size = my_rsv->rsv_goal_size; | 908 | size = my_rsv->rsv_goal_size; |
909 | 909 | ||
@@ -1057,14 +1057,15 @@ static void try_to_extend_reservation(struct ext3_reserve_window_node *my_rsv, | |||
1057 | * sorted double linked list should be fast. | 1057 | * sorted double linked list should be fast. |
1058 | * | 1058 | * |
1059 | */ | 1059 | */ |
1060 | static int | 1060 | static ext3_grpblk_t |
1061 | ext3_try_to_allocate_with_rsv(struct super_block *sb, handle_t *handle, | 1061 | ext3_try_to_allocate_with_rsv(struct super_block *sb, handle_t *handle, |
1062 | unsigned int group, struct buffer_head *bitmap_bh, | 1062 | unsigned int group, struct buffer_head *bitmap_bh, |
1063 | int goal, struct ext3_reserve_window_node * my_rsv, | 1063 | ext3_grpblk_t grp_goal, |
1064 | struct ext3_reserve_window_node * my_rsv, | ||
1064 | unsigned long *count, int *errp) | 1065 | unsigned long *count, int *errp) |
1065 | { | 1066 | { |
1066 | unsigned long group_first_block; | 1067 | ext3_fsblk_t group_first_block; |
1067 | int ret = 0; | 1068 | ext3_grpblk_t ret = 0; |
1068 | int fatal; | 1069 | int fatal; |
1069 | unsigned long num = *count; | 1070 | unsigned long num = *count; |
1070 | 1071 | ||
@@ -1090,17 +1091,16 @@ ext3_try_to_allocate_with_rsv(struct super_block *sb, handle_t *handle, | |||
1090 | */ | 1091 | */ |
1091 | if (my_rsv == NULL ) { | 1092 | if (my_rsv == NULL ) { |
1092 | ret = ext3_try_to_allocate(sb, handle, group, bitmap_bh, | 1093 | ret = ext3_try_to_allocate(sb, handle, group, bitmap_bh, |
1093 | goal, count, NULL); | 1094 | grp_goal, count, NULL); |
1094 | goto out; | 1095 | goto out; |
1095 | } | 1096 | } |
1096 | /* | 1097 | /* |
1097 | * goal is a group relative block number (if there is a goal) | 1098 | * grp_goal is a group relative block number (if there is a goal) |
1098 | * 0 < goal < EXT3_BLOCKS_PER_GROUP(sb) | 1099 | * 0 < grp_goal < EXT3_BLOCKS_PER_GROUP(sb) |
1099 | * first block is a filesystem wide block number | 1100 | * first block is a filesystem wide block number |
1100 | * first block is the block number of the first block in this group | 1101 | * first block is the block number of the first block in this group |
1101 | */ | 1102 | */ |
1102 | group_first_block = le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block) + | 1103 | group_first_block = ext3_group_first_block_no(sb, group); |
1103 | group * EXT3_BLOCKS_PER_GROUP(sb); | ||
1104 | 1104 | ||
1105 | /* | 1105 | /* |
1106 | * Basically we will allocate a new block from inode's reservation | 1106 | * Basically we will allocate a new block from inode's reservation |
@@ -1119,24 +1119,24 @@ ext3_try_to_allocate_with_rsv(struct super_block *sb, handle_t *handle, | |||
1119 | */ | 1119 | */ |
1120 | while (1) { | 1120 | while (1) { |
1121 | if (rsv_is_empty(&my_rsv->rsv_window) || (ret < 0) || | 1121 | if (rsv_is_empty(&my_rsv->rsv_window) || (ret < 0) || |
1122 | !goal_in_my_reservation(&my_rsv->rsv_window, goal, group, sb)) { | 1122 | !goal_in_my_reservation(&my_rsv->rsv_window, grp_goal, group, sb)) { |
1123 | if (my_rsv->rsv_goal_size < *count) | 1123 | if (my_rsv->rsv_goal_size < *count) |
1124 | my_rsv->rsv_goal_size = *count; | 1124 | my_rsv->rsv_goal_size = *count; |
1125 | ret = alloc_new_reservation(my_rsv, goal, sb, | 1125 | ret = alloc_new_reservation(my_rsv, grp_goal, sb, |
1126 | group, bitmap_bh); | 1126 | group, bitmap_bh); |
1127 | if (ret < 0) | 1127 | if (ret < 0) |
1128 | break; /* failed */ | 1128 | break; /* failed */ |
1129 | 1129 | ||
1130 | if (!goal_in_my_reservation(&my_rsv->rsv_window, goal, group, sb)) | 1130 | if (!goal_in_my_reservation(&my_rsv->rsv_window, grp_goal, group, sb)) |
1131 | goal = -1; | 1131 | grp_goal = -1; |
1132 | } else if (goal > 0 && (my_rsv->rsv_end-goal+1) < *count) | 1132 | } else if (grp_goal > 0 && (my_rsv->rsv_end-grp_goal+1) < *count) |
1133 | try_to_extend_reservation(my_rsv, sb, | 1133 | try_to_extend_reservation(my_rsv, sb, |
1134 | *count-my_rsv->rsv_end + goal - 1); | 1134 | *count-my_rsv->rsv_end + grp_goal - 1); |
1135 | 1135 | ||
1136 | if ((my_rsv->rsv_start >= group_first_block + EXT3_BLOCKS_PER_GROUP(sb)) | 1136 | if ((my_rsv->rsv_start >= group_first_block + EXT3_BLOCKS_PER_GROUP(sb)) |
1137 | || (my_rsv->rsv_end < group_first_block)) | 1137 | || (my_rsv->rsv_end < group_first_block)) |
1138 | BUG(); | 1138 | BUG(); |
1139 | ret = ext3_try_to_allocate(sb, handle, group, bitmap_bh, goal, | 1139 | ret = ext3_try_to_allocate(sb, handle, group, bitmap_bh, grp_goal, |
1140 | &num, &my_rsv->rsv_window); | 1140 | &num, &my_rsv->rsv_window); |
1141 | if (ret >= 0) { | 1141 | if (ret >= 0) { |
1142 | my_rsv->rsv_alloc_hit += num; | 1142 | my_rsv->rsv_alloc_hit += num; |
@@ -1164,7 +1164,7 @@ out: | |||
1164 | 1164 | ||
1165 | static int ext3_has_free_blocks(struct ext3_sb_info *sbi) | 1165 | static int ext3_has_free_blocks(struct ext3_sb_info *sbi) |
1166 | { | 1166 | { |
1167 | int free_blocks, root_blocks; | 1167 | ext3_fsblk_t free_blocks, root_blocks; |
1168 | 1168 | ||
1169 | free_blocks = percpu_counter_read_positive(&sbi->s_freeblocks_counter); | 1169 | free_blocks = percpu_counter_read_positive(&sbi->s_freeblocks_counter); |
1170 | root_blocks = le32_to_cpu(sbi->s_es->s_r_blocks_count); | 1170 | root_blocks = le32_to_cpu(sbi->s_es->s_r_blocks_count); |
@@ -1200,19 +1200,20 @@ int ext3_should_retry_alloc(struct super_block *sb, int *retries) | |||
1200 | * bitmap, and then for any free bit if that fails. | 1200 | * bitmap, and then for any free bit if that fails. |
1201 | * This function also updates quota and i_blocks field. | 1201 | * This function also updates quota and i_blocks field. |
1202 | */ | 1202 | */ |
1203 | int ext3_new_blocks(handle_t *handle, struct inode *inode, | 1203 | ext3_fsblk_t ext3_new_blocks(handle_t *handle, struct inode *inode, |
1204 | unsigned long goal, unsigned long *count, int *errp) | 1204 | ext3_fsblk_t goal, unsigned long *count, int *errp) |
1205 | { | 1205 | { |
1206 | struct buffer_head *bitmap_bh = NULL; | 1206 | struct buffer_head *bitmap_bh = NULL; |
1207 | struct buffer_head *gdp_bh; | 1207 | struct buffer_head *gdp_bh; |
1208 | int group_no; | 1208 | int group_no; |
1209 | int goal_group; | 1209 | int goal_group; |
1210 | int ret_block; | 1210 | ext3_grpblk_t grp_target_blk; /* blockgroup relative goal block */ |
1211 | ext3_grpblk_t grp_alloc_blk; /* blockgroup-relative allocated block*/ | ||
1212 | ext3_fsblk_t ret_block; /* filesyetem-wide allocated block */ | ||
1211 | int bgi; /* blockgroup iteration index */ | 1213 | int bgi; /* blockgroup iteration index */ |
1212 | int target_block; | ||
1213 | int fatal = 0, err; | 1214 | int fatal = 0, err; |
1214 | int performed_allocation = 0; | 1215 | int performed_allocation = 0; |
1215 | int free_blocks; | 1216 | ext3_grpblk_t free_blocks; /* number of free blocks in a group */ |
1216 | struct super_block *sb; | 1217 | struct super_block *sb; |
1217 | struct ext3_group_desc *gdp; | 1218 | struct ext3_group_desc *gdp; |
1218 | struct ext3_super_block *es; | 1219 | struct ext3_super_block *es; |
@@ -1285,16 +1286,17 @@ retry: | |||
1285 | my_rsv = NULL; | 1286 | my_rsv = NULL; |
1286 | 1287 | ||
1287 | if (free_blocks > 0) { | 1288 | if (free_blocks > 0) { |
1288 | ret_block = ((goal - le32_to_cpu(es->s_first_data_block)) % | 1289 | grp_target_blk = ((goal - le32_to_cpu(es->s_first_data_block)) % |
1289 | EXT3_BLOCKS_PER_GROUP(sb)); | 1290 | EXT3_BLOCKS_PER_GROUP(sb)); |
1290 | bitmap_bh = read_block_bitmap(sb, group_no); | 1291 | bitmap_bh = read_block_bitmap(sb, group_no); |
1291 | if (!bitmap_bh) | 1292 | if (!bitmap_bh) |
1292 | goto io_error; | 1293 | goto io_error; |
1293 | ret_block = ext3_try_to_allocate_with_rsv(sb, handle, group_no, | 1294 | grp_alloc_blk = ext3_try_to_allocate_with_rsv(sb, handle, |
1294 | bitmap_bh, ret_block, my_rsv, &num, &fatal); | 1295 | group_no, bitmap_bh, grp_target_blk, |
1296 | my_rsv, &num, &fatal); | ||
1295 | if (fatal) | 1297 | if (fatal) |
1296 | goto out; | 1298 | goto out; |
1297 | if (ret_block >= 0) | 1299 | if (grp_alloc_blk >= 0) |
1298 | goto allocated; | 1300 | goto allocated; |
1299 | } | 1301 | } |
1300 | 1302 | ||
@@ -1327,11 +1329,15 @@ retry: | |||
1327 | bitmap_bh = read_block_bitmap(sb, group_no); | 1329 | bitmap_bh = read_block_bitmap(sb, group_no); |
1328 | if (!bitmap_bh) | 1330 | if (!bitmap_bh) |
1329 | goto io_error; | 1331 | goto io_error; |
1330 | ret_block = ext3_try_to_allocate_with_rsv(sb, handle, group_no, | 1332 | /* |
1331 | bitmap_bh, -1, my_rsv, &num, &fatal); | 1333 | * try to allocate block(s) from this group, without a goal(-1). |
1334 | */ | ||
1335 | grp_alloc_blk = ext3_try_to_allocate_with_rsv(sb, handle, | ||
1336 | group_no, bitmap_bh, -1, my_rsv, | ||
1337 | &num, &fatal); | ||
1332 | if (fatal) | 1338 | if (fatal) |
1333 | goto out; | 1339 | goto out; |
1334 | if (ret_block >= 0) | 1340 | if (grp_alloc_blk >= 0) |
1335 | goto allocated; | 1341 | goto allocated; |
1336 | } | 1342 | } |
1337 | /* | 1343 | /* |
@@ -1360,18 +1366,18 @@ allocated: | |||
1360 | if (fatal) | 1366 | if (fatal) |
1361 | goto out; | 1367 | goto out; |
1362 | 1368 | ||
1363 | target_block = ret_block + group_no * EXT3_BLOCKS_PER_GROUP(sb) | 1369 | ret_block = grp_alloc_blk + ext3_group_first_block_no(sb, group_no); |
1364 | + le32_to_cpu(es->s_first_data_block); | ||
1365 | 1370 | ||
1366 | if (in_range(le32_to_cpu(gdp->bg_block_bitmap), target_block, num) || | 1371 | if (in_range(le32_to_cpu(gdp->bg_block_bitmap), ret_block, num) || |
1367 | in_range(le32_to_cpu(gdp->bg_inode_bitmap), target_block, num) || | 1372 | in_range(le32_to_cpu(gdp->bg_inode_bitmap), ret_block, num) || |
1368 | in_range(target_block, le32_to_cpu(gdp->bg_inode_table), | 1373 | in_range(ret_block, le32_to_cpu(gdp->bg_inode_table), |
1369 | EXT3_SB(sb)->s_itb_per_group) || | 1374 | EXT3_SB(sb)->s_itb_per_group) || |
1370 | in_range(target_block + num - 1, le32_to_cpu(gdp->bg_inode_table), | 1375 | in_range(ret_block + num - 1, le32_to_cpu(gdp->bg_inode_table), |
1371 | EXT3_SB(sb)->s_itb_per_group)) | 1376 | EXT3_SB(sb)->s_itb_per_group)) |
1372 | ext3_error(sb, "ext3_new_block", | 1377 | ext3_error(sb, "ext3_new_block", |
1373 | "Allocating block in system zone - " | 1378 | "Allocating block in system zone - " |
1374 | "blocks from %u, length %lu", target_block, num); | 1379 | "blocks from "E3FSBLK", length %lu", |
1380 | ret_block, num); | ||
1375 | 1381 | ||
1376 | performed_allocation = 1; | 1382 | performed_allocation = 1; |
1377 | 1383 | ||
@@ -1380,7 +1386,7 @@ allocated: | |||
1380 | struct buffer_head *debug_bh; | 1386 | struct buffer_head *debug_bh; |
1381 | 1387 | ||
1382 | /* Record bitmap buffer state in the newly allocated block */ | 1388 | /* Record bitmap buffer state in the newly allocated block */ |
1383 | debug_bh = sb_find_get_block(sb, target_block); | 1389 | debug_bh = sb_find_get_block(sb, ret_block); |
1384 | if (debug_bh) { | 1390 | if (debug_bh) { |
1385 | BUFFER_TRACE(debug_bh, "state when allocated"); | 1391 | BUFFER_TRACE(debug_bh, "state when allocated"); |
1386 | BUFFER_TRACE2(debug_bh, bitmap_bh, "bitmap state"); | 1392 | BUFFER_TRACE2(debug_bh, bitmap_bh, "bitmap state"); |
@@ -1393,24 +1399,21 @@ allocated: | |||
1393 | int i; | 1399 | int i; |
1394 | 1400 | ||
1395 | for (i = 0; i < num; i++) { | 1401 | for (i = 0; i < num; i++) { |
1396 | if (ext3_test_bit(ret_block, | 1402 | if (ext3_test_bit(grp_alloc_blk+i, |
1397 | bh2jh(bitmap_bh)->b_committed_data)) { | 1403 | bh2jh(bitmap_bh)->b_committed_data)) { |
1398 | printk("%s: block was unexpectedly set in " | 1404 | printk("%s: block was unexpectedly set in " |
1399 | "b_committed_data\n", __FUNCTION__); | 1405 | "b_committed_data\n", __FUNCTION__); |
1400 | } | 1406 | } |
1401 | } | 1407 | } |
1402 | } | 1408 | } |
1403 | ext3_debug("found bit %d\n", ret_block); | 1409 | ext3_debug("found bit %d\n", grp_alloc_blk); |
1404 | spin_unlock(sb_bgl_lock(sbi, group_no)); | 1410 | spin_unlock(sb_bgl_lock(sbi, group_no)); |
1405 | jbd_unlock_bh_state(bitmap_bh); | 1411 | jbd_unlock_bh_state(bitmap_bh); |
1406 | #endif | 1412 | #endif |
1407 | 1413 | ||
1408 | /* ret_block was blockgroup-relative. Now it becomes fs-relative */ | ||
1409 | ret_block = target_block; | ||
1410 | |||
1411 | if (ret_block + num - 1 >= le32_to_cpu(es->s_blocks_count)) { | 1414 | if (ret_block + num - 1 >= le32_to_cpu(es->s_blocks_count)) { |
1412 | ext3_error(sb, "ext3_new_block", | 1415 | ext3_error(sb, "ext3_new_block", |
1413 | "block(%d) >= blocks count(%d) - " | 1416 | "block("E3FSBLK") >= blocks count(%d) - " |
1414 | "block_group = %d, es == %p ", ret_block, | 1417 | "block_group = %d, es == %p ", ret_block, |
1415 | le32_to_cpu(es->s_blocks_count), group_no, es); | 1418 | le32_to_cpu(es->s_blocks_count), group_no, es); |
1416 | goto out; | 1419 | goto out; |
@@ -1421,7 +1424,7 @@ allocated: | |||
1421 | * list of some description. We don't know in advance whether | 1424 | * list of some description. We don't know in advance whether |
1422 | * the caller wants to use it as metadata or data. | 1425 | * the caller wants to use it as metadata or data. |
1423 | */ | 1426 | */ |
1424 | ext3_debug("allocating block %d. Goal hits %d of %d.\n", | 1427 | ext3_debug("allocating block %lu. Goal hits %d of %d.\n", |
1425 | ret_block, goal_hits, goal_attempts); | 1428 | ret_block, goal_hits, goal_attempts); |
1426 | 1429 | ||
1427 | spin_lock(sb_bgl_lock(sbi, group_no)); | 1430 | spin_lock(sb_bgl_lock(sbi, group_no)); |
@@ -1461,23 +1464,24 @@ out: | |||
1461 | return 0; | 1464 | return 0; |
1462 | } | 1465 | } |
1463 | 1466 | ||
1464 | int ext3_new_block(handle_t *handle, struct inode *inode, | 1467 | ext3_fsblk_t ext3_new_block(handle_t *handle, struct inode *inode, |
1465 | unsigned long goal, int *errp) | 1468 | ext3_fsblk_t goal, int *errp) |
1466 | { | 1469 | { |
1467 | unsigned long count = 1; | 1470 | unsigned long count = 1; |
1468 | 1471 | ||
1469 | return ext3_new_blocks(handle, inode, goal, &count, errp); | 1472 | return ext3_new_blocks(handle, inode, goal, &count, errp); |
1470 | } | 1473 | } |
1471 | 1474 | ||
1472 | unsigned long ext3_count_free_blocks(struct super_block *sb) | 1475 | ext3_fsblk_t ext3_count_free_blocks(struct super_block *sb) |
1473 | { | 1476 | { |
1474 | unsigned long desc_count; | 1477 | ext3_fsblk_t desc_count; |
1475 | struct ext3_group_desc *gdp; | 1478 | struct ext3_group_desc *gdp; |
1476 | int i; | 1479 | int i; |
1477 | unsigned long ngroups = EXT3_SB(sb)->s_groups_count; | 1480 | unsigned long ngroups = EXT3_SB(sb)->s_groups_count; |
1478 | #ifdef EXT3FS_DEBUG | 1481 | #ifdef EXT3FS_DEBUG |
1479 | struct ext3_super_block *es; | 1482 | struct ext3_super_block *es; |
1480 | unsigned long bitmap_count, x; | 1483 | ext3_fsblk_t bitmap_count; |
1484 | unsigned long x; | ||
1481 | struct buffer_head *bitmap_bh = NULL; | 1485 | struct buffer_head *bitmap_bh = NULL; |
1482 | 1486 | ||
1483 | es = EXT3_SB(sb)->s_es; | 1487 | es = EXT3_SB(sb)->s_es; |
@@ -1502,8 +1506,10 @@ unsigned long ext3_count_free_blocks(struct super_block *sb) | |||
1502 | bitmap_count += x; | 1506 | bitmap_count += x; |
1503 | } | 1507 | } |
1504 | brelse(bitmap_bh); | 1508 | brelse(bitmap_bh); |
1505 | printk("ext3_count_free_blocks: stored = %u, computed = %lu, %lu\n", | 1509 | printk("ext3_count_free_blocks: stored = "E3FSBLK |
1506 | le32_to_cpu(es->s_free_blocks_count), desc_count, bitmap_count); | 1510 | ", computed = "E3FSBLK", "E3FSBLK"\n", |
1511 | le32_to_cpu(es->s_free_blocks_count), | ||
1512 | desc_count, bitmap_count); | ||
1507 | return bitmap_count; | 1513 | return bitmap_count; |
1508 | #else | 1514 | #else |
1509 | desc_count = 0; | 1515 | desc_count = 0; |
@@ -1520,7 +1526,7 @@ unsigned long ext3_count_free_blocks(struct super_block *sb) | |||
1520 | } | 1526 | } |
1521 | 1527 | ||
1522 | static inline int | 1528 | static inline int |
1523 | block_in_use(unsigned long block, struct super_block *sb, unsigned char *map) | 1529 | block_in_use(ext3_fsblk_t block, struct super_block *sb, unsigned char *map) |
1524 | { | 1530 | { |
1525 | return ext3_test_bit ((block - | 1531 | return ext3_test_bit ((block - |
1526 | le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block)) % | 1532 | le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block)) % |
diff --git a/fs/ext3/dir.c b/fs/ext3/dir.c index f37528ed22..fbb0d4ed07 100644 --- a/fs/ext3/dir.c +++ b/fs/ext3/dir.c | |||
@@ -284,7 +284,7 @@ static void free_rb_tree_fname(struct rb_root *root) | |||
284 | * beginning of the loop and try to free the parent | 284 | * beginning of the loop and try to free the parent |
285 | * node. | 285 | * node. |
286 | */ | 286 | */ |
287 | parent = n->rb_parent; | 287 | parent = rb_parent(n); |
288 | fname = rb_entry(n, struct fname, rb_hash); | 288 | fname = rb_entry(n, struct fname, rb_hash); |
289 | while (fname) { | 289 | while (fname) { |
290 | struct fname * old = fname; | 290 | struct fname * old = fname; |
diff --git a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c index dc826464f3..36546ed36a 100644 --- a/fs/ext3/ialloc.c +++ b/fs/ext3/ialloc.c | |||
@@ -262,9 +262,11 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent) | |||
262 | int ngroups = sbi->s_groups_count; | 262 | int ngroups = sbi->s_groups_count; |
263 | int inodes_per_group = EXT3_INODES_PER_GROUP(sb); | 263 | int inodes_per_group = EXT3_INODES_PER_GROUP(sb); |
264 | int freei, avefreei; | 264 | int freei, avefreei; |
265 | int freeb, avefreeb; | 265 | ext3_fsblk_t freeb, avefreeb; |
266 | int blocks_per_dir, ndirs; | 266 | ext3_fsblk_t blocks_per_dir; |
267 | int max_debt, max_dirs, min_blocks, min_inodes; | 267 | int ndirs; |
268 | int max_debt, max_dirs, min_inodes; | ||
269 | ext3_grpblk_t min_blocks; | ||
268 | int group = -1, i; | 270 | int group = -1, i; |
269 | struct ext3_group_desc *desc; | 271 | struct ext3_group_desc *desc; |
270 | struct buffer_head *bh; | 272 | struct buffer_head *bh; |
@@ -307,7 +309,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent) | |||
307 | min_inodes = avefreei - inodes_per_group / 4; | 309 | min_inodes = avefreei - inodes_per_group / 4; |
308 | min_blocks = avefreeb - EXT3_BLOCKS_PER_GROUP(sb) / 4; | 310 | min_blocks = avefreeb - EXT3_BLOCKS_PER_GROUP(sb) / 4; |
309 | 311 | ||
310 | max_debt = EXT3_BLOCKS_PER_GROUP(sb) / max(blocks_per_dir, BLOCK_COST); | 312 | max_debt = EXT3_BLOCKS_PER_GROUP(sb) / max(blocks_per_dir, (ext3_fsblk_t)BLOCK_COST); |
311 | if (max_debt * INODE_COST > inodes_per_group) | 313 | if (max_debt * INODE_COST > inodes_per_group) |
312 | max_debt = inodes_per_group / INODE_COST; | 314 | max_debt = inodes_per_group / INODE_COST; |
313 | if (max_debt > 255) | 315 | if (max_debt > 255) |
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c index 2edd7eec88..f804d5e9d6 100644 --- a/fs/ext3/inode.c +++ b/fs/ext3/inode.c | |||
@@ -62,7 +62,7 @@ static int ext3_inode_is_fast_symlink(struct inode *inode) | |||
62 | * still needs to be revoked. | 62 | * still needs to be revoked. |
63 | */ | 63 | */ |
64 | int ext3_forget(handle_t *handle, int is_metadata, struct inode *inode, | 64 | int ext3_forget(handle_t *handle, int is_metadata, struct inode *inode, |
65 | struct buffer_head *bh, int blocknr) | 65 | struct buffer_head *bh, ext3_fsblk_t blocknr) |
66 | { | 66 | { |
67 | int err; | 67 | int err; |
68 | 68 | ||
@@ -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 | */ |
410 | static unsigned long ext3_find_near(struct inode *inode, Indirect *ind) | 410 | static 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 | ||
451 | static unsigned long ext3_find_goal(struct inode *inode, long block, | 450 | static 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 | */ |
518 | static int ext3_alloc_blocks(handle_t *handle, struct inode *inode, | 517 | static 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 | */ |
594 | static int ext3_alloc_branch(handle_t *handle, struct inode *inode, | 593 | static 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 | /* |
@@ -1699,7 +1698,7 @@ static int ext3_journalled_set_page_dirty(struct page *page) | |||
1699 | return __set_page_dirty_nobuffers(page); | 1698 | return __set_page_dirty_nobuffers(page); |
1700 | } | 1699 | } |
1701 | 1700 | ||
1702 | static struct address_space_operations ext3_ordered_aops = { | 1701 | static const struct address_space_operations ext3_ordered_aops = { |
1703 | .readpage = ext3_readpage, | 1702 | .readpage = ext3_readpage, |
1704 | .readpages = ext3_readpages, | 1703 | .readpages = ext3_readpages, |
1705 | .writepage = ext3_ordered_writepage, | 1704 | .writepage = ext3_ordered_writepage, |
@@ -1713,7 +1712,7 @@ static struct address_space_operations ext3_ordered_aops = { | |||
1713 | .migratepage = buffer_migrate_page, | 1712 | .migratepage = buffer_migrate_page, |
1714 | }; | 1713 | }; |
1715 | 1714 | ||
1716 | static struct address_space_operations ext3_writeback_aops = { | 1715 | static const struct address_space_operations ext3_writeback_aops = { |
1717 | .readpage = ext3_readpage, | 1716 | .readpage = ext3_readpage, |
1718 | .readpages = ext3_readpages, | 1717 | .readpages = ext3_readpages, |
1719 | .writepage = ext3_writeback_writepage, | 1718 | .writepage = ext3_writeback_writepage, |
@@ -1727,7 +1726,7 @@ static struct address_space_operations ext3_writeback_aops = { | |||
1727 | .migratepage = buffer_migrate_page, | 1726 | .migratepage = buffer_migrate_page, |
1728 | }; | 1727 | }; |
1729 | 1728 | ||
1730 | static struct address_space_operations ext3_journalled_aops = { | 1729 | static const struct address_space_operations ext3_journalled_aops = { |
1731 | .readpage = ext3_readpage, | 1730 | .readpage = ext3_readpage, |
1732 | .readpages = ext3_readpages, | 1731 | .readpages = ext3_readpages, |
1733 | .writepage = ext3_journalled_writepage, | 1732 | .writepage = ext3_journalled_writepage, |
@@ -1759,7 +1758,7 @@ void ext3_set_aops(struct inode *inode) | |||
1759 | static int ext3_block_truncate_page(handle_t *handle, struct page *page, | 1758 | static 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 | */ |
1962 | static void ext3_clear_blocks(handle_t *handle, struct inode *inode, | 1961 | static 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 | ||
2397 | static unsigned long ext3_get_inode_block(struct super_block *sb, | 2396 | static 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, | |||
2448 | static int __ext3_get_inode_loc(struct inode *inode, | 2448 | static 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; |
diff --git a/fs/ext3/ioctl.c b/fs/ext3/ioctl.c index 8c22aa9a7f..3a6b012d12 100644 --- a/fs/ext3/ioctl.c +++ b/fs/ext3/ioctl.c | |||
@@ -204,7 +204,7 @@ flags_err: | |||
204 | return 0; | 204 | return 0; |
205 | } | 205 | } |
206 | case EXT3_IOC_GROUP_EXTEND: { | 206 | case EXT3_IOC_GROUP_EXTEND: { |
207 | unsigned long n_blocks_count; | 207 | ext3_fsblk_t n_blocks_count; |
208 | struct super_block *sb = inode->i_sb; | 208 | struct super_block *sb = inode->i_sb; |
209 | int err; | 209 | int err; |
210 | 210 | ||
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c index b8f5cd1e54..d9176dba36 100644 --- a/fs/ext3/namei.c +++ b/fs/ext3/namei.c | |||
@@ -1379,7 +1379,6 @@ static int ext3_add_entry (handle_t *handle, struct dentry *dentry, | |||
1379 | int dx_fallback=0; | 1379 | int dx_fallback=0; |
1380 | #endif | 1380 | #endif |
1381 | unsigned blocksize; | 1381 | unsigned blocksize; |
1382 | unsigned nlen, rlen; | ||
1383 | u32 block, blocks; | 1382 | u32 block, blocks; |
1384 | 1383 | ||
1385 | sb = dir->i_sb; | 1384 | sb = dir->i_sb; |
@@ -1417,8 +1416,7 @@ static int ext3_add_entry (handle_t *handle, struct dentry *dentry, | |||
1417 | return retval; | 1416 | return retval; |
1418 | de = (struct ext3_dir_entry_2 *) bh->b_data; | 1417 | de = (struct ext3_dir_entry_2 *) bh->b_data; |
1419 | de->inode = 0; | 1418 | de->inode = 0; |
1420 | de->rec_len = cpu_to_le16(rlen = blocksize); | 1419 | de->rec_len = cpu_to_le16(blocksize); |
1421 | nlen = 0; | ||
1422 | return add_dirent_to_buf(handle, dentry, inode, de, bh); | 1420 | return add_dirent_to_buf(handle, dentry, inode, de, bh); |
1423 | } | 1421 | } |
1424 | 1422 | ||
diff --git a/fs/ext3/resize.c b/fs/ext3/resize.c index 34b39e9a1e..dfd811895d 100644 --- a/fs/ext3/resize.c +++ b/fs/ext3/resize.c | |||
@@ -28,16 +28,16 @@ static int verify_group_input(struct super_block *sb, | |||
28 | { | 28 | { |
29 | struct ext3_sb_info *sbi = EXT3_SB(sb); | 29 | struct ext3_sb_info *sbi = EXT3_SB(sb); |
30 | struct ext3_super_block *es = sbi->s_es; | 30 | struct ext3_super_block *es = sbi->s_es; |
31 | unsigned start = le32_to_cpu(es->s_blocks_count); | 31 | ext3_fsblk_t start = le32_to_cpu(es->s_blocks_count); |
32 | unsigned end = start + input->blocks_count; | 32 | ext3_fsblk_t end = start + input->blocks_count; |
33 | unsigned group = input->group; | 33 | unsigned group = input->group; |
34 | unsigned itend = input->inode_table + sbi->s_itb_per_group; | 34 | ext3_fsblk_t itend = input->inode_table + sbi->s_itb_per_group; |
35 | unsigned overhead = ext3_bg_has_super(sb, group) ? | 35 | unsigned overhead = ext3_bg_has_super(sb, group) ? |
36 | (1 + ext3_bg_num_gdb(sb, group) + | 36 | (1 + ext3_bg_num_gdb(sb, group) + |
37 | le16_to_cpu(es->s_reserved_gdt_blocks)) : 0; | 37 | le16_to_cpu(es->s_reserved_gdt_blocks)) : 0; |
38 | unsigned metaend = start + overhead; | 38 | ext3_fsblk_t metaend = start + overhead; |
39 | struct buffer_head *bh = NULL; | 39 | struct buffer_head *bh = NULL; |
40 | int free_blocks_count; | 40 | ext3_grpblk_t free_blocks_count; |
41 | int err = -EINVAL; | 41 | int err = -EINVAL; |
42 | 42 | ||
43 | input->free_blocks_count = free_blocks_count = | 43 | input->free_blocks_count = free_blocks_count = |
@@ -64,7 +64,8 @@ static int verify_group_input(struct super_block *sb, | |||
64 | ext3_warning(sb, __FUNCTION__, "Bad blocks count %u", | 64 | ext3_warning(sb, __FUNCTION__, "Bad blocks count %u", |
65 | input->blocks_count); | 65 | input->blocks_count); |
66 | else if (!(bh = sb_bread(sb, end - 1))) | 66 | else if (!(bh = sb_bread(sb, end - 1))) |
67 | ext3_warning(sb, __FUNCTION__, "Cannot read last block (%u)", | 67 | ext3_warning(sb, __FUNCTION__, |
68 | "Cannot read last block ("E3FSBLK")", | ||
68 | end - 1); | 69 | end - 1); |
69 | else if (outside(input->block_bitmap, start, end)) | 70 | else if (outside(input->block_bitmap, start, end)) |
70 | ext3_warning(sb, __FUNCTION__, | 71 | ext3_warning(sb, __FUNCTION__, |
@@ -77,7 +78,7 @@ static int verify_group_input(struct super_block *sb, | |||
77 | else if (outside(input->inode_table, start, end) || | 78 | else if (outside(input->inode_table, start, end) || |
78 | outside(itend - 1, start, end)) | 79 | outside(itend - 1, start, end)) |
79 | ext3_warning(sb, __FUNCTION__, | 80 | ext3_warning(sb, __FUNCTION__, |
80 | "Inode table not in group (blocks %u-%u)", | 81 | "Inode table not in group (blocks %u-"E3FSBLK")", |
81 | input->inode_table, itend - 1); | 82 | input->inode_table, itend - 1); |
82 | else if (input->inode_bitmap == input->block_bitmap) | 83 | else if (input->inode_bitmap == input->block_bitmap) |
83 | ext3_warning(sb, __FUNCTION__, | 84 | ext3_warning(sb, __FUNCTION__, |
@@ -85,24 +86,27 @@ static int verify_group_input(struct super_block *sb, | |||
85 | input->block_bitmap); | 86 | input->block_bitmap); |
86 | else if (inside(input->block_bitmap, input->inode_table, itend)) | 87 | else if (inside(input->block_bitmap, input->inode_table, itend)) |
87 | ext3_warning(sb, __FUNCTION__, | 88 | ext3_warning(sb, __FUNCTION__, |
88 | "Block bitmap (%u) in inode table (%u-%u)", | 89 | "Block bitmap (%u) in inode table (%u-"E3FSBLK")", |
89 | input->block_bitmap, input->inode_table, itend-1); | 90 | input->block_bitmap, input->inode_table, itend-1); |
90 | else if (inside(input->inode_bitmap, input->inode_table, itend)) | 91 | else if (inside(input->inode_bitmap, input->inode_table, itend)) |
91 | ext3_warning(sb, __FUNCTION__, | 92 | ext3_warning(sb, __FUNCTION__, |
92 | "Inode bitmap (%u) in inode table (%u-%u)", | 93 | "Inode bitmap (%u) in inode table (%u-"E3FSBLK")", |
93 | input->inode_bitmap, input->inode_table, itend-1); | 94 | input->inode_bitmap, input->inode_table, itend-1); |
94 | else if (inside(input->block_bitmap, start, metaend)) | 95 | else if (inside(input->block_bitmap, start, metaend)) |
95 | ext3_warning(sb, __FUNCTION__, | 96 | ext3_warning(sb, __FUNCTION__, |
96 | "Block bitmap (%u) in GDT table (%u-%u)", | 97 | "Block bitmap (%u) in GDT table" |
98 | " ("E3FSBLK"-"E3FSBLK")", | ||
97 | input->block_bitmap, start, metaend - 1); | 99 | input->block_bitmap, start, metaend - 1); |
98 | else if (inside(input->inode_bitmap, start, metaend)) | 100 | else if (inside(input->inode_bitmap, start, metaend)) |
99 | ext3_warning(sb, __FUNCTION__, | 101 | ext3_warning(sb, __FUNCTION__, |
100 | "Inode bitmap (%u) in GDT table (%u-%u)", | 102 | "Inode bitmap (%u) in GDT table" |
103 | " ("E3FSBLK"-"E3FSBLK")", | ||
101 | input->inode_bitmap, start, metaend - 1); | 104 | input->inode_bitmap, start, metaend - 1); |
102 | else if (inside(input->inode_table, start, metaend) || | 105 | else if (inside(input->inode_table, start, metaend) || |
103 | inside(itend - 1, start, metaend)) | 106 | inside(itend - 1, start, metaend)) |
104 | ext3_warning(sb, __FUNCTION__, | 107 | ext3_warning(sb, __FUNCTION__, |
105 | "Inode table (%u-%u) overlaps GDT table (%u-%u)", | 108 | "Inode table (%u-"E3FSBLK") overlaps" |
109 | "GDT table ("E3FSBLK"-"E3FSBLK")", | ||
106 | input->inode_table, itend - 1, start, metaend - 1); | 110 | input->inode_table, itend - 1, start, metaend - 1); |
107 | else | 111 | else |
108 | err = 0; | 112 | err = 0; |
@@ -112,7 +116,7 @@ static int verify_group_input(struct super_block *sb, | |||
112 | } | 116 | } |
113 | 117 | ||
114 | static struct buffer_head *bclean(handle_t *handle, struct super_block *sb, | 118 | static struct buffer_head *bclean(handle_t *handle, struct super_block *sb, |
115 | unsigned long blk) | 119 | ext3_fsblk_t blk) |
116 | { | 120 | { |
117 | struct buffer_head *bh; | 121 | struct buffer_head *bh; |
118 | int err; | 122 | int err; |
@@ -163,15 +167,14 @@ static int setup_new_group_blocks(struct super_block *sb, | |||
163 | struct ext3_new_group_data *input) | 167 | struct ext3_new_group_data *input) |
164 | { | 168 | { |
165 | struct ext3_sb_info *sbi = EXT3_SB(sb); | 169 | struct ext3_sb_info *sbi = EXT3_SB(sb); |
166 | unsigned long start = input->group * sbi->s_blocks_per_group + | 170 | ext3_fsblk_t start = ext3_group_first_block_no(sb, input->group); |
167 | le32_to_cpu(sbi->s_es->s_first_data_block); | ||
168 | int reserved_gdb = ext3_bg_has_super(sb, input->group) ? | 171 | int reserved_gdb = ext3_bg_has_super(sb, input->group) ? |
169 | le16_to_cpu(sbi->s_es->s_reserved_gdt_blocks) : 0; | 172 | le16_to_cpu(sbi->s_es->s_reserved_gdt_blocks) : 0; |
170 | unsigned long gdblocks = ext3_bg_num_gdb(sb, input->group); | 173 | unsigned long gdblocks = ext3_bg_num_gdb(sb, input->group); |
171 | struct buffer_head *bh; | 174 | struct buffer_head *bh; |
172 | handle_t *handle; | 175 | handle_t *handle; |
173 | unsigned long block; | 176 | ext3_fsblk_t block; |
174 | int bit; | 177 | ext3_grpblk_t bit; |
175 | int i; | 178 | int i; |
176 | int err = 0, err2; | 179 | int err = 0, err2; |
177 | 180 | ||
@@ -328,7 +331,7 @@ static unsigned ext3_list_backups(struct super_block *sb, unsigned *three, | |||
328 | static int verify_reserved_gdb(struct super_block *sb, | 331 | static int verify_reserved_gdb(struct super_block *sb, |
329 | struct buffer_head *primary) | 332 | struct buffer_head *primary) |
330 | { | 333 | { |
331 | const unsigned long blk = primary->b_blocknr; | 334 | const ext3_fsblk_t blk = primary->b_blocknr; |
332 | const unsigned long end = EXT3_SB(sb)->s_groups_count; | 335 | const unsigned long end = EXT3_SB(sb)->s_groups_count; |
333 | unsigned three = 1; | 336 | unsigned three = 1; |
334 | unsigned five = 5; | 337 | unsigned five = 5; |
@@ -340,7 +343,8 @@ static int verify_reserved_gdb(struct super_block *sb, | |||
340 | while ((grp = ext3_list_backups(sb, &three, &five, &seven)) < end) { | 343 | while ((grp = ext3_list_backups(sb, &three, &five, &seven)) < end) { |
341 | if (le32_to_cpu(*p++) != grp * EXT3_BLOCKS_PER_GROUP(sb) + blk){ | 344 | if (le32_to_cpu(*p++) != grp * EXT3_BLOCKS_PER_GROUP(sb) + blk){ |
342 | ext3_warning(sb, __FUNCTION__, | 345 | ext3_warning(sb, __FUNCTION__, |
343 | "reserved GDT %ld missing grp %d (%ld)", | 346 | "reserved GDT "E3FSBLK |
347 | " missing grp %d ("E3FSBLK")", | ||
344 | blk, grp, | 348 | blk, grp, |
345 | grp * EXT3_BLOCKS_PER_GROUP(sb) + blk); | 349 | grp * EXT3_BLOCKS_PER_GROUP(sb) + blk); |
346 | return -EINVAL; | 350 | return -EINVAL; |
@@ -372,7 +376,7 @@ static int add_new_gdb(handle_t *handle, struct inode *inode, | |||
372 | struct super_block *sb = inode->i_sb; | 376 | struct super_block *sb = inode->i_sb; |
373 | struct ext3_super_block *es = EXT3_SB(sb)->s_es; | 377 | struct ext3_super_block *es = EXT3_SB(sb)->s_es; |
374 | unsigned long gdb_num = input->group / EXT3_DESC_PER_BLOCK(sb); | 378 | unsigned long gdb_num = input->group / EXT3_DESC_PER_BLOCK(sb); |
375 | unsigned long gdblock = EXT3_SB(sb)->s_sbh->b_blocknr + 1 + gdb_num; | 379 | ext3_fsblk_t gdblock = EXT3_SB(sb)->s_sbh->b_blocknr + 1 + gdb_num; |
376 | struct buffer_head **o_group_desc, **n_group_desc; | 380 | struct buffer_head **o_group_desc, **n_group_desc; |
377 | struct buffer_head *dind; | 381 | struct buffer_head *dind; |
378 | int gdbackups; | 382 | int gdbackups; |
@@ -417,7 +421,7 @@ static int add_new_gdb(handle_t *handle, struct inode *inode, | |||
417 | data = (__u32 *)dind->b_data; | 421 | data = (__u32 *)dind->b_data; |
418 | if (le32_to_cpu(data[gdb_num % EXT3_ADDR_PER_BLOCK(sb)]) != gdblock) { | 422 | if (le32_to_cpu(data[gdb_num % EXT3_ADDR_PER_BLOCK(sb)]) != gdblock) { |
419 | ext3_warning(sb, __FUNCTION__, | 423 | ext3_warning(sb, __FUNCTION__, |
420 | "new group %u GDT block %lu not reserved", | 424 | "new group %u GDT block "E3FSBLK" not reserved", |
421 | input->group, gdblock); | 425 | input->group, gdblock); |
422 | err = -EINVAL; | 426 | err = -EINVAL; |
423 | goto exit_dind; | 427 | goto exit_dind; |
@@ -515,7 +519,7 @@ static int reserve_backup_gdb(handle_t *handle, struct inode *inode, | |||
515 | struct buffer_head **primary; | 519 | struct buffer_head **primary; |
516 | struct buffer_head *dind; | 520 | struct buffer_head *dind; |
517 | struct ext3_iloc iloc; | 521 | struct ext3_iloc iloc; |
518 | unsigned long blk; | 522 | ext3_fsblk_t blk; |
519 | __u32 *data, *end; | 523 | __u32 *data, *end; |
520 | int gdbackups = 0; | 524 | int gdbackups = 0; |
521 | int res, i; | 525 | int res, i; |
@@ -540,7 +544,8 @@ static int reserve_backup_gdb(handle_t *handle, struct inode *inode, | |||
540 | for (res = 0; res < reserved_gdb; res++, blk++) { | 544 | for (res = 0; res < reserved_gdb; res++, blk++) { |
541 | if (le32_to_cpu(*data) != blk) { | 545 | if (le32_to_cpu(*data) != blk) { |
542 | ext3_warning(sb, __FUNCTION__, | 546 | ext3_warning(sb, __FUNCTION__, |
543 | "reserved block %lu not at offset %ld", | 547 | "reserved block "E3FSBLK |
548 | " not at offset %ld", | ||
544 | blk, (long)(data - (__u32 *)dind->b_data)); | 549 | blk, (long)(data - (__u32 *)dind->b_data)); |
545 | err = -EINVAL; | 550 | err = -EINVAL; |
546 | goto exit_bh; | 551 | goto exit_bh; |
@@ -902,15 +907,16 @@ exit_put: | |||
902 | * GDT blocks are reserved to grow to the desired size. | 907 | * GDT blocks are reserved to grow to the desired size. |
903 | */ | 908 | */ |
904 | int ext3_group_extend(struct super_block *sb, struct ext3_super_block *es, | 909 | int ext3_group_extend(struct super_block *sb, struct ext3_super_block *es, |
905 | unsigned long n_blocks_count) | 910 | ext3_fsblk_t n_blocks_count) |
906 | { | 911 | { |
907 | unsigned long o_blocks_count; | 912 | ext3_fsblk_t o_blocks_count; |
908 | unsigned long o_groups_count; | 913 | unsigned long o_groups_count; |
909 | unsigned long last; | 914 | ext3_grpblk_t last; |
910 | int add; | 915 | ext3_grpblk_t add; |
911 | struct buffer_head * bh; | 916 | struct buffer_head * bh; |
912 | handle_t *handle; | 917 | handle_t *handle; |
913 | int err, freed_blocks; | 918 | int err; |
919 | unsigned long freed_blocks; | ||
914 | 920 | ||
915 | /* We don't need to worry about locking wrt other resizers just | 921 | /* We don't need to worry about locking wrt other resizers just |
916 | * yet: we're going to revalidate es->s_blocks_count after | 922 | * yet: we're going to revalidate es->s_blocks_count after |
@@ -919,12 +925,22 @@ int ext3_group_extend(struct super_block *sb, struct ext3_super_block *es, | |||
919 | o_groups_count = EXT3_SB(sb)->s_groups_count; | 925 | o_groups_count = EXT3_SB(sb)->s_groups_count; |
920 | 926 | ||
921 | if (test_opt(sb, DEBUG)) | 927 | if (test_opt(sb, DEBUG)) |
922 | printk(KERN_DEBUG "EXT3-fs: extending last group from %lu to %lu blocks\n", | 928 | printk(KERN_DEBUG "EXT3-fs: extending last group from "E3FSBLK" uto "E3FSBLK" blocks\n", |
923 | o_blocks_count, n_blocks_count); | 929 | o_blocks_count, n_blocks_count); |
924 | 930 | ||
925 | if (n_blocks_count == 0 || n_blocks_count == o_blocks_count) | 931 | if (n_blocks_count == 0 || n_blocks_count == o_blocks_count) |
926 | return 0; | 932 | return 0; |
927 | 933 | ||
934 | if (n_blocks_count > (sector_t)(~0ULL) >> (sb->s_blocksize_bits - 9)) { | ||
935 | printk(KERN_ERR "EXT3-fs: filesystem on %s:" | ||
936 | " too large to resize to %lu blocks safely\n", | ||
937 | sb->s_id, n_blocks_count); | ||
938 | if (sizeof(sector_t) < 8) | ||
939 | ext3_warning(sb, __FUNCTION__, | ||
940 | "CONFIG_LBD not enabled\n"); | ||
941 | return -EINVAL; | ||
942 | } | ||
943 | |||
928 | if (n_blocks_count < o_blocks_count) { | 944 | if (n_blocks_count < o_blocks_count) { |
929 | ext3_warning(sb, __FUNCTION__, | 945 | ext3_warning(sb, __FUNCTION__, |
930 | "can't shrink FS - resize aborted"); | 946 | "can't shrink FS - resize aborted"); |
@@ -948,7 +964,8 @@ int ext3_group_extend(struct super_block *sb, struct ext3_super_block *es, | |||
948 | 964 | ||
949 | if (o_blocks_count + add < n_blocks_count) | 965 | if (o_blocks_count + add < n_blocks_count) |
950 | ext3_warning(sb, __FUNCTION__, | 966 | ext3_warning(sb, __FUNCTION__, |
951 | "will only finish group (%lu blocks, %u new)", | 967 | "will only finish group ("E3FSBLK |
968 | " blocks, %u new)", | ||
952 | o_blocks_count + add, add); | 969 | o_blocks_count + add, add); |
953 | 970 | ||
954 | /* See if the device is actually as big as what was requested */ | 971 | /* See if the device is actually as big as what was requested */ |
@@ -991,10 +1008,10 @@ int ext3_group_extend(struct super_block *sb, struct ext3_super_block *es, | |||
991 | ext3_journal_dirty_metadata(handle, EXT3_SB(sb)->s_sbh); | 1008 | ext3_journal_dirty_metadata(handle, EXT3_SB(sb)->s_sbh); |
992 | sb->s_dirt = 1; | 1009 | sb->s_dirt = 1; |
993 | unlock_super(sb); | 1010 | unlock_super(sb); |
994 | ext3_debug("freeing blocks %ld through %ld\n", o_blocks_count, | 1011 | ext3_debug("freeing blocks %lu through "E3FSBLK"\n", o_blocks_count, |
995 | o_blocks_count + add); | 1012 | o_blocks_count + add); |
996 | ext3_free_blocks_sb(handle, sb, o_blocks_count, add, &freed_blocks); | 1013 | ext3_free_blocks_sb(handle, sb, o_blocks_count, add, &freed_blocks); |
997 | ext3_debug("freed blocks %ld through %ld\n", o_blocks_count, | 1014 | ext3_debug("freed blocks "E3FSBLK" through "E3FSBLK"\n", o_blocks_count, |
998 | o_blocks_count + add); | 1015 | o_blocks_count + add); |
999 | if ((err = ext3_journal_stop(handle))) | 1016 | if ((err = ext3_journal_stop(handle))) |
1000 | goto exit_put; | 1017 | goto exit_put; |
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index f8a5266ea1..b7483360a2 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -58,7 +58,7 @@ static int ext3_sync_fs(struct super_block *sb, int wait); | |||
58 | static const char *ext3_decode_error(struct super_block * sb, int errno, | 58 | static const char *ext3_decode_error(struct super_block * sb, int errno, |
59 | char nbuf[16]); | 59 | char nbuf[16]); |
60 | static int ext3_remount (struct super_block * sb, int * flags, char * data); | 60 | static int ext3_remount (struct super_block * sb, int * flags, char * data); |
61 | static int ext3_statfs (struct super_block * sb, struct kstatfs * buf); | 61 | static int ext3_statfs (struct dentry * dentry, struct kstatfs * buf); |
62 | static void ext3_unlockfs(struct super_block *sb); | 62 | static void ext3_unlockfs(struct super_block *sb); |
63 | static void ext3_write_super (struct super_block * sb); | 63 | static void ext3_write_super (struct super_block * sb); |
64 | static void ext3_write_super_lockfs(struct super_block *sb); | 64 | static void ext3_write_super_lockfs(struct super_block *sb); |
@@ -499,20 +499,21 @@ static void ext3_clear_inode(struct inode *inode) | |||
499 | { | 499 | { |
500 | struct ext3_block_alloc_info *rsv = EXT3_I(inode)->i_block_alloc_info; | 500 | struct ext3_block_alloc_info *rsv = EXT3_I(inode)->i_block_alloc_info; |
501 | #ifdef CONFIG_EXT3_FS_POSIX_ACL | 501 | #ifdef CONFIG_EXT3_FS_POSIX_ACL |
502 | if (EXT3_I(inode)->i_acl && | 502 | if (EXT3_I(inode)->i_acl && |
503 | EXT3_I(inode)->i_acl != EXT3_ACL_NOT_CACHED) { | 503 | EXT3_I(inode)->i_acl != EXT3_ACL_NOT_CACHED) { |
504 | posix_acl_release(EXT3_I(inode)->i_acl); | 504 | posix_acl_release(EXT3_I(inode)->i_acl); |
505 | EXT3_I(inode)->i_acl = EXT3_ACL_NOT_CACHED; | 505 | EXT3_I(inode)->i_acl = EXT3_ACL_NOT_CACHED; |
506 | } | 506 | } |
507 | if (EXT3_I(inode)->i_default_acl && | 507 | if (EXT3_I(inode)->i_default_acl && |
508 | EXT3_I(inode)->i_default_acl != EXT3_ACL_NOT_CACHED) { | 508 | EXT3_I(inode)->i_default_acl != EXT3_ACL_NOT_CACHED) { |
509 | posix_acl_release(EXT3_I(inode)->i_default_acl); | 509 | posix_acl_release(EXT3_I(inode)->i_default_acl); |
510 | EXT3_I(inode)->i_default_acl = EXT3_ACL_NOT_CACHED; | 510 | EXT3_I(inode)->i_default_acl = EXT3_ACL_NOT_CACHED; |
511 | } | 511 | } |
512 | #endif | 512 | #endif |
513 | ext3_discard_reservation(inode); | 513 | ext3_discard_reservation(inode); |
514 | EXT3_I(inode)->i_block_alloc_info = NULL; | 514 | EXT3_I(inode)->i_block_alloc_info = NULL; |
515 | kfree(rsv); | 515 | if (unlikely(rsv)) |
516 | kfree(rsv); | ||
516 | } | 517 | } |
517 | 518 | ||
518 | static inline void ext3_show_quota_options(struct seq_file *seq, struct super_block *sb) | 519 | static inline void ext3_show_quota_options(struct seq_file *seq, struct super_block *sb) |
@@ -629,7 +630,7 @@ enum { | |||
629 | Opt_resgid, Opt_resuid, Opt_sb, Opt_err_cont, Opt_err_panic, Opt_err_ro, | 630 | Opt_resgid, Opt_resuid, Opt_sb, Opt_err_cont, Opt_err_panic, Opt_err_ro, |
630 | Opt_nouid32, Opt_nocheck, Opt_debug, Opt_oldalloc, Opt_orlov, | 631 | Opt_nouid32, Opt_nocheck, Opt_debug, Opt_oldalloc, Opt_orlov, |
631 | Opt_user_xattr, Opt_nouser_xattr, Opt_acl, Opt_noacl, | 632 | Opt_user_xattr, Opt_nouser_xattr, Opt_acl, Opt_noacl, |
632 | Opt_reservation, Opt_noreservation, Opt_noload, Opt_nobh, | 633 | Opt_reservation, Opt_noreservation, Opt_noload, Opt_nobh, Opt_bh, |
633 | Opt_commit, Opt_journal_update, Opt_journal_inum, Opt_journal_dev, | 634 | Opt_commit, Opt_journal_update, Opt_journal_inum, Opt_journal_dev, |
634 | Opt_abort, Opt_data_journal, Opt_data_ordered, Opt_data_writeback, | 635 | Opt_abort, Opt_data_journal, Opt_data_ordered, Opt_data_writeback, |
635 | Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota, | 636 | Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota, |
@@ -665,6 +666,7 @@ static match_table_t tokens = { | |||
665 | {Opt_noreservation, "noreservation"}, | 666 | {Opt_noreservation, "noreservation"}, |
666 | {Opt_noload, "noload"}, | 667 | {Opt_noload, "noload"}, |
667 | {Opt_nobh, "nobh"}, | 668 | {Opt_nobh, "nobh"}, |
669 | {Opt_bh, "bh"}, | ||
668 | {Opt_commit, "commit=%u"}, | 670 | {Opt_commit, "commit=%u"}, |
669 | {Opt_journal_update, "journal=update"}, | 671 | {Opt_journal_update, "journal=update"}, |
670 | {Opt_journal_inum, "journal=%u"}, | 672 | {Opt_journal_inum, "journal=%u"}, |
@@ -688,14 +690,15 @@ static match_table_t tokens = { | |||
688 | {Opt_resize, "resize"}, | 690 | {Opt_resize, "resize"}, |
689 | }; | 691 | }; |
690 | 692 | ||
691 | static unsigned long get_sb_block(void **data) | 693 | static ext3_fsblk_t get_sb_block(void **data) |
692 | { | 694 | { |
693 | unsigned long sb_block; | 695 | ext3_fsblk_t sb_block; |
694 | char *options = (char *) *data; | 696 | char *options = (char *) *data; |
695 | 697 | ||
696 | if (!options || strncmp(options, "sb=", 3) != 0) | 698 | if (!options || strncmp(options, "sb=", 3) != 0) |
697 | return 1; /* Default location */ | 699 | return 1; /* Default location */ |
698 | options += 3; | 700 | options += 3; |
701 | /*todo: use simple_strtoll with >32bit ext3 */ | ||
699 | sb_block = simple_strtoul(options, &options, 0); | 702 | sb_block = simple_strtoul(options, &options, 0); |
700 | if (*options && *options != ',') { | 703 | if (*options && *options != ',') { |
701 | printk("EXT3-fs: Invalid sb specification: %s\n", | 704 | printk("EXT3-fs: Invalid sb specification: %s\n", |
@@ -710,7 +713,7 @@ static unsigned long get_sb_block(void **data) | |||
710 | 713 | ||
711 | static int parse_options (char *options, struct super_block *sb, | 714 | static int parse_options (char *options, struct super_block *sb, |
712 | unsigned long *inum, unsigned long *journal_devnum, | 715 | unsigned long *inum, unsigned long *journal_devnum, |
713 | unsigned long *n_blocks_count, int is_remount) | 716 | ext3_fsblk_t *n_blocks_count, int is_remount) |
714 | { | 717 | { |
715 | struct ext3_sb_info *sbi = EXT3_SB(sb); | 718 | struct ext3_sb_info *sbi = EXT3_SB(sb); |
716 | char * p; | 719 | char * p; |
@@ -1012,6 +1015,9 @@ clear_qf_name: | |||
1012 | case Opt_nobh: | 1015 | case Opt_nobh: |
1013 | set_opt(sbi->s_mount_opt, NOBH); | 1016 | set_opt(sbi->s_mount_opt, NOBH); |
1014 | break; | 1017 | break; |
1018 | case Opt_bh: | ||
1019 | clear_opt(sbi->s_mount_opt, NOBH); | ||
1020 | break; | ||
1015 | default: | 1021 | default: |
1016 | printk (KERN_ERR | 1022 | printk (KERN_ERR |
1017 | "EXT3-fs: Unrecognized mount option \"%s\" " | 1023 | "EXT3-fs: Unrecognized mount option \"%s\" " |
@@ -1127,7 +1133,7 @@ static int ext3_setup_super(struct super_block *sb, struct ext3_super_block *es, | |||
1127 | static int ext3_check_descriptors (struct super_block * sb) | 1133 | static int ext3_check_descriptors (struct super_block * sb) |
1128 | { | 1134 | { |
1129 | struct ext3_sb_info *sbi = EXT3_SB(sb); | 1135 | struct ext3_sb_info *sbi = EXT3_SB(sb); |
1130 | unsigned long block = le32_to_cpu(sbi->s_es->s_first_data_block); | 1136 | ext3_fsblk_t block = le32_to_cpu(sbi->s_es->s_first_data_block); |
1131 | struct ext3_group_desc * gdp = NULL; | 1137 | struct ext3_group_desc * gdp = NULL; |
1132 | int desc_block = 0; | 1138 | int desc_block = 0; |
1133 | int i; | 1139 | int i; |
@@ -1314,15 +1320,14 @@ static loff_t ext3_max_size(int bits) | |||
1314 | return res; | 1320 | return res; |
1315 | } | 1321 | } |
1316 | 1322 | ||
1317 | static unsigned long descriptor_loc(struct super_block *sb, | 1323 | static ext3_fsblk_t descriptor_loc(struct super_block *sb, |
1318 | unsigned long logic_sb_block, | 1324 | ext3_fsblk_t logic_sb_block, |
1319 | int nr) | 1325 | int nr) |
1320 | { | 1326 | { |
1321 | struct ext3_sb_info *sbi = EXT3_SB(sb); | 1327 | struct ext3_sb_info *sbi = EXT3_SB(sb); |
1322 | unsigned long bg, first_data_block, first_meta_bg; | 1328 | unsigned long bg, first_meta_bg; |
1323 | int has_super = 0; | 1329 | int has_super = 0; |
1324 | 1330 | ||
1325 | first_data_block = le32_to_cpu(sbi->s_es->s_first_data_block); | ||
1326 | first_meta_bg = le32_to_cpu(sbi->s_es->s_first_meta_bg); | 1331 | first_meta_bg = le32_to_cpu(sbi->s_es->s_first_meta_bg); |
1327 | 1332 | ||
1328 | if (!EXT3_HAS_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_META_BG) || | 1333 | if (!EXT3_HAS_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_META_BG) || |
@@ -1331,7 +1336,7 @@ static unsigned long descriptor_loc(struct super_block *sb, | |||
1331 | bg = sbi->s_desc_per_block * nr; | 1336 | bg = sbi->s_desc_per_block * nr; |
1332 | if (ext3_bg_has_super(sb, bg)) | 1337 | if (ext3_bg_has_super(sb, bg)) |
1333 | has_super = 1; | 1338 | has_super = 1; |
1334 | return (first_data_block + has_super + (bg * sbi->s_blocks_per_group)); | 1339 | return (has_super + ext3_group_first_block_no(sb, bg)); |
1335 | } | 1340 | } |
1336 | 1341 | ||
1337 | 1342 | ||
@@ -1340,9 +1345,9 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
1340 | struct buffer_head * bh; | 1345 | struct buffer_head * bh; |
1341 | struct ext3_super_block *es = NULL; | 1346 | struct ext3_super_block *es = NULL; |
1342 | struct ext3_sb_info *sbi; | 1347 | struct ext3_sb_info *sbi; |
1343 | unsigned long block; | 1348 | ext3_fsblk_t block; |
1344 | unsigned long sb_block = get_sb_block(&data); | 1349 | ext3_fsblk_t sb_block = get_sb_block(&data); |
1345 | unsigned long logic_sb_block; | 1350 | ext3_fsblk_t logic_sb_block; |
1346 | unsigned long offset = 0; | 1351 | unsigned long offset = 0; |
1347 | unsigned long journal_inum = 0; | 1352 | unsigned long journal_inum = 0; |
1348 | unsigned long journal_devnum = 0; | 1353 | unsigned long journal_devnum = 0; |
@@ -1564,6 +1569,16 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
1564 | goto failed_mount; | 1569 | goto failed_mount; |
1565 | } | 1570 | } |
1566 | 1571 | ||
1572 | if (le32_to_cpu(es->s_blocks_count) > | ||
1573 | (sector_t)(~0ULL) >> (sb->s_blocksize_bits - 9)) { | ||
1574 | printk(KERN_ERR "EXT3-fs: filesystem on %s:" | ||
1575 | " too large to mount safely\n", sb->s_id); | ||
1576 | if (sizeof(sector_t) < 8) | ||
1577 | printk(KERN_WARNING "EXT3-fs: CONFIG_LBD not " | ||
1578 | "enabled\n"); | ||
1579 | goto failed_mount; | ||
1580 | } | ||
1581 | |||
1567 | if (EXT3_BLOCKS_PER_GROUP(sb) == 0) | 1582 | if (EXT3_BLOCKS_PER_GROUP(sb) == 0) |
1568 | goto cantfind_ext3; | 1583 | goto cantfind_ext3; |
1569 | sbi->s_groups_count = (le32_to_cpu(es->s_blocks_count) - | 1584 | sbi->s_groups_count = (le32_to_cpu(es->s_blocks_count) - |
@@ -1579,9 +1594,6 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
1579 | goto failed_mount; | 1594 | goto failed_mount; |
1580 | } | 1595 | } |
1581 | 1596 | ||
1582 | percpu_counter_init(&sbi->s_freeblocks_counter); | ||
1583 | percpu_counter_init(&sbi->s_freeinodes_counter); | ||
1584 | percpu_counter_init(&sbi->s_dirs_counter); | ||
1585 | bgl_lock_init(&sbi->s_blockgroup_lock); | 1597 | bgl_lock_init(&sbi->s_blockgroup_lock); |
1586 | 1598 | ||
1587 | for (i = 0; i < db_count; i++) { | 1599 | for (i = 0; i < db_count; i++) { |
@@ -1595,12 +1607,20 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
1595 | } | 1607 | } |
1596 | } | 1608 | } |
1597 | if (!ext3_check_descriptors (sb)) { | 1609 | if (!ext3_check_descriptors (sb)) { |
1598 | printk (KERN_ERR "EXT3-fs: group descriptors corrupted !\n"); | 1610 | printk(KERN_ERR "EXT3-fs: group descriptors corrupted!\n"); |
1599 | goto failed_mount2; | 1611 | goto failed_mount2; |
1600 | } | 1612 | } |
1601 | sbi->s_gdb_count = db_count; | 1613 | sbi->s_gdb_count = db_count; |
1602 | get_random_bytes(&sbi->s_next_generation, sizeof(u32)); | 1614 | get_random_bytes(&sbi->s_next_generation, sizeof(u32)); |
1603 | spin_lock_init(&sbi->s_next_gen_lock); | 1615 | spin_lock_init(&sbi->s_next_gen_lock); |
1616 | |||
1617 | percpu_counter_init(&sbi->s_freeblocks_counter, | ||
1618 | ext3_count_free_blocks(sb)); | ||
1619 | percpu_counter_init(&sbi->s_freeinodes_counter, | ||
1620 | ext3_count_free_inodes(sb)); | ||
1621 | percpu_counter_init(&sbi->s_dirs_counter, | ||
1622 | ext3_count_dirs(sb)); | ||
1623 | |||
1604 | /* per fileystem reservation list head & lock */ | 1624 | /* per fileystem reservation list head & lock */ |
1605 | spin_lock_init(&sbi->s_rsv_window_lock); | 1625 | spin_lock_init(&sbi->s_rsv_window_lock); |
1606 | sbi->s_rsv_window_root = RB_ROOT; | 1626 | sbi->s_rsv_window_root = RB_ROOT; |
@@ -1639,16 +1659,16 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
1639 | if (!test_opt(sb, NOLOAD) && | 1659 | if (!test_opt(sb, NOLOAD) && |
1640 | EXT3_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_HAS_JOURNAL)) { | 1660 | EXT3_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_HAS_JOURNAL)) { |
1641 | if (ext3_load_journal(sb, es, journal_devnum)) | 1661 | if (ext3_load_journal(sb, es, journal_devnum)) |
1642 | goto failed_mount2; | 1662 | goto failed_mount3; |
1643 | } else if (journal_inum) { | 1663 | } else if (journal_inum) { |
1644 | if (ext3_create_journal(sb, es, journal_inum)) | 1664 | if (ext3_create_journal(sb, es, journal_inum)) |
1645 | goto failed_mount2; | 1665 | goto failed_mount3; |
1646 | } else { | 1666 | } else { |
1647 | if (!silent) | 1667 | if (!silent) |
1648 | printk (KERN_ERR | 1668 | printk (KERN_ERR |
1649 | "ext3: No journal on filesystem on %s\n", | 1669 | "ext3: No journal on filesystem on %s\n", |
1650 | sb->s_id); | 1670 | sb->s_id); |
1651 | goto failed_mount2; | 1671 | goto failed_mount3; |
1652 | } | 1672 | } |
1653 | 1673 | ||
1654 | /* We have now updated the journal if required, so we can | 1674 | /* We have now updated the journal if required, so we can |
@@ -1671,7 +1691,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
1671 | (sbi->s_journal, 0, 0, JFS_FEATURE_INCOMPAT_REVOKE)) { | 1691 | (sbi->s_journal, 0, 0, JFS_FEATURE_INCOMPAT_REVOKE)) { |
1672 | printk(KERN_ERR "EXT3-fs: Journal does not support " | 1692 | printk(KERN_ERR "EXT3-fs: Journal does not support " |
1673 | "requested data journaling mode\n"); | 1693 | "requested data journaling mode\n"); |
1674 | goto failed_mount3; | 1694 | goto failed_mount4; |
1675 | } | 1695 | } |
1676 | default: | 1696 | default: |
1677 | break; | 1697 | break; |
@@ -1694,13 +1714,13 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
1694 | if (!sb->s_root) { | 1714 | if (!sb->s_root) { |
1695 | printk(KERN_ERR "EXT3-fs: get root inode failed\n"); | 1715 | printk(KERN_ERR "EXT3-fs: get root inode failed\n"); |
1696 | iput(root); | 1716 | iput(root); |
1697 | goto failed_mount3; | 1717 | goto failed_mount4; |
1698 | } | 1718 | } |
1699 | if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) { | 1719 | if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) { |
1700 | dput(sb->s_root); | 1720 | dput(sb->s_root); |
1701 | sb->s_root = NULL; | 1721 | sb->s_root = NULL; |
1702 | printk(KERN_ERR "EXT3-fs: corrupt root inode, run e2fsck\n"); | 1722 | printk(KERN_ERR "EXT3-fs: corrupt root inode, run e2fsck\n"); |
1703 | goto failed_mount3; | 1723 | goto failed_mount4; |
1704 | } | 1724 | } |
1705 | 1725 | ||
1706 | ext3_setup_super (sb, es, sb->s_flags & MS_RDONLY); | 1726 | ext3_setup_super (sb, es, sb->s_flags & MS_RDONLY); |
@@ -1723,13 +1743,6 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
1723 | test_opt(sb,DATA_FLAGS) == EXT3_MOUNT_ORDERED_DATA ? "ordered": | 1743 | test_opt(sb,DATA_FLAGS) == EXT3_MOUNT_ORDERED_DATA ? "ordered": |
1724 | "writeback"); | 1744 | "writeback"); |
1725 | 1745 | ||
1726 | percpu_counter_mod(&sbi->s_freeblocks_counter, | ||
1727 | ext3_count_free_blocks(sb)); | ||
1728 | percpu_counter_mod(&sbi->s_freeinodes_counter, | ||
1729 | ext3_count_free_inodes(sb)); | ||
1730 | percpu_counter_mod(&sbi->s_dirs_counter, | ||
1731 | ext3_count_dirs(sb)); | ||
1732 | |||
1733 | lock_kernel(); | 1746 | lock_kernel(); |
1734 | return 0; | 1747 | return 0; |
1735 | 1748 | ||
@@ -1739,8 +1752,12 @@ cantfind_ext3: | |||
1739 | sb->s_id); | 1752 | sb->s_id); |
1740 | goto failed_mount; | 1753 | goto failed_mount; |
1741 | 1754 | ||
1742 | failed_mount3: | 1755 | failed_mount4: |
1743 | journal_destroy(sbi->s_journal); | 1756 | journal_destroy(sbi->s_journal); |
1757 | failed_mount3: | ||
1758 | percpu_counter_destroy(&sbi->s_freeblocks_counter); | ||
1759 | percpu_counter_destroy(&sbi->s_freeinodes_counter); | ||
1760 | percpu_counter_destroy(&sbi->s_dirs_counter); | ||
1744 | failed_mount2: | 1761 | failed_mount2: |
1745 | for (i = 0; i < db_count; i++) | 1762 | for (i = 0; i < db_count; i++) |
1746 | brelse(sbi->s_group_desc[i]); | 1763 | brelse(sbi->s_group_desc[i]); |
@@ -1827,10 +1844,10 @@ static journal_t *ext3_get_dev_journal(struct super_block *sb, | |||
1827 | { | 1844 | { |
1828 | struct buffer_head * bh; | 1845 | struct buffer_head * bh; |
1829 | journal_t *journal; | 1846 | journal_t *journal; |
1830 | int start; | 1847 | ext3_fsblk_t start; |
1831 | int len; | 1848 | ext3_fsblk_t len; |
1832 | int hblock, blocksize; | 1849 | int hblock, blocksize; |
1833 | unsigned long sb_block; | 1850 | ext3_fsblk_t sb_block; |
1834 | unsigned long offset; | 1851 | unsigned long offset; |
1835 | struct ext3_super_block * es; | 1852 | struct ext3_super_block * es; |
1836 | struct block_device *bdev; | 1853 | struct block_device *bdev; |
@@ -2203,7 +2220,7 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data) | |||
2203 | { | 2220 | { |
2204 | struct ext3_super_block * es; | 2221 | struct ext3_super_block * es; |
2205 | struct ext3_sb_info *sbi = EXT3_SB(sb); | 2222 | struct ext3_sb_info *sbi = EXT3_SB(sb); |
2206 | unsigned long n_blocks_count = 0; | 2223 | ext3_fsblk_t n_blocks_count = 0; |
2207 | unsigned long old_sb_flags; | 2224 | unsigned long old_sb_flags; |
2208 | struct ext3_mount_options old_opts; | 2225 | struct ext3_mount_options old_opts; |
2209 | int err; | 2226 | int err; |
@@ -2318,11 +2335,12 @@ restore_opts: | |||
2318 | return err; | 2335 | return err; |
2319 | } | 2336 | } |
2320 | 2337 | ||
2321 | static int ext3_statfs (struct super_block * sb, struct kstatfs * buf) | 2338 | static int ext3_statfs (struct dentry * dentry, struct kstatfs * buf) |
2322 | { | 2339 | { |
2340 | struct super_block *sb = dentry->d_sb; | ||
2323 | struct ext3_sb_info *sbi = EXT3_SB(sb); | 2341 | struct ext3_sb_info *sbi = EXT3_SB(sb); |
2324 | struct ext3_super_block *es = sbi->s_es; | 2342 | struct ext3_super_block *es = sbi->s_es; |
2325 | unsigned long overhead; | 2343 | ext3_fsblk_t overhead; |
2326 | int i; | 2344 | int i; |
2327 | 2345 | ||
2328 | if (test_opt (sb, MINIX_DF)) | 2346 | if (test_opt (sb, MINIX_DF)) |
@@ -2646,10 +2664,10 @@ out: | |||
2646 | 2664 | ||
2647 | #endif | 2665 | #endif |
2648 | 2666 | ||
2649 | static struct super_block *ext3_get_sb(struct file_system_type *fs_type, | 2667 | static int ext3_get_sb(struct file_system_type *fs_type, |
2650 | int flags, const char *dev_name, void *data) | 2668 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
2651 | { | 2669 | { |
2652 | return get_sb_bdev(fs_type, flags, dev_name, data, ext3_fill_super); | 2670 | return get_sb_bdev(fs_type, flags, dev_name, data, ext3_fill_super, mnt); |
2653 | } | 2671 | } |
2654 | 2672 | ||
2655 | static struct file_system_type ext3_fs_type = { | 2673 | static struct file_system_type ext3_fs_type = { |
diff --git a/fs/ext3/xattr.c b/fs/ext3/xattr.c index e8d60bf6b7..a44a056220 100644 --- a/fs/ext3/xattr.c +++ b/fs/ext3/xattr.c | |||
@@ -225,7 +225,7 @@ ext3_xattr_block_get(struct inode *inode, int name_index, const char *name, | |||
225 | error = -ENODATA; | 225 | error = -ENODATA; |
226 | if (!EXT3_I(inode)->i_file_acl) | 226 | if (!EXT3_I(inode)->i_file_acl) |
227 | goto cleanup; | 227 | goto cleanup; |
228 | ea_idebug(inode, "reading block %d", EXT3_I(inode)->i_file_acl); | 228 | ea_idebug(inode, "reading block %u", EXT3_I(inode)->i_file_acl); |
229 | bh = sb_bread(inode->i_sb, EXT3_I(inode)->i_file_acl); | 229 | bh = sb_bread(inode->i_sb, EXT3_I(inode)->i_file_acl); |
230 | if (!bh) | 230 | if (!bh) |
231 | goto cleanup; | 231 | goto cleanup; |
@@ -233,7 +233,7 @@ ext3_xattr_block_get(struct inode *inode, int name_index, const char *name, | |||
233 | atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount)); | 233 | atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount)); |
234 | if (ext3_xattr_check_block(bh)) { | 234 | if (ext3_xattr_check_block(bh)) { |
235 | bad_block: ext3_error(inode->i_sb, __FUNCTION__, | 235 | bad_block: ext3_error(inode->i_sb, __FUNCTION__, |
236 | "inode %ld: bad block %d", inode->i_ino, | 236 | "inode %ld: bad block "E3FSBLK, inode->i_ino, |
237 | EXT3_I(inode)->i_file_acl); | 237 | EXT3_I(inode)->i_file_acl); |
238 | error = -EIO; | 238 | error = -EIO; |
239 | goto cleanup; | 239 | goto cleanup; |
@@ -366,7 +366,7 @@ ext3_xattr_block_list(struct inode *inode, char *buffer, size_t buffer_size) | |||
366 | error = 0; | 366 | error = 0; |
367 | if (!EXT3_I(inode)->i_file_acl) | 367 | if (!EXT3_I(inode)->i_file_acl) |
368 | goto cleanup; | 368 | goto cleanup; |
369 | ea_idebug(inode, "reading block %d", EXT3_I(inode)->i_file_acl); | 369 | ea_idebug(inode, "reading block %u", EXT3_I(inode)->i_file_acl); |
370 | bh = sb_bread(inode->i_sb, EXT3_I(inode)->i_file_acl); | 370 | bh = sb_bread(inode->i_sb, EXT3_I(inode)->i_file_acl); |
371 | error = -EIO; | 371 | error = -EIO; |
372 | if (!bh) | 372 | if (!bh) |
@@ -375,7 +375,7 @@ ext3_xattr_block_list(struct inode *inode, char *buffer, size_t buffer_size) | |||
375 | atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount)); | 375 | atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount)); |
376 | if (ext3_xattr_check_block(bh)) { | 376 | if (ext3_xattr_check_block(bh)) { |
377 | ext3_error(inode->i_sb, __FUNCTION__, | 377 | ext3_error(inode->i_sb, __FUNCTION__, |
378 | "inode %ld: bad block %d", inode->i_ino, | 378 | "inode %ld: bad block "E3FSBLK, inode->i_ino, |
379 | EXT3_I(inode)->i_file_acl); | 379 | EXT3_I(inode)->i_file_acl); |
380 | error = -EIO; | 380 | error = -EIO; |
381 | goto cleanup; | 381 | goto cleanup; |
@@ -647,7 +647,7 @@ ext3_xattr_block_find(struct inode *inode, struct ext3_xattr_info *i, | |||
647 | le32_to_cpu(BHDR(bs->bh)->h_refcount)); | 647 | le32_to_cpu(BHDR(bs->bh)->h_refcount)); |
648 | if (ext3_xattr_check_block(bs->bh)) { | 648 | if (ext3_xattr_check_block(bs->bh)) { |
649 | ext3_error(sb, __FUNCTION__, | 649 | ext3_error(sb, __FUNCTION__, |
650 | "inode %ld: bad block %d", inode->i_ino, | 650 | "inode %ld: bad block "E3FSBLK, inode->i_ino, |
651 | EXT3_I(inode)->i_file_acl); | 651 | EXT3_I(inode)->i_file_acl); |
652 | error = -EIO; | 652 | error = -EIO; |
653 | goto cleanup; | 653 | goto cleanup; |
@@ -792,11 +792,12 @@ inserted: | |||
792 | get_bh(new_bh); | 792 | get_bh(new_bh); |
793 | } else { | 793 | } else { |
794 | /* We need to allocate a new block */ | 794 | /* We need to allocate a new block */ |
795 | int goal = le32_to_cpu( | 795 | ext3_fsblk_t goal = le32_to_cpu( |
796 | EXT3_SB(sb)->s_es->s_first_data_block) + | 796 | EXT3_SB(sb)->s_es->s_first_data_block) + |
797 | EXT3_I(inode)->i_block_group * | 797 | (ext3_fsblk_t)EXT3_I(inode)->i_block_group * |
798 | EXT3_BLOCKS_PER_GROUP(sb); | 798 | EXT3_BLOCKS_PER_GROUP(sb); |
799 | int block = ext3_new_block(handle, inode, goal, &error); | 799 | ext3_fsblk_t block = ext3_new_block(handle, inode, |
800 | goal, &error); | ||
800 | if (error) | 801 | if (error) |
801 | goto cleanup; | 802 | goto cleanup; |
802 | ea_idebug(inode, "creating block %d", block); | 803 | ea_idebug(inode, "creating block %d", block); |
@@ -847,7 +848,7 @@ cleanup_dquot: | |||
847 | 848 | ||
848 | bad_block: | 849 | bad_block: |
849 | ext3_error(inode->i_sb, __FUNCTION__, | 850 | ext3_error(inode->i_sb, __FUNCTION__, |
850 | "inode %ld: bad block %d", inode->i_ino, | 851 | "inode %ld: bad block "E3FSBLK, inode->i_ino, |
851 | EXT3_I(inode)->i_file_acl); | 852 | EXT3_I(inode)->i_file_acl); |
852 | goto cleanup; | 853 | goto cleanup; |
853 | 854 | ||
@@ -1076,14 +1077,14 @@ ext3_xattr_delete_inode(handle_t *handle, struct inode *inode) | |||
1076 | bh = sb_bread(inode->i_sb, EXT3_I(inode)->i_file_acl); | 1077 | bh = sb_bread(inode->i_sb, EXT3_I(inode)->i_file_acl); |
1077 | if (!bh) { | 1078 | if (!bh) { |
1078 | ext3_error(inode->i_sb, __FUNCTION__, | 1079 | ext3_error(inode->i_sb, __FUNCTION__, |
1079 | "inode %ld: block %d read error", inode->i_ino, | 1080 | "inode %ld: block "E3FSBLK" read error", inode->i_ino, |
1080 | EXT3_I(inode)->i_file_acl); | 1081 | EXT3_I(inode)->i_file_acl); |
1081 | goto cleanup; | 1082 | goto cleanup; |
1082 | } | 1083 | } |
1083 | if (BHDR(bh)->h_magic != cpu_to_le32(EXT3_XATTR_MAGIC) || | 1084 | if (BHDR(bh)->h_magic != cpu_to_le32(EXT3_XATTR_MAGIC) || |
1084 | BHDR(bh)->h_blocks != cpu_to_le32(1)) { | 1085 | BHDR(bh)->h_blocks != cpu_to_le32(1)) { |
1085 | ext3_error(inode->i_sb, __FUNCTION__, | 1086 | ext3_error(inode->i_sb, __FUNCTION__, |
1086 | "inode %ld: bad block %d", inode->i_ino, | 1087 | "inode %ld: bad block "E3FSBLK, inode->i_ino, |
1087 | EXT3_I(inode)->i_file_acl); | 1088 | EXT3_I(inode)->i_file_acl); |
1088 | goto cleanup; | 1089 | goto cleanup; |
1089 | } | 1090 | } |
@@ -1210,11 +1211,11 @@ again: | |||
1210 | bh = sb_bread(inode->i_sb, ce->e_block); | 1211 | bh = sb_bread(inode->i_sb, ce->e_block); |
1211 | if (!bh) { | 1212 | if (!bh) { |
1212 | ext3_error(inode->i_sb, __FUNCTION__, | 1213 | ext3_error(inode->i_sb, __FUNCTION__, |
1213 | "inode %ld: block %ld read error", | 1214 | "inode %ld: block %lu read error", |
1214 | inode->i_ino, (unsigned long) ce->e_block); | 1215 | inode->i_ino, (unsigned long) ce->e_block); |
1215 | } else if (le32_to_cpu(BHDR(bh)->h_refcount) >= | 1216 | } else if (le32_to_cpu(BHDR(bh)->h_refcount) >= |
1216 | EXT3_XATTR_REFCOUNT_MAX) { | 1217 | EXT3_XATTR_REFCOUNT_MAX) { |
1217 | ea_idebug(inode, "block %ld refcount %d>=%d", | 1218 | ea_idebug(inode, "block %lu refcount %d>=%d", |
1218 | (unsigned long) ce->e_block, | 1219 | (unsigned long) ce->e_block, |
1219 | le32_to_cpu(BHDR(bh)->h_refcount), | 1220 | le32_to_cpu(BHDR(bh)->h_refcount), |
1220 | EXT3_XATTR_REFCOUNT_MAX); | 1221 | EXT3_XATTR_REFCOUNT_MAX); |