]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ext4: factor out a io_submit_need_new_bio helper
authorChristoph Hellwig <hch@lst.de>
Mon, 2 Mar 2026 14:18:08 +0000 (06:18 -0800)
committerEric Biggers <ebiggers@kernel.org>
Mon, 9 Mar 2026 20:31:50 +0000 (13:31 -0700)
Factor out a helper to prepare for making this logic a bit more
complex in the next commit.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20260302141922.370070-4-hch@lst.de
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
fs/ext4/page-io.c

index c5ca99b33c2625f96443dcf68ecf88524d26c74b..58cdbd836fd62c4d9234aa8e59b03c842bb9422a 100644 (file)
@@ -439,14 +439,23 @@ static void io_submit_init_bio(struct ext4_io_submit *io,
        wbc_init_bio(io->io_wbc, bio);
 }
 
+static bool io_submit_need_new_bio(struct ext4_io_submit *io,
+                                  struct buffer_head *bh)
+{
+       if (bh->b_blocknr != io->io_next_block)
+               return true;
+       if (!fscrypt_mergeable_bio_bh(io->io_bio, bh))
+               return true;
+       return false;
+}
+
 static void io_submit_add_bh(struct ext4_io_submit *io,
                             struct inode *inode,
                             struct folio *folio,
                             struct folio *io_folio,
                             struct buffer_head *bh)
 {
-       if (io->io_bio && (bh->b_blocknr != io->io_next_block ||
-                          !fscrypt_mergeable_bio_bh(io->io_bio, bh))) {
+       if (io->io_bio && io_submit_need_new_bio(io, bh)) {
 submit_and_retry:
                ext4_io_submit(io);
        }