On Fri 30-05-25 14:28:55, Zhang Yi wrote: > From: Zhang Yi <yi.zhang@xxxxxxxxxx> > > Now, we reserve journal credits for converting extents in only one page > to written state when the I/O operation is complete. This is > insufficient when large folio is enabled. > > Fix this by reserving credits for converting up to one extent per block in > the largest 2MB folio, this calculation should only involve extents index > and leaf blocks, so it should not estimate too many credits. > > Fixes: 7ac67301e82f ("ext4: enable large folio for regular file") > Signed-off-by: Zhang Yi <yi.zhang@xxxxxxxxxx> Looks good. Feel free to add: Reviewed-by: Jan Kara <jack@xxxxxxx> Honza > --- > fs/ext4/inode.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c > index 5ef34c0c5633..d35c07c1dcac 100644 > --- a/fs/ext4/inode.c > +++ b/fs/ext4/inode.c > @@ -2808,12 +2808,12 @@ static int ext4_do_writepages(struct mpage_da_data *mpd) > mpd->journalled_more_data = 0; > > if (ext4_should_dioread_nolock(inode)) { > + int bpf = ext4_journal_blocks_per_folio(inode); > /* > * We may need to convert up to one extent per block in > - * the page and we may dirty the inode. > + * the folio and we may dirty the inode. > */ > - rsv_blocks = 1 + ext4_chunk_trans_blocks(inode, > - PAGE_SIZE >> inode->i_blkbits); > + rsv_blocks = 1 + ext4_ext_index_trans_blocks(inode, bpf); > } > > if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX) > -- > 2.46.1 > -- Jan Kara <jack@xxxxxxxx> SUSE Labs, CR