Message ID | 20181117235317.7366-4-axboe@kernel.dk (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Support for polled aio | expand |
On Sat, Nov 17, 2018 at 04:53:15PM -0700, Jens Axboe wrote: > Add the field and have the blockdev direct_IO() helpers set it. > This is in preparation for being able to poll for iocb completion. What purpose does this field serve? And why add it to just blockdev direct_IO and not the other direct IO paths, too? Cheers, Dave.
On 11/18/18 6:59 PM, Dave Chinner wrote: > On Sat, Nov 17, 2018 at 04:53:15PM -0700, Jens Axboe wrote: >> Add the field and have the blockdev direct_IO() helpers set it. >> This is in preparation for being able to poll for iocb completion. > > What purpose does this field serve? It's for later lookup to find the queue to poll on. > And why add it to just blockdev direct_IO and not the other direct > IO paths, too? Only block devices support polling.
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)
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@kernel.dk> --- fs/block_dev.c | 2 ++ include/linux/fs.h | 1 + 2 files changed, 3 insertions(+)