2020-05-04 15:57:12

by Konstantin Khlebnikov

[permalink] [raw]
Subject: [PATCH RFC 1/2] fs/iomap/direct-io: pass NOWAIT to bio flags

This is required to avoid waiting in lower layers.

Signed-off-by: Konstantin Khlebnikov <[email protected]>
---
fs/iomap/direct-io.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c
index 20dde5aadcdd..9b53fa7651e3 100644
--- a/fs/iomap/direct-io.c
+++ b/fs/iomap/direct-io.c
@@ -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);



2020-05-04 15:57:17

by Konstantin Khlebnikov

[permalink] [raw]
Subject: [PATCH RFC 2/2] fs/direct-io: pass NOWAIT to also for read requests

For some reason NOWAIT currently is passed only for writes.

Signed-off-by: Konstantin Khlebnikov <[email protected]>
Fixes: 03a07c92a9ed ("block: return on congested block device")
---
fs/direct-io.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/direct-io.c b/fs/direct-io.c
index 00b4d15bb811..dbb6afef6be9 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -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;


2020-05-04 16:03:11

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH RFC 1/2] fs/iomap/direct-io: pass NOWAIT to bio flags

On Mon, May 04, 2020 at 06:54:53PM +0300, Konstantin Khlebnikov wrote:
> This is required to avoid waiting in lower layers.
>
> Signed-off-by: Konstantin Khlebnikov <[email protected]>

This looks sensible. Did you run this through xfstests?

2020-05-04 16:28:41

by Konstantin Khlebnikov

[permalink] [raw]
Subject: Re: [PATCH RFC 1/2] fs/iomap/direct-io: pass NOWAIT to bio flags

On 04/05/2020 19.00, Christoph Hellwig wrote:
> On Mon, May 04, 2020 at 06:54:53PM +0300, Konstantin Khlebnikov wrote:
>> This is required to avoid waiting in lower layers.
>>
>> Signed-off-by: Konstantin Khlebnikov <[email protected]>
>
> 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.

2020-05-06 14:42:17

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH RFC 1/2] fs/iomap/direct-io: pass NOWAIT to bio flags

On Mon, May 04, 2020 at 07:23:50PM +0300, Konstantin Khlebnikov wrote:
> On 04/05/2020 19.00, Christoph Hellwig wrote:
> > On Mon, May 04, 2020 at 06:54:53PM +0300, Konstantin Khlebnikov wrote:
> > > This is required to avoid waiting in lower layers.
> > >
> > > Signed-off-by: Konstantin Khlebnikov <[email protected]>
> >
> > 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.

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

2020-05-06 14:42:43

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH RFC 1/2] fs/iomap/direct-io: pass NOWAIT to bio flags

On Mon, May 04, 2020 at 06:54:53PM +0300, Konstantin Khlebnikov wrote:
> This is required to avoid waiting in lower layers.
>
> Signed-off-by: Konstantin Khlebnikov <[email protected]>

Looks good,

Reviewed-by: Christoph Hellwig <[email protected]>

2020-05-06 23:06:21

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH RFC 2/2] fs/direct-io: pass NOWAIT to also for read requests

On Mon, May 04, 2020 at 06:54:57PM +0300, Konstantin Khlebnikov wrote:
> For some reason NOWAIT currently is passed only for writes.
>
> Signed-off-by: Konstantin Khlebnikov <[email protected]>
> Fixes: 03a07c92a9ed ("block: return on congested block device")

Looks good,

Reviewed-by: Christoph Hellwig <[email protected]>