Skip to content

Commit d3fc0ed

Browse files
Christoph HellwigEric Biggers
authored andcommitted
ext4: open code fscrypt_set_bio_crypt_ctx_bh
io_submit_init_bio already has or can easily get at most information needed to set the crypto context. Open code fscrypt_set_bio_crypt_ctx_bh based on that. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20260302141922.370070-3-hch@lst.de Signed-off-by: Eric Biggers <ebiggers@kernel.org>
1 parent 7737b1b commit d3fc0ed

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

fs/ext4/page-io.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,7 @@ void ext4_io_submit_init(struct ext4_io_submit *io,
417417

418418
static void io_submit_init_bio(struct ext4_io_submit *io,
419419
struct inode *inode,
420+
struct folio *folio,
420421
struct buffer_head *bh)
421422
{
422423
struct bio *bio;
@@ -426,7 +427,9 @@ static void io_submit_init_bio(struct ext4_io_submit *io,
426427
* __GFP_DIRECT_RECLAIM is set, see comments for bio_alloc_bioset().
427428
*/
428429
bio = bio_alloc(bh->b_bdev, BIO_MAX_VECS, REQ_OP_WRITE, GFP_NOIO);
429-
fscrypt_set_bio_crypt_ctx_bh(bio, bh, GFP_NOIO);
430+
fscrypt_set_bio_crypt_ctx(bio, inode,
431+
(folio_pos(folio) + bh_offset(bh)) >> inode->i_blkbits,
432+
GFP_NOIO);
430433
bio->bi_iter.bi_sector = bh->b_blocknr * (bh->b_size >> 9);
431434
bio->bi_end_io = ext4_end_bio;
432435
bio->bi_private = ext4_get_io_end(io->io_end);
@@ -448,7 +451,7 @@ static void io_submit_add_bh(struct ext4_io_submit *io,
448451
ext4_io_submit(io);
449452
}
450453
if (io->io_bio == NULL)
451-
io_submit_init_bio(io, inode, bh);
454+
io_submit_init_bio(io, inode, folio, bh);
452455
if (!bio_add_folio(io->io_bio, io_folio, bh->b_size, bh_offset(bh)))
453456
goto submit_and_retry;
454457
wbc_account_cgroup_owner(io->io_wbc, folio, bh->b_size);

0 commit comments

Comments
 (0)