diff mbox series

NFS-AIO-doesn-t-require-revert-iterator

Message ID CAHRejUqn_wXsK+N92icbJtFDBzTD=EvwdXdr+CCfVzD9wWd-rA@mail.gmail.com (mailing list archive)
State New
Headers show
Series NFS-AIO-doesn-t-require-revert-iterator | expand

Commit Message

liuhzy June 24, 2024, 2:03 p.m. UTC
From 58d1c971b2d42871441e887e3ec4a5a21c83aa95 Mon Sep 17 00:00:00 2001
From: liuh <liuhuan01@kylinos.cn>
Date: Mon, 24 Jun 2024 17:49:08 +0800
Subject: [PATCH] NFS: AIO doesn't require revert iterator

For AIO, nfs_direct_wait return -EIOCBQUEUED would be excepted.
Revert iter is redundant.

Signed-off-by: liuh <liuhuan01@kylinos.cn>
---
 fs/nfs/direct.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index bb2f583eb..262769dae 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -471,7 +471,8 @@  ssize_t nfs_file_direct_read(struct kiocb *iocb, struct iov_iter *iter,
 			requested -= result;
 			iocb->ki_pos += result;
 		}
-		iov_iter_revert(iter, requested);
+		if (is_sync_kiocb(iocb))
+			iov_iter_revert(iter, requested);
 	} else {
 		result = requested;
 	}
@@ -1030,7 +1031,8 @@  ssize_t nfs_file_direct_write(struct kiocb *iocb, struct iov_iter *iter,
 			/* XXX: should check the generic_write_sync retval */
 			generic_write_sync(iocb, result);
 		}
-		iov_iter_revert(iter, requested);
+		if (is_sync_kiocb(iocb))
+			iov_iter_revert(iter, requested);
 	} else {
 		result = requested;
 	}