Skip to content

Commit 2b6d392

Browse files
zhangyi089gregkh
authored andcommitted
ext4: correct the reserved credits for extent conversion
commit 95ad8ee upstream. 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: 7ac6730 ("ext4: enable large folio for regular file") Signed-off-by: Zhang Yi <[email protected]> Reviewed-by: Jan Kara <[email protected]> Reviewed-by: Baokun Li <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Theodore Ts'o <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 7fe61ac commit 2b6d392

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

fs/ext4/inode.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2850,12 +2850,12 @@ static int ext4_do_writepages(struct mpage_da_data *mpd)
28502850
mpd->journalled_more_data = 0;
28512851

28522852
if (ext4_should_dioread_nolock(inode)) {
2853+
int bpf = ext4_journal_blocks_per_folio(inode);
28532854
/*
28542855
* We may need to convert up to one extent per block in
2855-
* the page and we may dirty the inode.
2856+
* the folio and we may dirty the inode.
28562857
*/
2857-
rsv_blocks = 1 + ext4_chunk_trans_blocks(inode,
2858-
PAGE_SIZE >> inode->i_blkbits);
2858+
rsv_blocks = 1 + ext4_ext_index_trans_blocks(inode, bpf);
28592859
}
28602860

28612861
if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX)

0 commit comments

Comments
 (0)