Thread (68 messages) 68 messages, 7 authors, 2025-11-06

Re: [PATCH 12/25] ext4: support large block size in ext4_mb_get_buddy_page_lock()

From: Baokun Li <hidden>
Date: 2025-11-05 09:44:34
Also in: linux-fsdevel, linux-mm, lkml

On 2025-11-05 17:13, Jan Kara wrote:
On Sat 25-10-25 11:22:08, libaokun@huaweicloud.com wrote:
quoted
From: Baokun Li <redacted>

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 <redacted>
Reviewed-by: Zhang Yi <yi.zhang@huawei.com>
Looks good, just two typo fixes below. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>
quoted
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:
I’ll fix these typos in the next update.

Thank you for your review!


Regards,
Baokun
quoted
 /*
- * 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
quoted
+ * on the same buddy folio doesn't happen whild holding the buddy folio lock.
					     ^^ while
quoted
+ * 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
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help