Skip to contentSkip to conversation

fs/iomap/direct-io: pass NOWAIT to bio flags

RFC PATCH In review Konstantin Khlebnikov 2 participants 7 messages May 4, 2020 – May 6, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/2 fs/iomap/direct-io: pass NOWAIT to bio flags

This is required to avoid waiting in lower layers.

---
 fs/iomap/direct-io.c |    2 ++
 1 file changed, 2 insertions(+)
fs/iomap/direct-io.c +2 -0
index 20dde5aadcdd..9b53fa7651e3 100644
@@ -63,6 +63,8 @@ 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);
 
#1 lore raw

RFC PATCH 2/2 fs/direct-io: pass NOWAIT to also for read requests

For some reason NOWAIT currently is passed only for writes.

Fixes 03a07c92a9ed ("block: return on congested block device")
---
 fs/direct-io.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/direct-io.c +2 -2
index 00b4d15bb811..dbb6afef6be9 100644
@@ -1234,11 +1234,11 @@ do_blockdev_direct_IO(struct kiocb *iocb, struct inode *inode,
 	if (iov_iter_rw(iter) == WRITE) {
 		dio->op = REQ_OP_WRITE;
 		dio->op_flags = REQ_SYNC | REQ_IDLE;
-		if (iocb->ki_flags & IOCB_NOWAIT)
-			dio->op_flags |= REQ_NOWAIT;
 	} else {
 		dio->op = REQ_OP_READ;
 	}
+	if (iocb->ki_flags & IOCB_NOWAIT)
+		dio->op_flags |= REQ_NOWAIT;
 	if (iocb->ki_flags & IOCB_HIPRI)
 		dio->op_flags |= REQ_HIPRI;
 
#4 lore raw
Quoted 7 lines · Christoph Hellwig
Quoted 3 lines · Konstantin Khlebnikov

This is required to avoid waiting in lower layers.

This looks sensible. Did you run this through xfstests?

Nope. It seems xfstests has one trivial test for NOWAIT - generic/471 It tests only write with/without extent, nothing about contention.

I've added nowait into fio and played with it a little.
https://github.com/axboe/fio/pull/972

With these patches I see EAGAINs when queue is flooded.

#5 lore raw
Quoted 9 lines · Konstantin Khlebnikov
Quoted 7 lines · Christoph Hellwig
Quoted 3 lines · Konstantin Khlebnikov

This is required to avoid waiting in lower layers.

This looks sensible. Did you run this through xfstests?

Quoted 7 lines

Nope. It seems xfstests has one trivial test for NOWAIT - generic/471 It tests only write with/without extent, nothing about contention.

I've added nowait into fio and played with it a little.
https://github.com/axboe/fio/pull/972

With these patches I see EAGAINs when queue is flooded.

Once the fio changes land, can you add a simple fio based test to xfstests?