[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5kbyz6ilhj7zde4dtv7fhy33yks3bhs2g6xesdzwptdenrrfdg@ydurgdouhuwn>
Date: Wed, 5 Nov 2025 10:13:55 +0100
From: Jan Kara <jack@...e.cz>
To: libaokun@...weicloud.com
Cc: linux-ext4@...r.kernel.org, tytso@....edu, adilger.kernel@...ger.ca,
jack@...e.cz, linux-kernel@...r.kernel.org, kernel@...kajraghav.com,
mcgrof@...nel.org, linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
yi.zhang@...wei.com, yangerkun@...wei.com, chengzhihao1@...wei.com,
libaokun1@...wei.com
Subject: Re: [PATCH 12/25] ext4: support large block size in
ext4_mb_get_buddy_page_lock()
On Sat 25-10-25 11:22:08, libaokun@...weicloud.com wrote:
> From: Baokun Li <libaokun1@...wei.com>
>
> Currently, ext4_mb_get_buddy_page_lock() uses blocks_per_page to calculate
> 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, since ext4_mb_get_buddy_page_lock() already fully supports folio,
> rename it to ext4_mb_get_buddy_folio_lock().
>
> Signed-off-by: Baokun Li <libaokun1@...wei.com>
> Reviewed-by: Zhang Yi <yi.zhang@...wei.com>
Looks good, just two typo fixes below. Feel free to add:
Reviewed-by: Jan Kara <jack@...e.cz>
> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
> index 3494c6fe5bfb..d42d768a705a 100644
> --- a/fs/ext4/mballoc.c
> +++ b/fs/ext4/mballoc.c
> @@ -1510,50 +1510,52 @@ static int ext4_mb_init_cache(struct folio *folio, char *incore, gfp_t gfp)
> }
>
Let's fix some typos when updating the comment:
> /*
> - * Lock the buddy and bitmap pages. This make sure other parallel init_group
> - * on the same buddy page doesn't happen whild holding the buddy page lock.
> - * Return locked buddy and bitmap pages on e4b struct. If buddy and bitmap
> - * are on the same page e4b->bd_buddy_folio is NULL and return value is 0.
> + * Lock the buddy and bitmap folios. This make sure other parallel init_group
^^^ makes
> + * on the same buddy folio doesn't happen whild holding the buddy folio lock.
^^ while
> + * Return locked buddy and bitmap folios on e4b struct. If buddy and bitmap
> + * are on the same folio e4b->bd_buddy_folio is NULL and return value is 0.
> */
Honza
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists