aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/mballoc.c
diff options
context:
space:
mode:
authorLukas Czerner <lczerner@redhat.com>2013-04-03 23:32:34 -0400
committerTheodore Ts'o <tytso@mit.edu>2013-04-03 23:32:34 -0400
commitbd86298e60b84b5e6d2da3e75c4ce2f6b70bdeed (patch)
tree8da632bbc3acfcc7e7416da820de87d56f2168a4 /fs/ext4/mballoc.c
parent689110098c7df10fab8800d3bf8e727c21f426fb (diff)
ext4: introduce ext4_get_group_number()
Currently on many places in ext4 we're using ext4_get_group_no_and_offset() even though we're only interested in knowing the block group of the particular block, not the offset within the block group so we can use more efficient way to compute block group. This patch introduces ext4_get_group_number() which computes block group for a given block much more efficiently. Use this function instead of ext4_get_group_no_and_offset() everywhere where we're only interested in knowing the block group. Signed-off-by: Lukas Czerner <lczerner@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/mballoc.c')
-rw-r--r--fs/ext4/mballoc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 580aada3d1bb..8c8d05218021 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -3344,7 +3344,7 @@ static void ext4_mb_put_pa(struct ext4_allocation_context *ac,
3344 if (pa->pa_type == MB_GROUP_PA) 3344 if (pa->pa_type == MB_GROUP_PA)
3345 grp_blk--; 3345 grp_blk--;
3346 3346
3347 ext4_get_group_no_and_offset(sb, grp_blk, &grp, NULL); 3347 grp = ext4_get_group_number(sb, grp_blk);
3348 3348
3349 /* 3349 /*
3350 * possible race: 3350 * possible race:
@@ -3809,7 +3809,7 @@ repeat:
3809 3809
3810 list_for_each_entry_safe(pa, tmp, &list, u.pa_tmp_list) { 3810 list_for_each_entry_safe(pa, tmp, &list, u.pa_tmp_list) {
3811 BUG_ON(pa->pa_type != MB_INODE_PA); 3811 BUG_ON(pa->pa_type != MB_INODE_PA);
3812 ext4_get_group_no_and_offset(sb, pa->pa_pstart, &group, NULL); 3812 group = ext4_get_group_number(sb, pa->pa_pstart);
3813 3813
3814 err = ext4_mb_load_buddy(sb, group, &e4b); 3814 err = ext4_mb_load_buddy(sb, group, &e4b);
3815 if (err) { 3815 if (err) {
@@ -4071,7 +4071,7 @@ ext4_mb_discard_lg_preallocations(struct super_block *sb,
4071 4071
4072 list_for_each_entry_safe(pa, tmp, &discard_list, u.pa_tmp_list) { 4072 list_for_each_entry_safe(pa, tmp, &discard_list, u.pa_tmp_list) {
4073 4073
4074 ext4_get_group_no_and_offset(sb, pa->pa_pstart, &group, NULL); 4074 group = ext4_get_group_number(sb, pa->pa_pstart);
4075 if (ext4_mb_load_buddy(sb, group, &e4b)) { 4075 if (ext4_mb_load_buddy(sb, group, &e4b)) {
4076 ext4_error(sb, "Error loading buddy information for %u", 4076 ext4_error(sb, "Error loading buddy information for %u",
4077 group); 4077 group);