Skip to content

Commit 6d7d060

Browse files
committed
Merge tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
Pull ext4 fix from Ted Ts'o: "Fix an ext4 regression which landed during the 6.4 merge window" * tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: Revert "ext4: remove ac->ac_found > sbi->s_mb_min_to_scan dead check in ext4_mb_check_limits"
2 parents e0178b5 + 3582e74 commit 6d7d060

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

fs/ext4/mballoc.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2062,7 +2062,7 @@ static void ext4_mb_check_limits(struct ext4_allocation_context *ac,
20622062
if (bex->fe_len < gex->fe_len)
20632063
return;
20642064

2065-
if (finish_group)
2065+
if (finish_group || ac->ac_found > sbi->s_mb_min_to_scan)
20662066
ext4_mb_use_best_found(ac, e4b);
20672067
}
20682068

@@ -2074,6 +2074,20 @@ static void ext4_mb_check_limits(struct ext4_allocation_context *ac,
20742074
* in the context. Later, the best found extent will be used, if
20752075
* mballoc can't find good enough extent.
20762076
*
2077+
* The algorithm used is roughly as follows:
2078+
*
2079+
* * If free extent found is exactly as big as goal, then
2080+
* stop the scan and use it immediately
2081+
*
2082+
* * If free extent found is smaller than goal, then keep retrying
2083+
* upto a max of sbi->s_mb_max_to_scan times (default 200). After
2084+
* that stop scanning and use whatever we have.
2085+
*
2086+
* * If free extent found is bigger than goal, then keep retrying
2087+
* upto a max of sbi->s_mb_min_to_scan times (default 10) before
2088+
* stopping the scan and using the extent.
2089+
*
2090+
*
20772091
* FIXME: real allocation policy is to be designed yet!
20782092
*/
20792093
static void ext4_mb_measure_extent(struct ext4_allocation_context *ac,

0 commit comments

Comments
 (0)