|
| 1 | +ext4: fallback to complex scan if aligned scan doesn't work |
| 2 | + |
| 3 | +jira LE-3187 |
| 4 | +Rebuild_History Non-Buildable kernel-5.14.0-570.19.1.el9_6 |
| 5 | +commit-author Ojaswin Mujoo <ojaswin@linux.ibm.com> |
| 6 | +commit 1f6bc02f18489b9c9ea39b068d0695fb0e4567e9 |
| 7 | +Empty-Commit: Cherry-Pick Conflicts during history rebuild. |
| 8 | +Will be included in final tarball splat. Ref for failed cherry-pick at: |
| 9 | +ciq/ciq_backports/kernel-5.14.0-570.19.1.el9_6/1f6bc02f.failed |
| 10 | + |
| 11 | +Currently in case the goal length is a multiple of stripe size we use |
| 12 | +ext4_mb_scan_aligned() to find the stripe size aligned physical blocks. |
| 13 | +In case we are not able to find any, we again go back to calling |
| 14 | +ext4_mb_choose_next_group() to search for a different suitable block |
| 15 | +group. However, since the linear search always begins from the start, |
| 16 | +most of the times we end up with the same BG and the cycle continues. |
| 17 | + |
| 18 | +With large fliesystems, the CPU can be stuck in this loop for hours |
| 19 | +which can slow down the whole system. Hence, until we figure out a |
| 20 | +better way to continue the search (rather than starting from beginning) |
| 21 | +in ext4_mb_choose_next_group(), lets just fallback to |
| 22 | +ext4_mb_complex_scan_group() in case aligned scan fails, as it is much |
| 23 | +more likely to find the needed blocks. |
| 24 | + |
| 25 | + Signed-off-by: Ojaswin Mujoo <ojaswin@linux.ibm.com> |
| 26 | + Reviewed-by: Jan Kara <jack@suse.cz> |
| 27 | +Link: https://lore.kernel.org/r/ee033f6dfa0a7f2934437008a909c3788233950f.1702455010.git.ojaswin@linux.ibm.com |
| 28 | + Signed-off-by: Theodore Ts'o <tytso@mit.edu> |
| 29 | +(cherry picked from commit 1f6bc02f18489b9c9ea39b068d0695fb0e4567e9) |
| 30 | + Signed-off-by: Jonathan Maple <jmaple@ciq.com> |
| 31 | + |
| 32 | +# Conflicts: |
| 33 | +# fs/ext4/mballoc.c |
| 34 | +diff --cc fs/ext4/mballoc.c |
| 35 | +index 7f56e4c1f4c7,ebbceb2bac4d..000000000000 |
| 36 | +--- a/fs/ext4/mballoc.c |
| 37 | ++++ b/fs/ext4/mballoc.c |
| 38 | +@@@ -2784,14 -2887,21 +2784,30 @@@ repeat |
| 39 | + } |
| 40 | + |
| 41 | + ac->ac_groups_scanned++; |
| 42 | + - if (cr == CR_POWER2_ALIGNED) |
| 43 | + + if (cr == 0) |
| 44 | + ext4_mb_simple_scan_group(ac, &e4b); |
| 45 | +++<<<<<<< HEAD |
| 46 | + + else if (cr == 1 && sbi->s_stripe && |
| 47 | + + !(ac->ac_g_ex.fe_len % |
| 48 | + + EXT4_B2C(sbi, sbi->s_stripe))) |
| 49 | + + ext4_mb_scan_aligned(ac, &e4b); |
| 50 | + + else |
| 51 | + + ext4_mb_complex_scan_group(ac, &e4b); |
| 52 | +++======= |
| 53 | ++ else { |
| 54 | ++ bool is_stripe_aligned = sbi->s_stripe && |
| 55 | ++ !(ac->ac_g_ex.fe_len % |
| 56 | ++ EXT4_B2C(sbi, sbi->s_stripe)); |
| 57 | ++ |
| 58 | ++ if ((cr == CR_GOAL_LEN_FAST || |
| 59 | ++ cr == CR_BEST_AVAIL_LEN) && |
| 60 | ++ is_stripe_aligned) |
| 61 | ++ ext4_mb_scan_aligned(ac, &e4b); |
| 62 | ++ |
| 63 | ++ if (ac->ac_status == AC_STATUS_CONTINUE) |
| 64 | ++ ext4_mb_complex_scan_group(ac, &e4b); |
| 65 | ++ } |
| 66 | +++>>>>>>> 1f6bc02f1848 (ext4: fallback to complex scan if aligned scan doesn't work) |
| 67 | + |
| 68 | + ext4_unlock_group(sb, group); |
| 69 | + ext4_mb_unload_buddy(&e4b); |
| 70 | +* Unmerged path fs/ext4/mballoc.c |
0 commit comments