Commit 5d5460f
ext4: fix off by one issue in ext4_mb_choose_next_group_best_avail()
In ext4_mb_choose_next_group_best_avail(), we want the start order to be
1 less than goal length and the min_order to be, at max, 1 more than the
original length. This commit fixes an off by one issue that arose due to
the fact that 1 << fls(n) > (n).
After all the processing:
order = 1 order below goal len
min_order = maximum of the three:-
- order - trim_order
- 1 order below B2C(s_stripe)
- 1 order above original len
Cc: stable@kernel.org
Fixes: 33122aa ("ext4: Add allocation criteria 1.5 (CR1_5)")
Signed-off-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>
Link: https://lore.kernel.org/r/20230609103403.112807-1-ojaswin@linux.ibm.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>1 parent 6909cf5 commit 5d5460f
1 file changed
Lines changed: 9 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1006 | 1006 | | |
1007 | 1007 | | |
1008 | 1008 | | |
1009 | | - | |
| 1009 | + | |
1010 | 1010 | | |
1011 | 1011 | | |
1012 | 1012 | | |
1013 | 1013 | | |
1014 | | - | |
1015 | | - | |
1016 | | - | |
1017 | 1014 | | |
1018 | 1015 | | |
1019 | 1016 | | |
1020 | 1017 | | |
1021 | 1018 | | |
1022 | 1019 | | |
1023 | 1020 | | |
1024 | | - | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
1025 | 1026 | | |
1026 | 1027 | | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
1027 | 1031 | | |
1028 | 1032 | | |
1029 | 1033 | | |
| |||
0 commit comments