Add the field and have the blockdev direct_IO() helpers set it. This is in preparation for being able to poll for iocb completion. Signed-off-by: Jens Axboe <axboe@xxxxxxxxx> --- fs/block_dev.c | 2 ++ include/linux/fs.h | 1 + 2 files changed, 3 insertions(+) diff --git a/fs/block_dev.c b/fs/block_dev.c index d233a59ea364..8a2fed18e3fc 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -236,6 +236,7 @@ __blkdev_direct_IO_simple(struct kiocb *iocb, struct iov_iter *iter, bio.bi_opf |= REQ_HIPRI; qc = submit_bio(&bio); + WRITE_ONCE(iocb->ki_blk_qc, qc); for (;;) { __set_current_state(TASK_UNINTERRUPTIBLE); @@ -396,6 +397,7 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages) bio->bi_opf |= REQ_HIPRI; qc = submit_bio(bio); + WRITE_ONCE(iocb->ki_blk_qc, qc); break; } diff --git a/include/linux/fs.h b/include/linux/fs.h index c95c0807471f..032761d9b218 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -310,6 +310,7 @@ struct kiocb { int ki_flags; u16 ki_hint; u16 ki_ioprio; /* See linux/ioprio.h */ + u32 ki_blk_qc; } __randomize_layout; static inline bool is_sync_kiocb(struct kiocb *kiocb) -- 2.17.1