@@ -2568,6 +2568,30 @@ void ext4_mb_scan_aligned(struct ext4_allocation_context *ac,
2568
2568
}
2569
2569
}
2570
2570
2571
+ static void __ext4_mb_scan_group (struct ext4_allocation_context * ac )
2572
+ {
2573
+ bool is_stripe_aligned ;
2574
+ struct ext4_sb_info * sbi ;
2575
+ enum criteria cr = ac -> ac_criteria ;
2576
+
2577
+ ac -> ac_groups_scanned ++ ;
2578
+ if (cr == CR_POWER2_ALIGNED )
2579
+ return ext4_mb_simple_scan_group (ac , ac -> ac_e4b );
2580
+
2581
+ sbi = EXT4_SB (ac -> ac_sb );
2582
+ is_stripe_aligned = false;
2583
+ if ((sbi -> s_stripe >= sbi -> s_cluster_ratio ) &&
2584
+ !(ac -> ac_g_ex .fe_len % EXT4_NUM_B2C (sbi , sbi -> s_stripe )))
2585
+ is_stripe_aligned = true;
2586
+
2587
+ if ((cr == CR_GOAL_LEN_FAST || cr == CR_BEST_AVAIL_LEN ) &&
2588
+ is_stripe_aligned )
2589
+ ext4_mb_scan_aligned (ac , ac -> ac_e4b );
2590
+
2591
+ if (ac -> ac_status == AC_STATUS_CONTINUE )
2592
+ ext4_mb_complex_scan_group (ac , ac -> ac_e4b );
2593
+ }
2594
+
2571
2595
/*
2572
2596
* This is also called BEFORE we load the buddy bitmap.
2573
2597
* Returns either 1 or 0 indicating that the group is either suitable
@@ -2855,6 +2879,8 @@ ext4_mb_regular_allocator(struct ext4_allocation_context *ac)
2855
2879
*/
2856
2880
if (ac -> ac_2order )
2857
2881
cr = CR_POWER2_ALIGNED ;
2882
+
2883
+ ac -> ac_e4b = & e4b ;
2858
2884
repeat :
2859
2885
for (; cr < EXT4_MB_NUM_CRS && ac -> ac_status == AC_STATUS_CONTINUE ; cr ++ ) {
2860
2886
ac -> ac_criteria = cr ;
@@ -2932,24 +2958,7 @@ ext4_mb_regular_allocator(struct ext4_allocation_context *ac)
2932
2958
continue ;
2933
2959
}
2934
2960
2935
- ac -> ac_groups_scanned ++ ;
2936
- if (cr == CR_POWER2_ALIGNED )
2937
- ext4_mb_simple_scan_group (ac , & e4b );
2938
- else {
2939
- bool is_stripe_aligned =
2940
- (sbi -> s_stripe >=
2941
- sbi -> s_cluster_ratio ) &&
2942
- !(ac -> ac_g_ex .fe_len %
2943
- EXT4_NUM_B2C (sbi , sbi -> s_stripe ));
2944
-
2945
- if ((cr == CR_GOAL_LEN_FAST ||
2946
- cr == CR_BEST_AVAIL_LEN ) &&
2947
- is_stripe_aligned )
2948
- ext4_mb_scan_aligned (ac , & e4b );
2949
-
2950
- if (ac -> ac_status == AC_STATUS_CONTINUE )
2951
- ext4_mb_complex_scan_group (ac , & e4b );
2952
- }
2961
+ __ext4_mb_scan_group (ac );
2953
2962
2954
2963
ext4_unlock_group (sb , group );
2955
2964
ext4_mb_unload_buddy (& e4b );
0 commit comments