aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/suballoc.c
diff options
context:
space:
mode:
authorTao Ma <tao.ma@oracle.com>2010-09-02 01:10:10 -0400
committerTao Ma <tao.ma@oracle.com>2010-09-08 02:25:56 -0400
commit889f004a8c83d515f275078687f859bc0d5ede9d (patch)
treed1b35ad545a4a68fefd1618a591a9d26ccd15ced /fs/ocfs2/suballoc.c
parent04eda1a18019bb387dc7e97ee99979dd88dc608a (diff)
ocfs2: Use the right group in nfs sync check.
We have added discontig block group now, and now an inode can be allocated in an discontig block group. So get it in ocfs2_get_suballoc_slot_bit. The old ocfs2_test_suballoc_bit gets group block no from the allocation inode which is wrong. Fix it by passing the right group. Acked-by: Mark Fasheh <mfasheh@suse.com> Signed-off-by: Tao Ma <tao.ma@oracle.com>
Diffstat (limited to 'fs/ocfs2/suballoc.c')
-rw-r--r--fs/ocfs2/suballoc.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c
index a8e6a95a353f..8a009ee1f7fd 100644
--- a/fs/ocfs2/suballoc.c
+++ b/fs/ocfs2/suballoc.c
@@ -2567,7 +2567,8 @@ out:
2567 * suballoc_bit. 2567 * suballoc_bit.
2568 */ 2568 */
2569static int ocfs2_get_suballoc_slot_bit(struct ocfs2_super *osb, u64 blkno, 2569static int ocfs2_get_suballoc_slot_bit(struct ocfs2_super *osb, u64 blkno,
2570 u16 *suballoc_slot, u16 *suballoc_bit) 2570 u16 *suballoc_slot, u64 *group_blkno,
2571 u16 *suballoc_bit)
2571{ 2572{
2572 int status; 2573 int status;
2573 struct buffer_head *inode_bh = NULL; 2574 struct buffer_head *inode_bh = NULL;
@@ -2604,6 +2605,8 @@ static int ocfs2_get_suballoc_slot_bit(struct ocfs2_super *osb, u64 blkno,
2604 *suballoc_slot = le16_to_cpu(inode_fe->i_suballoc_slot); 2605 *suballoc_slot = le16_to_cpu(inode_fe->i_suballoc_slot);
2605 if (suballoc_bit) 2606 if (suballoc_bit)
2606 *suballoc_bit = le16_to_cpu(inode_fe->i_suballoc_bit); 2607 *suballoc_bit = le16_to_cpu(inode_fe->i_suballoc_bit);
2608 if (group_blkno)
2609 *group_blkno = le64_to_cpu(inode_fe->i_suballoc_loc);
2607 2610
2608bail: 2611bail:
2609 brelse(inode_bh); 2612 brelse(inode_bh);
@@ -2621,7 +2624,8 @@ bail:
2621 */ 2624 */
2622static int ocfs2_test_suballoc_bit(struct ocfs2_super *osb, 2625static int ocfs2_test_suballoc_bit(struct ocfs2_super *osb,
2623 struct inode *suballoc, 2626 struct inode *suballoc,
2624 struct buffer_head *alloc_bh, u64 blkno, 2627 struct buffer_head *alloc_bh,
2628 u64 group_blkno, u64 blkno,
2625 u16 bit, int *res) 2629 u16 bit, int *res)
2626{ 2630{
2627 struct ocfs2_dinode *alloc_di; 2631 struct ocfs2_dinode *alloc_di;
@@ -2642,10 +2646,8 @@ static int ocfs2_test_suballoc_bit(struct ocfs2_super *osb,
2642 goto bail; 2646 goto bail;
2643 } 2647 }
2644 2648
2645 if (alloc_di->i_suballoc_loc) 2649 bg_blkno = group_blkno ? group_blkno :
2646 bg_blkno = le64_to_cpu(alloc_di->i_suballoc_loc); 2650 ocfs2_which_suballoc_group(blkno, bit);
2647 else
2648 bg_blkno = ocfs2_which_suballoc_group(blkno, bit);
2649 status = ocfs2_read_group_descriptor(suballoc, alloc_di, bg_blkno, 2651 status = ocfs2_read_group_descriptor(suballoc, alloc_di, bg_blkno,
2650 &group_bh); 2652 &group_bh);
2651 if (status < 0) { 2653 if (status < 0) {
@@ -2680,6 +2682,7 @@ bail:
2680int ocfs2_test_inode_bit(struct ocfs2_super *osb, u64 blkno, int *res) 2682int ocfs2_test_inode_bit(struct ocfs2_super *osb, u64 blkno, int *res)
2681{ 2683{
2682 int status; 2684 int status;
2685 u64 group_blkno = 0;
2683 u16 suballoc_bit = 0, suballoc_slot = 0; 2686 u16 suballoc_bit = 0, suballoc_slot = 0;
2684 struct inode *inode_alloc_inode; 2687 struct inode *inode_alloc_inode;
2685 struct buffer_head *alloc_bh = NULL; 2688 struct buffer_head *alloc_bh = NULL;
@@ -2687,7 +2690,7 @@ int ocfs2_test_inode_bit(struct ocfs2_super *osb, u64 blkno, int *res)
2687 mlog_entry("blkno: %llu", (unsigned long long)blkno); 2690 mlog_entry("blkno: %llu", (unsigned long long)blkno);
2688 2691
2689 status = ocfs2_get_suballoc_slot_bit(osb, blkno, &suballoc_slot, 2692 status = ocfs2_get_suballoc_slot_bit(osb, blkno, &suballoc_slot,
2690 &suballoc_bit); 2693 &group_blkno, &suballoc_bit);
2691 if (status < 0) { 2694 if (status < 0) {
2692 mlog(ML_ERROR, "get alloc slot and bit failed %d\n", status); 2695 mlog(ML_ERROR, "get alloc slot and bit failed %d\n", status);
2693 goto bail; 2696 goto bail;
@@ -2715,7 +2718,7 @@ int ocfs2_test_inode_bit(struct ocfs2_super *osb, u64 blkno, int *res)
2715 } 2718 }
2716 2719
2717 status = ocfs2_test_suballoc_bit(osb, inode_alloc_inode, alloc_bh, 2720 status = ocfs2_test_suballoc_bit(osb, inode_alloc_inode, alloc_bh,
2718 blkno, suballoc_bit, res); 2721 group_blkno, blkno, suballoc_bit, res);
2719 if (status < 0) 2722 if (status < 0)
2720 mlog(ML_ERROR, "test suballoc bit failed %d\n", status); 2723 mlog(ML_ERROR, "test suballoc bit failed %d\n", status);
2721 2724