Changelog in Linux kernel 6.16.3

 
ext4: correct the reserved credits for extent conversion [+ + +]
Author: Zhang Yi <yi.zhang@huawei.com>
Date:   Mon Jul 7 22:08:10 2025 +0800

    ext4: correct the reserved credits for extent conversion
    
    commit 95ad8ee45cdbc321c135a2db895d48b374ef0f87 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: 7ac67301e82f ("ext4: enable large folio for regular file")
    Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
    Reviewed-by: Jan Kara <jack@suse.cz>
    Reviewed-by: Baokun Li <libaokun1@huawei.com>
    Link: https://patch.msgid.link/20250707140814.542883-8-yi.zhang@huaweicloud.com
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ext4: enhance tracepoints during the folios writeback [+ + +]
Author: Zhang Yi <yi.zhang@huawei.com>
Date:   Mon Jul 7 22:08:09 2025 +0800

    ext4: enhance tracepoints during the folios writeback
    
    commit 6b132759b0fe78e518abafb62190c294100db6d6 upstream.
    
    After mpage_map_and_submit_extent() supports restarting handle if
    credits are insufficient during allocating blocks, it is more likely to
    exit the current mapping iteration and continue to process the current
    processing partially mapped folio again. The existing tracepoints are
    not sufficient to track this situation, so enhance the tracepoints to
    track the writeback position and the return value before and after
    submitting the folios.
    
    Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
    Reviewed-by: Jan Kara <jack@suse.cz>
    Link: https://patch.msgid.link/20250707140814.542883-7-yi.zhang@huaweicloud.com
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ext4: fix stale data if it bail out of the extents mapping loop [+ + +]
Author: Zhang Yi <yi.zhang@huawei.com>
Date:   Mon Jul 7 22:08:06 2025 +0800

    ext4: fix stale data if it bail out of the extents mapping loop
    
    commit ded2d726a3041fce8afd88005cbfe15cd4737702 upstream.
    
    During the process of writing back folios, if
    mpage_map_and_submit_extent() exits the extent mapping loop due to an
    ENOSPC or ENOMEM error, it may result in stale data or filesystem
    inconsistency in environments where the block size is smaller than the
    folio size.
    
    When mapping a discontinuous folio in mpage_map_and_submit_extent(),
    some buffers may have already be mapped. If we exit the mapping loop
    prematurely, the folio data within the mapped range will not be written
    back, and the file's disk size will not be updated. Once the transaction
    that includes this range of extents is committed, this can lead to stale
    data or filesystem inconsistency.
    
    Fix this by submitting the current processing partially mapped folio.
    
    Suggested-by: Jan Kara <jack@suse.cz>
    Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
    Reviewed-by: Jan Kara <jack@suse.cz>
    Link: https://patch.msgid.link/20250707140814.542883-4-yi.zhang@huaweicloud.com
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ext4: move the calculation of wbc->nr_to_write to mpage_folio_done() [+ + +]
Author: Zhang Yi <yi.zhang@huawei.com>
Date:   Mon Jul 7 22:08:05 2025 +0800

    ext4: move the calculation of wbc->nr_to_write to mpage_folio_done()
    
    commit f922c8c2461b022a2efd9914484901fb358a5b2a upstream.
    
    mpage_folio_done() should be a more appropriate place than
    mpage_submit_folio() for updating the wbc->nr_to_write after we have
    submitted a fully mapped folio. Preparing to make mpage_submit_folio()
    allows to submit partially mapped folio that is still under processing.
    
    Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
    Reviewed-by: Jan Kara <jack@suse.cz>
    Reviewed-by: Baokun Li <libaokun1@huawei.com>
    Link: https://patch.msgid.link/20250707140814.542883-3-yi.zhang@huaweicloud.com
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ext4: process folios writeback in bytes [+ + +]
Author: Zhang Yi <yi.zhang@huawei.com>
Date:   Mon Jul 7 22:08:04 2025 +0800

    ext4: process folios writeback in bytes
    
    commit 1bfe6354e0975fe89c3d25e81b6546d205556a4b upstream.
    
    Since ext4 supports large folios, processing writebacks in pages is no
    longer appropriate, it can be modified to process writebacks in bytes.
    
    Suggested-by: Jan Kara <jack@suse.cz>
    Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
    Reviewed-by: Jan Kara <jack@suse.cz>
    Link: https://patch.msgid.link/20250707140814.542883-2-yi.zhang@huaweicloud.com
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ext4: refactor the block allocation process of ext4_page_mkwrite() [+ + +]
Author: Zhang Yi <yi.zhang@huawei.com>
Date:   Mon Jul 7 22:08:07 2025 +0800

    ext4: refactor the block allocation process of ext4_page_mkwrite()
    
    commit 2bddafea3d0d85ee9ac3cf5ba9a4b2f2d2f50257 upstream.
    
    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@suse.cz>
    Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
    Reviewed-by: Jan Kara <jack@suse.cz>
    Link: https://patch.msgid.link/20250707140814.542883-5-yi.zhang@huaweicloud.com
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ext4: replace ext4_writepage_trans_blocks() [+ + +]
Author: Zhang Yi <yi.zhang@huawei.com>
Date:   Mon Jul 7 22:08:12 2025 +0800

    ext4: replace ext4_writepage_trans_blocks()
    
    commit 57661f28756c59510e31543520b5b8f5e591f384 upstream.
    
    After ext4 supports large folios, the semantics of reserving credits in
    pages is no longer applicable. In most scenarios, reserving credits in
    extents is sufficient. Therefore, introduce ext4_chunk_trans_extent()
    to replace ext4_writepage_trans_blocks(). move_extent_per_page() is the
    only remaining location where we are still processing extents in pages.
    
    Suggested-by: Jan Kara <jack@suse.cz>
    Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
    Reviewed-by: Jan Kara <jack@suse.cz>
    Link: https://patch.msgid.link/20250707140814.542883-10-yi.zhang@huaweicloud.com
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ext4: reserved credits for one extent during the folio writeback [+ + +]
Author: Zhang Yi <yi.zhang@huawei.com>
Date:   Mon Jul 7 22:08:11 2025 +0800

    ext4: reserved credits for one extent during the folio writeback
    
    commit bbbf150f3f85619569ac19dc6458cca7c492e715 upstream.
    
    After ext4 supports large folios, reserving journal credits for one
    maximum-ordered folio based on the worst case cenario during the
    writeback process can easily exceed the maximum transaction credits.
    Additionally, reserving journal credits for one page is also no
    longer appropriate.
    
    Currently, the folio writeback process can either extend the journal
    credits or initiate a new transaction if the currently reserved journal
    credits are insufficient. Therefore, it can be modified to reserve
    credits for only one extent at the outset. In most cases involving
    continuous mapping, these credits are generally adequate, and we may
    only need to perform some basic credit expansion. However, in extreme
    cases where the block size and folio size differ significantly, or when
    the folios are sufficiently discontinuous, it may be necessary to
    restart a new transaction and resubmit the folios.
    
    Suggested-by: Jan Kara <jack@suse.cz>
    Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
    Reviewed-by: Jan Kara <jack@suse.cz>
    Link: https://patch.msgid.link/20250707140814.542883-9-yi.zhang@huaweicloud.com
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ext4: restart handle if credits are insufficient during allocating blocks [+ + +]
Author: Zhang Yi <yi.zhang@huawei.com>
Date:   Mon Jul 7 22:08:08 2025 +0800

    ext4: restart handle if credits are insufficient during allocating blocks
    
    commit e2c4c49dee64ca2f42ad2958cbe1805de96b6732 upstream.
    
    After large folios are supported on ext4, writing back a sufficiently
    large and discontinuous folio may consume a significant number of
    journal credits, placing considerable strain on the journal. For
    example, in a 20GB filesystem with 1K block size and 1MB journal size,
    writing back a 2MB folio could require thousands of credits in the
    worst-case scenario (when each block is discontinuous and distributed
    across different block groups), potentially exceeding the journal size.
    This issue can also occur in ext4_write_begin() and ext4_page_mkwrite()
    when delalloc is not enabled.
    
    Fix this by ensuring that there are sufficient journal credits before
    allocating an extent in mpage_map_one_extent() and
    ext4_block_write_begin(). If there are not enough credits, return
    -EAGAIN, exit the current mapping loop, restart a new handle and a new
    transaction, and allocating blocks on this folio again in the next
    iteration.
    
    Suggested-by: Jan Kara <jack@suse.cz>
    Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
    Reviewed-by: Jan Kara <jack@suse.cz>
    Link: https://patch.msgid.link/20250707140814.542883-6-yi.zhang@huaweicloud.com
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
Linux: Linux 6.16.3 [+ + +]
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Sat Aug 23 16:49:42 2025 +0200

    Linux 6.16.3
    
    Link: https://lore.kernel.org/r/20250822123516.780248736@linuxfoundation.org
    Tested-by: Ronald Warsow <rwarsow@gmx.de>
    Tested-by: Markus Reichelt <lkt+2023@mareichelt.com>
    Tested-by: Salvatore Bonaccorso <carnil@debian.org>
    Tested-by: Takeshi Ogasawara <takeshi.ogasawara@futuring-girl.com>
    Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Tested-by: Peter Schneider <pschneider1968@googlemail.com>
    Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
    Tested-by: Brett A C Sheffield <bacs@librecast.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>