linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] fuse: Avoid invalidating attrs if writeback_cache enabled
@ 2021-10-11  9:02 Xie Yongji
  2021-10-11 13:21 ` Miklos Szeredi
  0 siblings, 1 reply; 7+ messages in thread
From: Xie Yongji @ 2021-10-11  9:02 UTC (permalink / raw)
  To: miklos; +Cc: linux-fsdevel, zhangjiachen.jaycee

Recently we found the performance of small direct writes is bad
when writeback_cache enabled. This is because we need to get
attrs from userspace in fuse_update_get_attr() on each write.
The timeout for the attributes doesn't work since every direct write
will invalidate the attrs in fuse_direct_IO().

To fix it, this patch tries to avoid invalidating attrs if writeback_cache
is enabled since we should trust local size/ctime/mtime in this case.

Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
---
 fs/fuse/file.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 11404f8c21c7..5561d4cc735c 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -2868,8 +2868,11 @@ fuse_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
 	}
 
 	if (iov_iter_rw(iter) == WRITE) {
+		struct fuse_conn *fc = get_fuse_conn(inode);
+
 		ret = fuse_direct_io(io, iter, &pos, FUSE_DIO_WRITE);
-		fuse_invalidate_attr(inode);
+		if (!fc->writeback_cache)
+			fuse_invalidate_attr(inode);
 	} else {
 		ret = __fuse_direct_read(io, iter, &pos);
 	}
-- 
2.11.0


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

end of thread, other threads:[~2021-10-18 13:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-11  9:02 [RFC] fuse: Avoid invalidating attrs if writeback_cache enabled Xie Yongji
2021-10-11 13:21 ` Miklos Szeredi
2021-10-11 14:45   ` Yongji Xie
2021-10-13 13:52     ` Miklos Szeredi
2021-10-18 11:25       ` Yongji Xie
2021-10-18 11:45         ` Miklos Szeredi
2021-10-18 13:08           ` Yongji Xie

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