From: Zhang Yi <yi.zhang@xxxxxxxxxx> This series addresses the issue that Jan pointed out regarding large folios support for ext4[1]. The problem is that the credits calculation may insufficient in ext4_meta_trans_blocks() when allocating blocks during write back a sufficiently large and discontinuous folio, it doesn't involve the credits for updating bitmap and group descriptor block. However, if we fix this issue, it may lead to significant overestimation on the some filesystems with a lot of block groups. The solution involves first reserving credit for one page when writing back a sufficiently large and discontinuous folio, and then attempting to extend the current transaction's credits. If the credits reach the upper limit, the handler stops and initiates a new transaction. Again, fix the wrong credits calculation in ext4_meta_trans_blocks(). Finally, this solution only works in dioread_nolock mode, so disable large folios if dioread_nolock is disabled. Please see the following patches for details. [1] https://lore.kernel.org/linux-ext4/ht54j6bvjmiqt62xmcveqlo7bmrunqs4ji7wikfteftdjijzek@7tz5gpejaoen/ Thanks, Yi. Zhang Yi (5): ext4: restart handle if credits are insufficient during writepages ext4: correct the reserved credits for extent conversion ext4/jbd2: reintroduce jbd2_journal_blocks_per_page() ext4: fix insufficient credits calculation in ext4_meta_trans_blocks() ext4: disable large folios if dioread_nolock is not enabled fs/ext4/ext4_jbd2.h | 14 ++++++++++ fs/ext4/inode.c | 64 +++++++++++++++++++++++++++++++++++--------- fs/jbd2/journal.c | 6 +++++ include/linux/jbd2.h | 1 + 4 files changed, 72 insertions(+), 13 deletions(-) -- 2.46.1