On Tue 01-07-25 21:06:29, Zhang Yi wrote: > From: Zhang Yi <yi.zhang@xxxxxxxxxx> > > The block allocation process and error handling in ext4_page_mkwrite() > is complex now. Refactor it by introducing a new helper function, > ext4_block_page_mkwrite(). It will call ext4_block_write_begin() to > allocate blocks instead of directly calling block_page_mkwrite(). > Preparing to implement retry logic in a subsequent patch to address > situations where the reserved journal credits are insufficient. > Additionally, this modification will help prevent potential deadlocks > that may occur when waiting for folio writeback while holding the > transaction handle. > > Suggested-by: Jan Kara <jack@xxxxxxx> > Signed-off-by: Zhang Yi <yi.zhang@xxxxxxxxxx> Looks good! Feel free to add: Reviewed-by: Jan Kara <jack@xxxxxxx> One typo fix below: > + /* Start jorunal and allocate blocks */ ^^^ journal > + err = ext4_block_page_mkwrite(inode, folio, get_block); > if (err == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries)) > goto retry_alloc; > out_ret: Honza -- Jan Kara <jack@xxxxxxxx> SUSE Labs, CR