mbox series

[v3,00/20] Some bugfix and cleanup to mballoc

Message ID 20230303172120.3800725-1-shikemeng@huaweicloud.com
Headers show
Series Some bugfix and cleanup to mballoc | expand

Message

Kemeng Shi March 3, 2023, 5:21 p.m. UTC
Hi, this series contain some random cleanup patches and some bugfix
patches to make EXT4_MB_HINT_GOAL_ONLY work properly, protect pa->pa_free
from race and so on. More details can be found in git log.
Thanks!

---
V3:
-patch 01/20 "ext4: set goal start correctly in
ext4_mb_normalize_request" correctly record goal in ac_g_ex instead of
ac_f_ex, this also trigger another original bug that wanted goal maybe
out of valid data block range. Add valid range check in patch 01/20
to fully fix the bug.
-run "kvm-xfstests smoke" and all tests are passed except generic/454.
This test also failed in running kernel without this patchset, so
it's unlikely caused by this patchset. I'm trying to figure out the
reason but it may take a while as I'm not family with kvm-xfstests.
Just send this series for early review and maybe some help to pass
the failed test case.
---
V2:
-Add signed-off from Ritesh and Ojaswin to patch 3/20 "ext4: get correct
ext4_group_info in ext4_mb_prefetch_fini" as this is a duplicate of
a patch under reviewing.
-Split out original patch "ext4: avoid to use preallocated blocks if
EXT4_MB_HINT_GOAL_ONLY is set" which will be resend after improved.
-Improve log information of patch 20.
-Collect Reviewed-by from Ojaswin and Ritesh. Now only patch 3, 12 and
20 need futher review.
---


Kemeng Shi (20):
  ext4: set goal start correctly in ext4_mb_normalize_request
  ext4: allow to find by goal if EXT4_MB_HINT_GOAL_ONLY is set
  ext4: get correct ext4_group_info in ext4_mb_prefetch_fini
  ext4: correct calculation of s_mb_preallocated
  ext4: correct start of used group pa for debug in ext4_mb_use_group_pa
  ext4: protect pa->pa_free in ext4_discard_allocated_blocks
  ext4: add missed brelse in ext4_free_blocks_simple
  ext4: remove unused return value of ext4_mb_try_best_found and
    ext4_mb_free_metadata
  ext4: Remove unnecessary release when memory allocation failed in
    ext4_mb_init_cache
  ext4: remove unnecessary e4b->bd_buddy_page check in
    ext4_mb_load_buddy_gfp
  ext4: remove unnecessary check in ext4_mb_new_blocks
  ext4: remove dead check in mb_buddy_mark_free
  ext4: remove ac->ac_found > sbi->s_mb_min_to_scan dead check in
    ext4_mb_check_limits
  ext4: use best found when complex scan of group finishs
  ext4: remove unnecessary exit_meta_group_info tag
  ext4: remove unnecessary count2 in ext4_free_data_in_buddy
  ext4: remove unnecessary goto in ext4_mb_mark_diskspace_used
  ext4: remove repeat assignment to ac_f_ex
  ext4: remove comment code ext4_discard_preallocations
  ext4: simplify calculation of blkoff in ext4_mb_new_blocks_simple

 fs/ext4/mballoc.c | 111 ++++++++++++++++++----------------------------
 1 file changed, 43 insertions(+), 68 deletions(-)

Comments

