diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ocfs2/alloc.c | 5 | ||||
-rw-r--r-- | fs/ocfs2/dir.c | 2 | ||||
-rw-r--r-- | fs/ocfs2/localalloc.c | 2 | ||||
-rw-r--r-- | fs/ocfs2/ocfs2.h | 29 | ||||
-rw-r--r-- | fs/ocfs2/refcounttree.c | 6 | ||||
-rw-r--r-- | fs/ocfs2/suballoc.c | 171 | ||||
-rw-r--r-- | fs/ocfs2/suballoc.h | 1 | ||||
-rw-r--r-- | fs/ocfs2/super.c | 10 | ||||
-rw-r--r-- | fs/ocfs2/xattr.c | 2 |
9 files changed, 150 insertions, 78 deletions
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index d17bdc718f74..2bbe1ecc08c0 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c | |||
@@ -1050,7 +1050,8 @@ static int ocfs2_create_new_meta_bhs(handle_t *handle, | |||
1050 | strcpy(eb->h_signature, OCFS2_EXTENT_BLOCK_SIGNATURE); | 1050 | strcpy(eb->h_signature, OCFS2_EXTENT_BLOCK_SIGNATURE); |
1051 | eb->h_blkno = cpu_to_le64(first_blkno); | 1051 | eb->h_blkno = cpu_to_le64(first_blkno); |
1052 | eb->h_fs_generation = cpu_to_le32(osb->fs_generation); | 1052 | eb->h_fs_generation = cpu_to_le32(osb->fs_generation); |
1053 | eb->h_suballoc_slot = cpu_to_le16(osb->slot_num); | 1053 | eb->h_suballoc_slot = |
1054 | cpu_to_le16(meta_ac->ac_alloc_slot); | ||
1054 | eb->h_suballoc_bit = cpu_to_le16(suballoc_bit_start); | 1055 | eb->h_suballoc_bit = cpu_to_le16(suballoc_bit_start); |
1055 | eb->h_list.l_count = | 1056 | eb->h_list.l_count = |
1056 | cpu_to_le16(ocfs2_extent_recs_per_eb(osb->sb)); | 1057 | cpu_to_le16(ocfs2_extent_recs_per_eb(osb->sb)); |
@@ -6037,7 +6038,7 @@ static void ocfs2_truncate_log_worker(struct work_struct *work) | |||
6037 | if (status < 0) | 6038 | if (status < 0) |
6038 | mlog_errno(status); | 6039 | mlog_errno(status); |
6039 | else | 6040 | else |
6040 | ocfs2_init_inode_steal_slot(osb); | 6041 | ocfs2_init_steal_slots(osb); |
6041 | 6042 | ||
6042 | mlog_exit(status); | 6043 | mlog_exit(status); |
6043 | } | 6044 | } |
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c index 28c3ec238796..765d66c70989 100644 --- a/fs/ocfs2/dir.c +++ b/fs/ocfs2/dir.c | |||
@@ -2439,7 +2439,7 @@ static int ocfs2_dx_dir_attach_index(struct ocfs2_super *osb, | |||
2439 | dx_root = (struct ocfs2_dx_root_block *)dx_root_bh->b_data; | 2439 | dx_root = (struct ocfs2_dx_root_block *)dx_root_bh->b_data; |
2440 | memset(dx_root, 0, osb->sb->s_blocksize); | 2440 | memset(dx_root, 0, osb->sb->s_blocksize); |
2441 | strcpy(dx_root->dr_signature, OCFS2_DX_ROOT_SIGNATURE); | 2441 | strcpy(dx_root->dr_signature, OCFS2_DX_ROOT_SIGNATURE); |
2442 | dx_root->dr_suballoc_slot = cpu_to_le16(osb->slot_num); | 2442 | dx_root->dr_suballoc_slot = cpu_to_le16(meta_ac->ac_alloc_slot); |
2443 | dx_root->dr_suballoc_bit = cpu_to_le16(dr_suballoc_bit); | 2443 | dx_root->dr_suballoc_bit = cpu_to_le16(dr_suballoc_bit); |
2444 | dx_root->dr_fs_generation = cpu_to_le32(osb->fs_generation); | 2444 | dx_root->dr_fs_generation = cpu_to_le32(osb->fs_generation); |
2445 | dx_root->dr_blkno = cpu_to_le64(dr_blkno); | 2445 | dx_root->dr_blkno = cpu_to_le64(dr_blkno); |
diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c index ac10f83edb95..ca992d91f511 100644 --- a/fs/ocfs2/localalloc.c +++ b/fs/ocfs2/localalloc.c | |||
@@ -476,7 +476,7 @@ out_mutex: | |||
476 | 476 | ||
477 | out: | 477 | out: |
478 | if (!status) | 478 | if (!status) |
479 | ocfs2_init_inode_steal_slot(osb); | 479 | ocfs2_init_steal_slots(osb); |
480 | mlog_exit(status); | 480 | mlog_exit(status); |
481 | return status; | 481 | return status; |
482 | } | 482 | } |
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h index 740f448041e2..8857dd724f90 100644 --- a/fs/ocfs2/ocfs2.h +++ b/fs/ocfs2/ocfs2.h | |||
@@ -305,7 +305,9 @@ struct ocfs2_super | |||
305 | u32 s_next_generation; | 305 | u32 s_next_generation; |
306 | unsigned long osb_flags; | 306 | unsigned long osb_flags; |
307 | s16 s_inode_steal_slot; | 307 | s16 s_inode_steal_slot; |
308 | s16 s_meta_steal_slot; | ||
308 | atomic_t s_num_inodes_stolen; | 309 | atomic_t s_num_inodes_stolen; |
310 | atomic_t s_num_meta_stolen; | ||
309 | 311 | ||
310 | unsigned long s_mount_opt; | 312 | unsigned long s_mount_opt; |
311 | unsigned int s_atime_quantum; | 313 | unsigned int s_atime_quantum; |
@@ -760,33 +762,6 @@ static inline unsigned int ocfs2_megabytes_to_clusters(struct super_block *sb, | |||
760 | return megs << (20 - OCFS2_SB(sb)->s_clustersize_bits); | 762 | return megs << (20 - OCFS2_SB(sb)->s_clustersize_bits); |
761 | } | 763 | } |
762 | 764 | ||
763 | static inline void ocfs2_init_inode_steal_slot(struct ocfs2_super *osb) | ||
764 | { | ||
765 | spin_lock(&osb->osb_lock); | ||
766 | osb->s_inode_steal_slot = OCFS2_INVALID_SLOT; | ||
767 | spin_unlock(&osb->osb_lock); | ||
768 | atomic_set(&osb->s_num_inodes_stolen, 0); | ||
769 | } | ||
770 | |||
771 | static inline void ocfs2_set_inode_steal_slot(struct ocfs2_super *osb, | ||
772 | s16 slot) | ||
773 | { | ||
774 | spin_lock(&osb->osb_lock); | ||
775 | osb->s_inode_steal_slot = slot; | ||
776 | spin_unlock(&osb->osb_lock); | ||
777 | } | ||
778 | |||
779 | static inline s16 ocfs2_get_inode_steal_slot(struct ocfs2_super *osb) | ||
780 | { | ||
781 | s16 slot; | ||
782 | |||
783 | spin_lock(&osb->osb_lock); | ||
784 | slot = osb->s_inode_steal_slot; | ||
785 | spin_unlock(&osb->osb_lock); | ||
786 | |||
787 | return slot; | ||
788 | } | ||
789 | |||
790 | #define ocfs2_set_bit ext2_set_bit | 765 | #define ocfs2_set_bit ext2_set_bit |
791 | #define ocfs2_clear_bit ext2_clear_bit | 766 | #define ocfs2_clear_bit ext2_clear_bit |
792 | #define ocfs2_test_bit ext2_test_bit | 767 | #define ocfs2_test_bit ext2_test_bit |
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c index 8ae65c9c020c..fb6aa7acf54b 100644 --- a/fs/ocfs2/refcounttree.c +++ b/fs/ocfs2/refcounttree.c | |||
@@ -626,7 +626,7 @@ static int ocfs2_create_refcount_tree(struct inode *inode, | |||
626 | rb = (struct ocfs2_refcount_block *)new_bh->b_data; | 626 | rb = (struct ocfs2_refcount_block *)new_bh->b_data; |
627 | memset(rb, 0, inode->i_sb->s_blocksize); | 627 | memset(rb, 0, inode->i_sb->s_blocksize); |
628 | strcpy((void *)rb, OCFS2_REFCOUNT_BLOCK_SIGNATURE); | 628 | strcpy((void *)rb, OCFS2_REFCOUNT_BLOCK_SIGNATURE); |
629 | rb->rf_suballoc_slot = cpu_to_le16(osb->slot_num); | 629 | rb->rf_suballoc_slot = cpu_to_le16(meta_ac->ac_alloc_slot); |
630 | rb->rf_suballoc_bit = cpu_to_le16(suballoc_bit_start); | 630 | rb->rf_suballoc_bit = cpu_to_le16(suballoc_bit_start); |
631 | rb->rf_fs_generation = cpu_to_le32(osb->fs_generation); | 631 | rb->rf_fs_generation = cpu_to_le32(osb->fs_generation); |
632 | rb->rf_blkno = cpu_to_le64(first_blkno); | 632 | rb->rf_blkno = cpu_to_le64(first_blkno); |
@@ -1330,7 +1330,7 @@ static int ocfs2_expand_inline_ref_root(handle_t *handle, | |||
1330 | memcpy(new_bh->b_data, ref_root_bh->b_data, sb->s_blocksize); | 1330 | memcpy(new_bh->b_data, ref_root_bh->b_data, sb->s_blocksize); |
1331 | 1331 | ||
1332 | new_rb = (struct ocfs2_refcount_block *)new_bh->b_data; | 1332 | new_rb = (struct ocfs2_refcount_block *)new_bh->b_data; |
1333 | new_rb->rf_suballoc_slot = cpu_to_le16(OCFS2_SB(sb)->slot_num); | 1333 | new_rb->rf_suballoc_slot = cpu_to_le16(meta_ac->ac_alloc_slot); |
1334 | new_rb->rf_suballoc_bit = cpu_to_le16(suballoc_bit_start); | 1334 | new_rb->rf_suballoc_bit = cpu_to_le16(suballoc_bit_start); |
1335 | new_rb->rf_blkno = cpu_to_le64(blkno); | 1335 | new_rb->rf_blkno = cpu_to_le64(blkno); |
1336 | new_rb->rf_cpos = cpu_to_le32(0); | 1336 | new_rb->rf_cpos = cpu_to_le32(0); |
@@ -1576,7 +1576,7 @@ static int ocfs2_new_leaf_refcount_block(handle_t *handle, | |||
1576 | new_rb = (struct ocfs2_refcount_block *)new_bh->b_data; | 1576 | new_rb = (struct ocfs2_refcount_block *)new_bh->b_data; |
1577 | memset(new_rb, 0, sb->s_blocksize); | 1577 | memset(new_rb, 0, sb->s_blocksize); |
1578 | strcpy((void *)new_rb, OCFS2_REFCOUNT_BLOCK_SIGNATURE); | 1578 | strcpy((void *)new_rb, OCFS2_REFCOUNT_BLOCK_SIGNATURE); |
1579 | new_rb->rf_suballoc_slot = cpu_to_le16(OCFS2_SB(sb)->slot_num); | 1579 | new_rb->rf_suballoc_slot = cpu_to_le16(meta_ac->ac_alloc_slot); |
1580 | new_rb->rf_suballoc_bit = cpu_to_le16(suballoc_bit_start); | 1580 | new_rb->rf_suballoc_bit = cpu_to_le16(suballoc_bit_start); |
1581 | new_rb->rf_fs_generation = cpu_to_le32(OCFS2_SB(sb)->fs_generation); | 1581 | new_rb->rf_fs_generation = cpu_to_le32(OCFS2_SB(sb)->fs_generation); |
1582 | new_rb->rf_blkno = cpu_to_le64(blkno); | 1582 | new_rb->rf_blkno = cpu_to_le64(blkno); |
diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c index c30b644d9572..c3c60bc3e072 100644 --- a/fs/ocfs2/suballoc.c +++ b/fs/ocfs2/suballoc.c | |||
@@ -51,7 +51,7 @@ | |||
51 | #define ALLOC_NEW_GROUP 0x1 | 51 | #define ALLOC_NEW_GROUP 0x1 |
52 | #define ALLOC_GROUPS_FROM_GLOBAL 0x2 | 52 | #define ALLOC_GROUPS_FROM_GLOBAL 0x2 |
53 | 53 | ||
54 | #define OCFS2_MAX_INODES_TO_STEAL 1024 | 54 | #define OCFS2_MAX_TO_STEAL 1024 |
55 | 55 | ||
56 | static inline void ocfs2_debug_bg(struct ocfs2_group_desc *bg); | 56 | static inline void ocfs2_debug_bg(struct ocfs2_group_desc *bg); |
57 | static inline void ocfs2_debug_suballoc_inode(struct ocfs2_dinode *fe); | 57 | static inline void ocfs2_debug_suballoc_inode(struct ocfs2_dinode *fe); |
@@ -637,12 +637,113 @@ bail: | |||
637 | return status; | 637 | return status; |
638 | } | 638 | } |
639 | 639 | ||
640 | static void ocfs2_init_inode_steal_slot(struct ocfs2_super *osb) | ||
641 | { | ||
642 | spin_lock(&osb->osb_lock); | ||
643 | osb->s_inode_steal_slot = OCFS2_INVALID_SLOT; | ||
644 | spin_unlock(&osb->osb_lock); | ||
645 | atomic_set(&osb->s_num_inodes_stolen, 0); | ||
646 | } | ||
647 | |||
648 | static void ocfs2_init_meta_steal_slot(struct ocfs2_super *osb) | ||
649 | { | ||
650 | spin_lock(&osb->osb_lock); | ||
651 | osb->s_meta_steal_slot = OCFS2_INVALID_SLOT; | ||
652 | spin_unlock(&osb->osb_lock); | ||
653 | atomic_set(&osb->s_num_meta_stolen, 0); | ||
654 | } | ||
655 | |||
656 | void ocfs2_init_steal_slots(struct ocfs2_super *osb) | ||
657 | { | ||
658 | ocfs2_init_inode_steal_slot(osb); | ||
659 | ocfs2_init_meta_steal_slot(osb); | ||
660 | } | ||
661 | |||
662 | static void __ocfs2_set_steal_slot(struct ocfs2_super *osb, int slot, int type) | ||
663 | { | ||
664 | spin_lock(&osb->osb_lock); | ||
665 | if (type == INODE_ALLOC_SYSTEM_INODE) | ||
666 | osb->s_inode_steal_slot = slot; | ||
667 | else if (type == EXTENT_ALLOC_SYSTEM_INODE) | ||
668 | osb->s_meta_steal_slot = slot; | ||
669 | spin_unlock(&osb->osb_lock); | ||
670 | } | ||
671 | |||
672 | static int __ocfs2_get_steal_slot(struct ocfs2_super *osb, int type) | ||
673 | { | ||
674 | int slot = OCFS2_INVALID_SLOT; | ||
675 | |||
676 | spin_lock(&osb->osb_lock); | ||
677 | if (type == INODE_ALLOC_SYSTEM_INODE) | ||
678 | slot = osb->s_inode_steal_slot; | ||
679 | else if (type == EXTENT_ALLOC_SYSTEM_INODE) | ||
680 | slot = osb->s_meta_steal_slot; | ||
681 | spin_unlock(&osb->osb_lock); | ||
682 | |||
683 | return slot; | ||
684 | } | ||
685 | |||
686 | static int ocfs2_get_inode_steal_slot(struct ocfs2_super *osb) | ||
687 | { | ||
688 | return __ocfs2_get_steal_slot(osb, INODE_ALLOC_SYSTEM_INODE); | ||
689 | } | ||
690 | |||
691 | static int ocfs2_get_meta_steal_slot(struct ocfs2_super *osb) | ||
692 | { | ||
693 | return __ocfs2_get_steal_slot(osb, EXTENT_ALLOC_SYSTEM_INODE); | ||
694 | } | ||
695 | |||
696 | static int ocfs2_steal_resource(struct ocfs2_super *osb, | ||
697 | struct ocfs2_alloc_context *ac, | ||
698 | int type) | ||
699 | { | ||
700 | int i, status = -ENOSPC; | ||
701 | int slot = __ocfs2_get_steal_slot(osb, type); | ||
702 | |||
703 | /* Start to steal resource from the first slot after ours. */ | ||
704 | if (slot == OCFS2_INVALID_SLOT) | ||
705 | slot = osb->slot_num + 1; | ||
706 | |||
707 | for (i = 0; i < osb->max_slots; i++, slot++) { | ||
708 | if (slot == osb->max_slots) | ||
709 | slot = 0; | ||
710 | |||
711 | if (slot == osb->slot_num) | ||
712 | continue; | ||
713 | |||
714 | status = ocfs2_reserve_suballoc_bits(osb, ac, | ||
715 | type, | ||
716 | (u32)slot, NULL, | ||
717 | NOT_ALLOC_NEW_GROUP); | ||
718 | if (status >= 0) { | ||
719 | __ocfs2_set_steal_slot(osb, slot, type); | ||
720 | break; | ||
721 | } | ||
722 | |||
723 | ocfs2_free_ac_resource(ac); | ||
724 | } | ||
725 | |||
726 | return status; | ||
727 | } | ||
728 | |||
729 | static int ocfs2_steal_inode(struct ocfs2_super *osb, | ||
730 | struct ocfs2_alloc_context *ac) | ||
731 | { | ||
732 | return ocfs2_steal_resource(osb, ac, INODE_ALLOC_SYSTEM_INODE); | ||
733 | } | ||
734 | |||
735 | static int ocfs2_steal_meta(struct ocfs2_super *osb, | ||
736 | struct ocfs2_alloc_context *ac) | ||
737 | { | ||
738 | return ocfs2_steal_resource(osb, ac, EXTENT_ALLOC_SYSTEM_INODE); | ||
739 | } | ||
740 | |||
640 | int ocfs2_reserve_new_metadata_blocks(struct ocfs2_super *osb, | 741 | int ocfs2_reserve_new_metadata_blocks(struct ocfs2_super *osb, |
641 | int blocks, | 742 | int blocks, |
642 | struct ocfs2_alloc_context **ac) | 743 | struct ocfs2_alloc_context **ac) |
643 | { | 744 | { |
644 | int status; | 745 | int status; |
645 | u32 slot; | 746 | int slot = ocfs2_get_meta_steal_slot(osb); |
646 | 747 | ||
647 | *ac = kzalloc(sizeof(struct ocfs2_alloc_context), GFP_KERNEL); | 748 | *ac = kzalloc(sizeof(struct ocfs2_alloc_context), GFP_KERNEL); |
648 | if (!(*ac)) { | 749 | if (!(*ac)) { |
@@ -653,12 +754,34 @@ int ocfs2_reserve_new_metadata_blocks(struct ocfs2_super *osb, | |||
653 | 754 | ||
654 | (*ac)->ac_bits_wanted = blocks; | 755 | (*ac)->ac_bits_wanted = blocks; |
655 | (*ac)->ac_which = OCFS2_AC_USE_META; | 756 | (*ac)->ac_which = OCFS2_AC_USE_META; |
656 | slot = osb->slot_num; | ||
657 | (*ac)->ac_group_search = ocfs2_block_group_search; | 757 | (*ac)->ac_group_search = ocfs2_block_group_search; |
658 | 758 | ||
759 | if (slot != OCFS2_INVALID_SLOT && | ||
760 | atomic_read(&osb->s_num_meta_stolen) < OCFS2_MAX_TO_STEAL) | ||
761 | goto extent_steal; | ||
762 | |||
763 | atomic_set(&osb->s_num_meta_stolen, 0); | ||
659 | status = ocfs2_reserve_suballoc_bits(osb, (*ac), | 764 | status = ocfs2_reserve_suballoc_bits(osb, (*ac), |
660 | EXTENT_ALLOC_SYSTEM_INODE, | 765 | EXTENT_ALLOC_SYSTEM_INODE, |
661 | slot, NULL, ALLOC_NEW_GROUP); | 766 | (u32)osb->slot_num, NULL, |
767 | ALLOC_NEW_GROUP); | ||
768 | |||
769 | |||
770 | if (status >= 0) { | ||
771 | status = 0; | ||
772 | if (slot != OCFS2_INVALID_SLOT) | ||
773 | ocfs2_init_meta_steal_slot(osb); | ||
774 | goto bail; | ||
775 | } else if (status < 0 && status != -ENOSPC) { | ||
776 | mlog_errno(status); | ||
777 | goto bail; | ||
778 | } | ||
779 | |||
780 | ocfs2_free_ac_resource(*ac); | ||
781 | |||
782 | extent_steal: | ||
783 | status = ocfs2_steal_meta(osb, *ac); | ||
784 | atomic_inc(&osb->s_num_meta_stolen); | ||
662 | if (status < 0) { | 785 | if (status < 0) { |
663 | if (status != -ENOSPC) | 786 | if (status != -ENOSPC) |
664 | mlog_errno(status); | 787 | mlog_errno(status); |
@@ -685,43 +808,11 @@ int ocfs2_reserve_new_metadata(struct ocfs2_super *osb, | |||
685 | ac); | 808 | ac); |
686 | } | 809 | } |
687 | 810 | ||
688 | static int ocfs2_steal_inode_from_other_nodes(struct ocfs2_super *osb, | ||
689 | struct ocfs2_alloc_context *ac) | ||
690 | { | ||
691 | int i, status = -ENOSPC; | ||
692 | s16 slot = ocfs2_get_inode_steal_slot(osb); | ||
693 | |||
694 | /* Start to steal inodes from the first slot after ours. */ | ||
695 | if (slot == OCFS2_INVALID_SLOT) | ||
696 | slot = osb->slot_num + 1; | ||
697 | |||
698 | for (i = 0; i < osb->max_slots; i++, slot++) { | ||
699 | if (slot == osb->max_slots) | ||
700 | slot = 0; | ||
701 | |||
702 | if (slot == osb->slot_num) | ||
703 | continue; | ||
704 | |||
705 | status = ocfs2_reserve_suballoc_bits(osb, ac, | ||
706 | INODE_ALLOC_SYSTEM_INODE, | ||
707 | slot, NULL, | ||
708 | NOT_ALLOC_NEW_GROUP); | ||
709 | if (status >= 0) { | ||
710 | ocfs2_set_inode_steal_slot(osb, slot); | ||
711 | break; | ||
712 | } | ||
713 | |||
714 | ocfs2_free_ac_resource(ac); | ||
715 | } | ||
716 | |||
717 | return status; | ||
718 | } | ||
719 | |||
720 | int ocfs2_reserve_new_inode(struct ocfs2_super *osb, | 811 | int ocfs2_reserve_new_inode(struct ocfs2_super *osb, |
721 | struct ocfs2_alloc_context **ac) | 812 | struct ocfs2_alloc_context **ac) |
722 | { | 813 | { |
723 | int status; | 814 | int status; |
724 | s16 slot = ocfs2_get_inode_steal_slot(osb); | 815 | int slot = ocfs2_get_inode_steal_slot(osb); |
725 | u64 alloc_group; | 816 | u64 alloc_group; |
726 | 817 | ||
727 | *ac = kzalloc(sizeof(struct ocfs2_alloc_context), GFP_KERNEL); | 818 | *ac = kzalloc(sizeof(struct ocfs2_alloc_context), GFP_KERNEL); |
@@ -754,14 +845,14 @@ int ocfs2_reserve_new_inode(struct ocfs2_super *osb, | |||
754 | * need to check our slots to see whether there is some space for us. | 845 | * need to check our slots to see whether there is some space for us. |
755 | */ | 846 | */ |
756 | if (slot != OCFS2_INVALID_SLOT && | 847 | if (slot != OCFS2_INVALID_SLOT && |
757 | atomic_read(&osb->s_num_inodes_stolen) < OCFS2_MAX_INODES_TO_STEAL) | 848 | atomic_read(&osb->s_num_inodes_stolen) < OCFS2_MAX_TO_STEAL) |
758 | goto inode_steal; | 849 | goto inode_steal; |
759 | 850 | ||
760 | atomic_set(&osb->s_num_inodes_stolen, 0); | 851 | atomic_set(&osb->s_num_inodes_stolen, 0); |
761 | alloc_group = osb->osb_inode_alloc_group; | 852 | alloc_group = osb->osb_inode_alloc_group; |
762 | status = ocfs2_reserve_suballoc_bits(osb, *ac, | 853 | status = ocfs2_reserve_suballoc_bits(osb, *ac, |
763 | INODE_ALLOC_SYSTEM_INODE, | 854 | INODE_ALLOC_SYSTEM_INODE, |
764 | osb->slot_num, | 855 | (u32)osb->slot_num, |
765 | &alloc_group, | 856 | &alloc_group, |
766 | ALLOC_NEW_GROUP | | 857 | ALLOC_NEW_GROUP | |
767 | ALLOC_GROUPS_FROM_GLOBAL); | 858 | ALLOC_GROUPS_FROM_GLOBAL); |
@@ -789,7 +880,7 @@ int ocfs2_reserve_new_inode(struct ocfs2_super *osb, | |||
789 | ocfs2_free_ac_resource(*ac); | 880 | ocfs2_free_ac_resource(*ac); |
790 | 881 | ||
791 | inode_steal: | 882 | inode_steal: |
792 | status = ocfs2_steal_inode_from_other_nodes(osb, *ac); | 883 | status = ocfs2_steal_inode(osb, *ac); |
793 | atomic_inc(&osb->s_num_inodes_stolen); | 884 | atomic_inc(&osb->s_num_inodes_stolen); |
794 | if (status < 0) { | 885 | if (status < 0) { |
795 | if (status != -ENOSPC) | 886 | if (status != -ENOSPC) |
diff --git a/fs/ocfs2/suballoc.h b/fs/ocfs2/suballoc.h index 8c9a78a43164..fa60723c43e8 100644 --- a/fs/ocfs2/suballoc.h +++ b/fs/ocfs2/suballoc.h | |||
@@ -56,6 +56,7 @@ struct ocfs2_alloc_context { | |||
56 | is the same as ~0 - unlimited */ | 56 | is the same as ~0 - unlimited */ |
57 | }; | 57 | }; |
58 | 58 | ||
59 | void ocfs2_init_steal_slots(struct ocfs2_super *osb); | ||
59 | void ocfs2_free_alloc_context(struct ocfs2_alloc_context *ac); | 60 | void ocfs2_free_alloc_context(struct ocfs2_alloc_context *ac); |
60 | static inline int ocfs2_alloc_context_bits_left(struct ocfs2_alloc_context *ac) | 61 | static inline int ocfs2_alloc_context_bits_left(struct ocfs2_alloc_context *ac) |
61 | { | 62 | { |
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 755cd49a5ef3..dee03197a494 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
@@ -69,6 +69,7 @@ | |||
69 | #include "xattr.h" | 69 | #include "xattr.h" |
70 | #include "quota.h" | 70 | #include "quota.h" |
71 | #include "refcounttree.h" | 71 | #include "refcounttree.h" |
72 | #include "suballoc.h" | ||
72 | 73 | ||
73 | #include "buffer_head_io.h" | 74 | #include "buffer_head_io.h" |
74 | 75 | ||
@@ -301,9 +302,12 @@ static int ocfs2_osb_dump(struct ocfs2_super *osb, char *buf, int len) | |||
301 | 302 | ||
302 | spin_lock(&osb->osb_lock); | 303 | spin_lock(&osb->osb_lock); |
303 | out += snprintf(buf + out, len - out, | 304 | out += snprintf(buf + out, len - out, |
304 | "%10s => Slot: %d NumStolen: %d\n", "Steal", | 305 | "%10s => InodeSlot: %d StolenInodes: %d, " |
306 | "MetaSlot: %d StolenMeta: %d\n", "Steal", | ||
305 | osb->s_inode_steal_slot, | 307 | osb->s_inode_steal_slot, |
306 | atomic_read(&osb->s_num_inodes_stolen)); | 308 | atomic_read(&osb->s_num_inodes_stolen), |
309 | osb->s_meta_steal_slot, | ||
310 | atomic_read(&osb->s_num_meta_stolen)); | ||
307 | spin_unlock(&osb->osb_lock); | 311 | spin_unlock(&osb->osb_lock); |
308 | 312 | ||
309 | out += snprintf(buf + out, len - out, "OrphanScan => "); | 313 | out += snprintf(buf + out, len - out, "OrphanScan => "); |
@@ -1997,7 +2001,7 @@ static int ocfs2_initialize_super(struct super_block *sb, | |||
1997 | osb->blocked_lock_count = 0; | 2001 | osb->blocked_lock_count = 0; |
1998 | spin_lock_init(&osb->osb_lock); | 2002 | spin_lock_init(&osb->osb_lock); |
1999 | spin_lock_init(&osb->osb_xattr_lock); | 2003 | spin_lock_init(&osb->osb_xattr_lock); |
2000 | ocfs2_init_inode_steal_slot(osb); | 2004 | ocfs2_init_steal_slots(osb); |
2001 | 2005 | ||
2002 | atomic_set(&osb->alloc_stats.moves, 0); | 2006 | atomic_set(&osb->alloc_stats.moves, 0); |
2003 | atomic_set(&osb->alloc_stats.local_data, 0); | 2007 | atomic_set(&osb->alloc_stats.local_data, 0); |
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c index 8fc6fb071c6d..8ae4e5d1f730 100644 --- a/fs/ocfs2/xattr.c +++ b/fs/ocfs2/xattr.c | |||
@@ -2282,7 +2282,7 @@ static int ocfs2_create_xattr_block(handle_t *handle, | |||
2282 | xblk = (struct ocfs2_xattr_block *)new_bh->b_data; | 2282 | xblk = (struct ocfs2_xattr_block *)new_bh->b_data; |
2283 | memset(xblk, 0, inode->i_sb->s_blocksize); | 2283 | memset(xblk, 0, inode->i_sb->s_blocksize); |
2284 | strcpy((void *)xblk, OCFS2_XATTR_BLOCK_SIGNATURE); | 2284 | strcpy((void *)xblk, OCFS2_XATTR_BLOCK_SIGNATURE); |
2285 | xblk->xb_suballoc_slot = cpu_to_le16(osb->slot_num); | 2285 | xblk->xb_suballoc_slot = cpu_to_le16(meta_ac->ac_alloc_slot); |
2286 | xblk->xb_suballoc_bit = cpu_to_le16(suballoc_bit_start); | 2286 | xblk->xb_suballoc_bit = cpu_to_le16(suballoc_bit_start); |
2287 | xblk->xb_fs_generation = cpu_to_le32(osb->fs_generation); | 2287 | xblk->xb_fs_generation = cpu_to_le32(osb->fs_generation); |
2288 | xblk->xb_blkno = cpu_to_le64(first_blkno); | 2288 | xblk->xb_blkno = cpu_to_le64(first_blkno); |