Skip to content

Commit 4c4dad1

Browse files
Christoph Hellwigaxboe
authored andcommitted
ext4: pass the operation to bio_alloc
Refactor the readpage code to pass the op to bio_alloc instead of setting it just before the submission. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Theodore Ts'o <tytso@mit.edu> Link: https://lore.kernel.org/r/20220222154634.597067-3-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 77c436d commit 4c4dad1

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

fs/ext4/page-io.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -372,10 +372,9 @@ void ext4_io_submit(struct ext4_io_submit *io)
372372
struct bio *bio = io->io_bio;
373373

374374
if (bio) {
375-
int io_op_flags = io->io_wbc->sync_mode == WB_SYNC_ALL ?
376-
REQ_SYNC : 0;
375+
if (io->io_wbc->sync_mode == WB_SYNC_ALL)
376+
io->io_bio->bi_opf |= REQ_SYNC;
377377
io->io_bio->bi_write_hint = io->io_end->inode->i_write_hint;
378-
bio_set_op_attrs(io->io_bio, REQ_OP_WRITE, io_op_flags);
379378
submit_bio(io->io_bio);
380379
}
381380
io->io_bio = NULL;
@@ -398,7 +397,7 @@ static void io_submit_init_bio(struct ext4_io_submit *io,
398397
* bio_alloc will _always_ be able to allocate a bio if
399398
* __GFP_DIRECT_RECLAIM is set, see comments for bio_alloc_bioset().
400399
*/
401-
bio = bio_alloc(bh->b_bdev, BIO_MAX_VECS, 0, GFP_NOIO);
400+
bio = bio_alloc(bh->b_bdev, BIO_MAX_VECS, REQ_OP_WRITE, GFP_NOIO);
402401
fscrypt_set_bio_crypt_ctx_bh(bio, bh, GFP_NOIO);
403402
bio->bi_iter.bi_sector = bh->b_blocknr * (bh->b_size >> 9);
404403
bio->bi_end_io = ext4_end_bio;

0 commit comments

Comments
 (0)