Re: [PATCH 11/25] ext4: support large block size in ext4_mb_load_buddy_gfp()
From: Jan Kara
Date: Wed Nov 05 2025 - 03:47:00 EST
On Sat 25-10-25 11:22:07, libaokun@xxxxxxxxxxxxxxx wrote:
> From: Baokun Li <libaokun1@xxxxxxxxxx>
>
> Currently, ext4_mb_load_buddy_gfp() uses blocks_per_page to calculate the
> folio index and offset. However, when blocksize is larger than PAGE_SIZE,
> blocks_per_page becomes zero, leading to a potential division-by-zero bug.
>
> To support BS > PS, use bytes to compute folio index and offset within
> folio to get rid of blocks_per_page.
>
> Also, if buddy and bitmap land in the same folio, we get that folio’s ref
> instead of looking it up again before updating the buddy.
>
> Signed-off-by: Baokun Li <libaokun1@xxxxxxxxxx>
> Reviewed-by: Zhang Yi <yi.zhang@xxxxxxxxxx>
Looks good! Feel free to add:
Reviewed-by: Jan Kara <jack@xxxxxxx>
Honza
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR