Skip to content

Commit 5f18a9d

Browse files
Christoph HellwigEric Biggers
authored andcommitted
ext4: factor out a io_submit_need_new_bio helper
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>
1 parent d3fc0ed commit 5f18a9d

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

fs/ext4/page-io.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,14 +439,23 @@ static void io_submit_init_bio(struct ext4_io_submit *io,
439439
wbc_init_bio(io->io_wbc, bio);
440440
}
441441

442+
static bool io_submit_need_new_bio(struct ext4_io_submit *io,
443+
struct buffer_head *bh)
444+
{
445+
if (bh->b_blocknr != io->io_next_block)
446+
return true;
447+
if (!fscrypt_mergeable_bio_bh(io->io_bio, bh))
448+
return true;
449+
return false;
450+
}
451+
442452
static void io_submit_add_bh(struct ext4_io_submit *io,
443453
struct inode *inode,
444454
struct folio *folio,
445455
struct folio *io_folio,
446456
struct buffer_head *bh)
447457
{
448-
if (io->io_bio && (bh->b_blocknr != io->io_next_block ||
449-
!fscrypt_mergeable_bio_bh(io->io_bio, bh))) {
458+
if (io->io_bio && io_submit_need_new_bio(io, bh)) {
450459
submit_and_retry:
451460
ext4_io_submit(io);
452461
}

0 commit comments

Comments
 (0)