Kemeng Shi March 10, 2023, 8:17 a.m. UTC | #1
on 3/4/2023 1:21 AM, Kemeng Shi wrote:
> Hi, this series contain some random cleanup patches and some bugfix
> patches to make EXT4_MB_HINT_GOAL_ONLY work properly, protect pa->pa_free
> from race and so on. More details can be found in git log.
> Thanks!
> 
> ---
> V3:
> -patch 01/20 "ext4: set goal start correctly in
> ext4_mb_normalize_request" correctly record goal in ac_g_ex instead of
> ac_f_ex, this also trigger another original bug that wanted goal maybe
> out of valid data block range. Add valid range check in patch 01/20
> to fully fix the bug.
> -run "kvm-xfstests smoke" and all tests are passed except generic/454.
> This test also failed in running kernel without this patchset, so
> it's unlikely caused by this patchset. I'm trying to figure out the
> reason but it may take a while as I'm not family with kvm-xfstests.
> Just send this series for early review and maybe some help to pass
> the failed test case.
I re-run "kvm-xfstests smoke" with newly root_fs.img and all tests pass.
It may be the early test which triggerred bug and corruptted the metadata
casues failure.
> ---
> V2:
> -Add signed-off from Ritesh and Ojaswin to patch 3/20 "ext4: get correct
> ext4_group_info in ext4_mb_prefetch_fini" as this is a duplicate of
> a patch under reviewing.
> -Split out original patch "ext4: avoid to use preallocated blocks if
> EXT4_MB_HINT_GOAL_ONLY is set" which will be resend after improved.
> -Improve log information of patch 20.
> -Collect Reviewed-by from Ojaswin and Ritesh. Now only patch 3, 12 and
> 20 need futher review.
> ---
> 
> 
> Kemeng Shi (20):
>   ext4: set goal start correctly in ext4_mb_normalize_request
>   ext4: allow to find by goal if EXT4_MB_HINT_GOAL_ONLY is set
>   ext4: get correct ext4_group_info in ext4_mb_prefetch_fini
>   ext4: correct calculation of s_mb_preallocated
>   ext4: correct start of used group pa for debug in ext4_mb_use_group_pa
>   ext4: protect pa->pa_free in ext4_discard_allocated_blocks
>   ext4: add missed brelse in ext4_free_blocks_simple
>   ext4: remove unused return value of ext4_mb_try_best_found and
>     ext4_mb_free_metadata
>   ext4: Remove unnecessary release when memory allocation failed in
>     ext4_mb_init_cache
>   ext4: remove unnecessary e4b->bd_buddy_page check in
>     ext4_mb_load_buddy_gfp
>   ext4: remove unnecessary check in ext4_mb_new_blocks
>   ext4: remove dead check in mb_buddy_mark_free
>   ext4: remove ac->ac_found > sbi->s_mb_min_to_scan dead check in
>     ext4_mb_check_limits
>   ext4: use best found when complex scan of group finishs
>   ext4: remove unnecessary exit_meta_group_info tag
>   ext4: remove unnecessary count2 in ext4_free_data_in_buddy
>   ext4: remove unnecessary goto in ext4_mb_mark_diskspace_used
>   ext4: remove repeat assignment to ac_f_ex
>   ext4: remove comment code ext4_discard_preallocations
>   ext4: simplify calculation of blkoff in ext4_mb_new_blocks_simple
> 
>  fs/ext4/mballoc.c | 111 ++++++++++++++++++----------------------------
>  1 file changed, 43 insertions(+), 68 deletions(-)
>
Theodore Ts'o March 17, 2023, 1:52 a.m. UTC | #2
On Sat, 4 Mar 2023 01:21:00 +0800, Kemeng Shi wrote:
> patches to make EXT4_MB_HINT_GOAL_ONLY work properly, protect pa->pa_free
> from race and so on. More details can be found in git log.
> Thanks!
> 

Applied, thanks!

[01/20] ext4: set goal start correctly in ext4_mb_normalize_request
        commit: 98860659740354352783cb55c8443e0e46e0978c
[02/20] ext4: allow to find by goal if EXT4_MB_HINT_GOAL_ONLY is set
        commit: cace8c0f41382effffa8a14cfc4666a5ae171d03
[03/20] ext4: get correct ext4_group_info in ext4_mb_prefetch_fini
        commit: 36a366185c1c733ce43e8d6d8ca43997c5b601ce
[04/20] ext4: correct calculation of s_mb_preallocated
        commit: a53b8e3f47d790cb8b520b89b59cf0b65aee7e38
[05/20] ext4: correct start of used group pa for debug in ext4_mb_use_group_pa
        commit: 043a9c31c51a26c5926fd62bdd9d7a057cc4acd1
[06/20] ext4: protect pa->pa_free in ext4_discard_allocated_blocks
        commit: 5ddfc1b03d405d2890dc75eee6e1659c0e022407
[07/20] ext4: add missed brelse in ext4_free_blocks_simple
        commit: a8735a61d23ce9f91c965041eb3ff2a8501853f2
[08/20] ext4: remove unused return value of ext4_mb_try_best_found and ext4_mb_free_metadata
        commit: 1104c3ce5375bbc1229a8e56f7ac84e23953b887
[09/20] ext4: Remove unnecessary release when memory allocation failed in ext4_mb_init_cache
        commit: d5e46843e6db39ae386dd7c728861caca3bb0e6e
[10/20] ext4: remove unnecessary e4b->bd_buddy_page check in ext4_mb_load_buddy_gfp
        commit: d53c2664698f218acd8ce8848427be4da039dee9
[11/20] ext4: remove unnecessary check in ext4_mb_new_blocks
        commit: 4e91261632b0b1d0dee4a9bd99ac70d49d35ebc5
[12/20] ext4: remove dead check in mb_buddy_mark_free
        commit: 0b6d4554bdc97d40692abf05a0f087656acfa876
[13/20] ext4: remove ac->ac_found > sbi->s_mb_min_to_scan dead check in ext4_mb_check_limits
        commit: 38121fdf014cbd631e83fe9aa20a93a57670c2fe
[14/20] ext4: use best found when complex scan of group finishs
        commit: be52c043d5d18d23605980c3485ae41de19cc99c
[15/20] ext4: remove unnecessary exit_meta_group_info tag
        commit: 1a5500baa0235477ac6eef76d75c70540522e886
[16/20] ext4: remove unnecessary count2 in ext4_free_data_in_buddy
        commit: 8df82ffee909b633f727414a4b50c2638de9c3d4
[17/20] ext4: remove unnecessary goto in ext4_mb_mark_diskspace_used
        commit: 101cbefae32efa89e717c89919a9164c4ea2b0a5
[18/20] ext4: remove repeat assignment to ac_f_ex
        commit: b9a0763df46aaa1d7c33859e24ff0ebd4fea009c
[19/20] ext4: remove comment code ext4_discard_preallocations
        commit: e0057b7ceade573f52a51a5bce75de8a1abe60b0
[20/20] ext4: simplify calculation of blkoff in ext4_mb_new_blocks_simple
        commit: 7bb392f6f9c465182aea60cc55287595bf28f866

Best regards,