* [PATCH] mm/filemap: don't revert iter on -EIOCBQUEUED
@ 2021-01-09 16:00 Pavel Begunkov
2021-01-11 8:05 ` Christoph Hellwig
0 siblings, 1 reply; 2+ messages in thread
From: Pavel Begunkov @ 2021-01-09 16:00 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-mm, linux-kernel, linux-block
Currently, if I/O is enqueued for async execution direct paths of
generic_file_{read,write}_iter() will always revert the iter. There are
no users expecting that, and that is also costly. Leave iterators as is
on -EIOCBQUEUED.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
mm/filemap.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/mm/filemap.c b/mm/filemap.c
index 5bc672d30143..2e1686e09425 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2633,7 +2633,8 @@ generic_file_read_iter(struct kiocb *iocb, struct iov_iter *iter)
iocb->ki_pos += retval;
count -= retval;
}
- iov_iter_revert(iter, count - iov_iter_count(iter));
+ if (retval != -EIOCBQUEUED)
+ iov_iter_revert(iter, count - iov_iter_count(iter));
/*
* Btrfs can have a short DIO read if we encounter
@@ -3458,7 +3459,8 @@ generic_file_direct_write(struct kiocb *iocb, struct iov_iter *from)
}
iocb->ki_pos = pos;
}
- iov_iter_revert(from, write_len - iov_iter_count(from));
+ if (written != -EIOCBQUEUED)
+ iov_iter_revert(from, write_len - iov_iter_count(from));
out:
return written;
}
--
2.24.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mm/filemap: don't revert iter on -EIOCBQUEUED
2021-01-09 16:00 [PATCH] mm/filemap: don't revert iter on -EIOCBQUEUED Pavel Begunkov
@ 2021-01-11 8:05 ` Christoph Hellwig
0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2021-01-11 8:05 UTC (permalink / raw)
To: Pavel Begunkov; +Cc: Andrew Morton, linux-mm, linux-kernel, linux-block
On Sat, Jan 09, 2021 at 04:00:32PM +0000, Pavel Begunkov wrote:
> Currently, if I/O is enqueued for async execution direct paths of
> generic_file_{read,write}_iter() will always revert the iter. There are
> no users expecting that, and that is also costly. Leave iterators as is
> on -EIOCBQUEUED.
Looks good,
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-01-11 8:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-09 16:00 [PATCH] mm/filemap: don't revert iter on -EIOCBQUEUED Pavel Begunkov
2021-01-11 8:05 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).