aboutsummaryrefslogtreecommitdiff
path: root/tools/virtiofsd/helper.c
diff options
context:
space:
mode:
authorJiachen Zhang <zhangjiachen.jaycee@bytedance.com>2020-08-24 18:59:57 +0800
committerDr. David Alan Gilbert <dgilbert@redhat.com>2020-09-25 12:45:58 +0100
commite12a0edafeb5019aac74114b62a4703f79c5c693 (patch)
treebadeaa53bb34f24540bf03dc00e536483eaa61f1 /tools/virtiofsd/helper.c
parent04d325e86f79bd61f8fd50d45ff795aca0dd3404 (diff)
virtiofsd: Add -o allow_direct_io|no_allow_direct_io options
Due to the commit 65da4539803373ec4eec97ffc49ee90083e56efd, the O_DIRECT open flag of guest applications will be discarded by virtiofsd. While this behavior makes it consistent with the virtio-9p scheme when guest applications use direct I/O, we no longer have any chance to bypass the host page cache. Therefore, we add a flag 'allow_direct_io' to lo_data. If '-o no_allow_direct_io' option is added, or none of '-o allow_direct_io' or '-o no_allow_direct_io' is added, the 'allow_direct_io' will be set to 0, and virtiofsd discards O_DIRECT as before. If '-o allow_direct_io' is added to the starting command-line, 'allow_direct_io' will be set to 1, so that the O_DIRECT flags will be retained and host page cache can be bypassed. Signed-off-by: Jiachen Zhang <zhangjiachen.jaycee@bytedance.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20200824105957.61265-1-zhangjiachen.jaycee@bytedance.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Diffstat (limited to 'tools/virtiofsd/helper.c')
-rw-r--r--tools/virtiofsd/helper.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/virtiofsd/helper.c b/tools/virtiofsd/helper.c
index 7bc5d7dc5a..85770d63f1 100644
--- a/tools/virtiofsd/helper.c
+++ b/tools/virtiofsd/helper.c
@@ -178,6 +178,10 @@ void fuse_cmdline_help(void)
" (0 leaves rlimit unchanged)\n"
" default: min(1000000, fs.file-max - 16384)\n"
" if the current rlimit is lower\n"
+ " -o allow_direct_io|no_allow_direct_io\n"
+ " retain/discard O_DIRECT flags passed down\n"
+ " to virtiofsd from guest applications.\n"
+ " default: no_allow_direct_io\n"
);
}