iomap: set REQ_NOWAIT according to IOCB_NOWAIT in Direct IO
Subsystems (2)
RFC 1/1 iomap: set REQ_NOWAIT according to IOCB_NOWAIT in Direct IO
Currently, IOCB_NOWAIT is ignored in direct io, REQ_NOWAIT is only set when IOCB_HIPRI is set. But REQ_NOWAIT should be set as well when IOCB_NOWAIT is set.
---
Hi all,
I tested fio io_uring direct read for a file on ext4 filesystem on a nvme ssd. I found that IOCB_NOWAIT is ignored in iomap layer, which means REQ_NOWAIT is not set in bio->bi_opf. This makes nowait IO a normal IO. Since I'm new to iomap and block layer, I sincerely ask yours opinions in case I misunderstand the code which is very likely to happen.:)
fs/block_dev.c | 3 +++ fs/iomap/direct-io.c | 3 +++ 2 files changed, 6 insertions(+)
fs/block_dev.c +3 -0
@@ -424,6 +424,9 @@ static void blkdev_bio_end_io(struct bio *bio)if (!nr_pages) {bool polled = false; +if ((iocb->ki_flags &IOCB_NOWAIT ) && !is_sync) + bio->bi_opf |=REQ_NOWAIT ; +if (iocb->ki_flags &IOCB_HIPRI ) {bio_set_polled (bio, iocb); polled = true;
fs/iomap/direct-io.c +3 -0
@@ -64,6 +64,9 @@ static void iomap_dio_submit_bio(struct iomap_dio *dio, struct iomap *iomap, {atomic_inc (&dio->ref); +if ((dio->iocb->ki_flags &IOCB_NOWAIT ) && !is_sync_kiocb (dio->iocb)) + bio->bi_opf |=REQ_NOWAIT ; +if (dio->iocb->ki_flags &IOCB_HIPRI )bio_set_polled (bio, dio->iocb);
Signature · 1 line
1.8.3.1
RFC 1/1 iomap: set REQ_NOWAIT according to IOCB_NOWAIT in Direct IO
Currently, IOCB_NOWAIT is ignored in direct io, REQ_NOWAIT is only set when IOCB_HIPRI is set. But REQ_NOWAIT should be set as well when IOCB_NOWAIT is set.
---
Hi all,
I tested fio io_uring direct read for a file on ext4 filesystem on a nvme ssd. I found that IOCB_NOWAIT is ignored in iomap layer, which means REQ_NOWAIT is not set in bio->bi_opf. This makes nowait IO a normal IO. Since I'm new to iomap and block layer, I sincerely ask yours opinions in case I misunderstand the code which is very likely to happen.:)
fs/block_dev.c | 3 +++ fs/iomap/direct-io.c | 3 +++ 2 files changed, 6 insertions(+)
fs/block_dev.c +3 -0
@@ -424,6 +424,9 @@ static void blkdev_bio_end_io(struct bio *bio)if (!nr_pages) {bool polled = false; +if (iocb->ki_flags &IOCB_NOWAIT ) + bio->bi_opf |=REQ_NOWAIT ; +if (iocb->ki_flags &IOCB_HIPRI ) {bio_set_polled (bio, iocb); polled = true;
fs/iomap/direct-io.c +3 -0
@@ -64,6 +64,9 @@ static void iomap_dio_submit_bio(struct iomap_dio *dio, struct iomap *iomap, {atomic_inc (&dio->ref); +if (dio->iocb->ki_flags &IOCB_NOWAIT ) + bio->bi_opf |=REQ_NOWAIT ; +if (dio->iocb->ki_flags &IOCB_HIPRI )bio_set_polled (bio, dio->iocb);
Signature · 1 line
1.8.3.1
RFC v2 1/1 iomap: set REQ_NOWAIT according to IOCB_NOWAIT in Direct IO
Currently, IOCB_NOWAIT is ignored in Direct IO, REQ_NOWAIT is only set when IOCB_HIPRI is set. But REQ_NOWAIT should be set as well when IOCB_NOWAIT is set.
---
Hi all,
I tested fio io_uring direct read for a file on ext4 filesystem on a nvme ssd. I found that IOCB_NOWAIT is ignored in iomap layer, which means REQ_NOWAIT is not set in bio->bi_opf. This makes nowait IO a normal IO. Since I'm new to iomap and block layer, I sincerely ask yours opinions in case I misunderstand the code which is very likely to happen.:)
v1->v2:
* add same logic in __blkdev_direct_IO_simple()
fs/block_dev.c | 7 +++++++ fs/iomap/direct-io.c | 3 +++ 2 files changed, 10 insertions(+)
fs/block_dev.c +7 -0
@@ -263,6 +263,10 @@ static void blkdev_bio_end_io_simple(struct bio *bio) bio.bi_opf =dio_bio_write_op (iocb);task_io_account_write (ret); } + +if (iocb->ki_flags &IOCB_NOWAIT ) + bio.bi_opf |=REQ_NOWAIT ; +if (iocb->ki_flags &IOCB_HIPRI )bio_set_polled (&bio, iocb);
@@ -424,6 +428,9 @@ static void blkdev_bio_end_io(struct bio *bio)if (!nr_pages) {bool polled = false; +if (iocb->ki_flags &IOCB_NOWAIT ) + bio->bi_opf |=REQ_NOWAIT ; +if (iocb->ki_flags &IOCB_HIPRI ) {bio_set_polled (bio, iocb); polled = true;
fs/iomap/direct-io.c +3 -0
@@ -64,6 +64,9 @@ static void iomap_dio_submit_bio(struct iomap_dio *dio, struct iomap *iomap, {atomic_inc (&dio->ref); +if (dio->iocb->ki_flags &IOCB_NOWAIT ) + bio->bi_opf |=REQ_NOWAIT ; +if (dio->iocb->ki_flags &IOCB_HIPRI )bio_set_polled (bio, dio->iocb);
Signature · 1 line
1.8.3.1
Quoted 15 lines · Hao Xu
Currently,
IOCB_NOWAITis ignored in Direct IO,REQ_NOWAITis only set whenIOCB_HIPRIis set. ButREQ_NOWAITshould be set as well whenIOCB_NOWAITis set.Signed-off-by Hao Xu <[email protected]>---
Hi all,
I tested fioio_uringdirect read for a file on ext4 filesystem on a nvme ssd. I found thatIOCB_NOWAITis ignored in iomap layer, which meansREQ_NOWAITis not set inbio->bi_opf. This makes nowait IO a normal IO. Since I'm new to iomap and block layer, I sincerely ask yours opinions in case I misunderstand the code which is very likely to happen.:)
Quoted 7 lines
v1->v2:
* add same logic in__blkdev_direct_IO_simple()fs/block_dev.c | 7 +++++++ fs/iomap/direct-io.c | 3 +++ 2 files changed, 10 insertions(+)
ping...
Quoted 40 lines
fs/block_dev.c +7
-0@@ -263,6 +263,10 @@ static void blkdev_bio_end_io_simple(struct bio *bio) bio.bi_opf =dio_bio_write_op (iocb);task_io_account_write (ret); } + +if (iocb->ki_flags &IOCB_NOWAIT ) + bio.bi_opf |=REQ_NOWAIT ; +if (iocb->ki_flags &IOCB_HIPRI )bio_set_polled (&bio, iocb);@@ -424,6 +428,9 @@ static void blkdev_bio_end_io(struct bio *bio)if (!nr_pages) {bool polled = false; +if (iocb->ki_flags &IOCB_NOWAIT ) + bio->bi_opf |=REQ_NOWAIT ; +if (iocb->ki_flags &IOCB_HIPRI ) {bio_set_polled (bio, iocb); polled = true;fs/iomap/direct-io.c +3
-0@@ -64,6 +64,9 @@ static void iomap_dio_submit_bio(struct iomap_dio *dio, struct iomap *iomap, {atomic_inc (&dio->ref); +if (dio->iocb->ki_flags &IOCB_NOWAIT ) + bio->bi_opf |=REQ_NOWAIT ; +if (dio->iocb->ki_flags &IOCB_HIPRI )bio_set_polled (bio, dio->iocb);