linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] fuse: modification of FUSE passthrough call sequence
@ 2025-07-16 12:10 Qi Han
  2025-07-16 12:14 ` Amir Goldstein
  0 siblings, 1 reply; 6+ messages in thread
From: Qi Han @ 2025-07-16 12:10 UTC (permalink / raw)
  To: miklos, amir73il; +Cc: linux-fsdevel, linux-kernel, liulei.rjpt, Qi Han

Hi, Amir
In the commit [1], performing read/write operations with DIRECT_IO on
a FUSE file path does not trigger FUSE passthrough. I am unclear about
the reason behind this behavior. Is it possible to modify the call
sequence to support passthrough for files opened with DIRECT_IO?
Thank you!

[1]
https://lore.kernel.org/all/20240206142453.1906268-7-amir73il@gmail.com/

Reported-by: Lei Liu <liulei.rjpt@vivo.com>
Signed-off-by: Qi Han <hanqi@vivo.com>
---
 fs/fuse/file.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 2ddfb3bb6483..689f9ee938f1 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -1711,11 +1711,11 @@ static ssize_t fuse_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
 	if (FUSE_IS_DAX(inode))
 		return fuse_dax_read_iter(iocb, to);
 
-	/* FOPEN_DIRECT_IO overrides FOPEN_PASSTHROUGH */
-	if (ff->open_flags & FOPEN_DIRECT_IO)
-		return fuse_direct_read_iter(iocb, to);
-	else if (fuse_file_passthrough(ff))
+
+	if (fuse_file_passthrough(ff))
 		return fuse_passthrough_read_iter(iocb, to);
+	else if (ff->open_flags & FOPEN_DIRECT_IO)
+		return fuse_direct_read_iter(iocb, to);
 	else
 		return fuse_cache_read_iter(iocb, to);
 }
@@ -1732,11 +1732,10 @@ static ssize_t fuse_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
 	if (FUSE_IS_DAX(inode))
 		return fuse_dax_write_iter(iocb, from);
 
-	/* FOPEN_DIRECT_IO overrides FOPEN_PASSTHROUGH */
-	if (ff->open_flags & FOPEN_DIRECT_IO)
-		return fuse_direct_write_iter(iocb, from);
-	else if (fuse_file_passthrough(ff))
+	if (fuse_file_passthrough(ff))
 		return fuse_passthrough_write_iter(iocb, from);
+	else if (ff->open_flags & FOPEN_DIRECT_IO)
+		return fuse_direct_write_iter(iocb, from);
 	else
 		return fuse_cache_write_iter(iocb, from);
 }
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-07-17  6:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-16 12:10 [RFC PATCH] fuse: modification of FUSE passthrough call sequence Qi Han
2025-07-16 12:14 ` Amir Goldstein
2025-07-17  1:35   ` Ed Tsai (蔡宗軒)
2025-07-17  6:15     ` Amir Goldstein
2025-07-17  2:23   ` hanqi
2025-07-17  6:16     ` Amir Goldstein

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).