diff options
Diffstat (limited to 'fs/ocfs2/suballoc.c')
-rw-r--r-- | fs/ocfs2/suballoc.c | 39 |
1 files changed, 14 insertions, 25 deletions
diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c index 797f509d7250..766a00b26441 100644 --- a/fs/ocfs2/suballoc.c +++ b/fs/ocfs2/suballoc.c | |||
@@ -842,10 +842,9 @@ static int ocfs2_block_group_find_clear_bits(struct ocfs2_super *osb, | |||
842 | int offset, start, found, status = 0; | 842 | int offset, start, found, status = 0; |
843 | struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) bg_bh->b_data; | 843 | struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) bg_bh->b_data; |
844 | 844 | ||
845 | if (!OCFS2_IS_VALID_GROUP_DESC(bg)) { | 845 | /* Callers got this descriptor from |
846 | OCFS2_RO_ON_INVALID_GROUP_DESC(osb->sb, bg); | 846 | * ocfs2_read_group_descriptor(). Any corruption is a code bug. */ |
847 | return -EIO; | 847 | BUG_ON(!OCFS2_IS_VALID_GROUP_DESC(bg)); |
848 | } | ||
849 | 848 | ||
850 | found = start = best_offset = best_size = 0; | 849 | found = start = best_offset = best_size = 0; |
851 | bitmap = bg->bg_bitmap; | 850 | bitmap = bg->bg_bitmap; |
@@ -910,11 +909,9 @@ static inline int ocfs2_block_group_set_bits(handle_t *handle, | |||
910 | 909 | ||
911 | mlog_entry_void(); | 910 | mlog_entry_void(); |
912 | 911 | ||
913 | if (!OCFS2_IS_VALID_GROUP_DESC(bg)) { | 912 | /* All callers get the descriptor via |
914 | OCFS2_RO_ON_INVALID_GROUP_DESC(alloc_inode->i_sb, bg); | 913 | * ocfs2_read_group_descriptor(). Any corruption is a code bug. */ |
915 | status = -EIO; | 914 | BUG_ON(!OCFS2_IS_VALID_GROUP_DESC(bg)); |
916 | goto bail; | ||
917 | } | ||
918 | BUG_ON(le16_to_cpu(bg->bg_free_bits_count) < num_bits); | 915 | BUG_ON(le16_to_cpu(bg->bg_free_bits_count) < num_bits); |
919 | 916 | ||
920 | mlog(0, "block_group_set_bits: off = %u, num = %u\n", bit_off, | 917 | mlog(0, "block_group_set_bits: off = %u, num = %u\n", bit_off, |
@@ -983,16 +980,10 @@ static int ocfs2_relink_block_group(handle_t *handle, | |||
983 | struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) bg_bh->b_data; | 980 | struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) bg_bh->b_data; |
984 | struct ocfs2_group_desc *prev_bg = (struct ocfs2_group_desc *) prev_bg_bh->b_data; | 981 | struct ocfs2_group_desc *prev_bg = (struct ocfs2_group_desc *) prev_bg_bh->b_data; |
985 | 982 | ||
986 | if (!OCFS2_IS_VALID_GROUP_DESC(bg)) { | 983 | /* The caller got these descriptors from |
987 | OCFS2_RO_ON_INVALID_GROUP_DESC(alloc_inode->i_sb, bg); | 984 | * ocfs2_read_group_descriptor(). Any corruption is a code bug. */ |
988 | status = -EIO; | 985 | BUG_ON(!OCFS2_IS_VALID_GROUP_DESC(bg)); |
989 | goto out; | 986 | BUG_ON(!OCFS2_IS_VALID_GROUP_DESC(prev_bg)); |
990 | } | ||
991 | if (!OCFS2_IS_VALID_GROUP_DESC(prev_bg)) { | ||
992 | OCFS2_RO_ON_INVALID_GROUP_DESC(alloc_inode->i_sb, prev_bg); | ||
993 | status = -EIO; | ||
994 | goto out; | ||
995 | } | ||
996 | 987 | ||
997 | mlog(0, "Suballoc %llu, chain %u, move group %llu to top, prev = %llu\n", | 988 | mlog(0, "Suballoc %llu, chain %u, move group %llu to top, prev = %llu\n", |
998 | (unsigned long long)le64_to_cpu(fe->i_blkno), chain, | 989 | (unsigned long long)le64_to_cpu(fe->i_blkno), chain, |
@@ -1055,7 +1046,7 @@ out_rollback: | |||
1055 | bg->bg_next_group = cpu_to_le64(bg_ptr); | 1046 | bg->bg_next_group = cpu_to_le64(bg_ptr); |
1056 | prev_bg->bg_next_group = cpu_to_le64(prev_bg_ptr); | 1047 | prev_bg->bg_next_group = cpu_to_le64(prev_bg_ptr); |
1057 | } | 1048 | } |
1058 | out: | 1049 | |
1059 | mlog_exit(status); | 1050 | mlog_exit(status); |
1060 | return status; | 1051 | return status; |
1061 | } | 1052 | } |
@@ -1758,11 +1749,9 @@ static inline int ocfs2_block_group_clear_bits(handle_t *handle, | |||
1758 | 1749 | ||
1759 | mlog_entry_void(); | 1750 | mlog_entry_void(); |
1760 | 1751 | ||
1761 | if (!OCFS2_IS_VALID_GROUP_DESC(bg)) { | 1752 | /* The caller got this descriptor from |
1762 | OCFS2_RO_ON_INVALID_GROUP_DESC(alloc_inode->i_sb, bg); | 1753 | * ocfs2_read_group_descriptor(). Any corruption is a code bug. */ |
1763 | status = -EIO; | 1754 | BUG_ON(!OCFS2_IS_VALID_GROUP_DESC(bg)); |
1764 | goto bail; | ||
1765 | } | ||
1766 | 1755 | ||
1767 | mlog(0, "off = %u, num = %u\n", bit_off, num_bits); | 1756 | mlog(0, "off = %u, num = %u\n", bit_off, num_bits); |
1768 | 1757 | ||