aboutsummaryrefslogtreecommitdiffstats
path: root/example/passthrough_fh.c
diff options
context:
space:
mode:
Diffstat (limited to 'example/passthrough_fh.c')
-rw-r--r--example/passthrough_fh.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/example/passthrough_fh.c b/example/passthrough_fh.c
index ec426a8..701d59e 100644
--- a/example/passthrough_fh.c
+++ b/example/passthrough_fh.c
@@ -384,6 +384,14 @@ static int xmp_open(const char *path, struct fuse_file_info *fi)
if (fd == -1)
return -errno;
+ /* Enable direct_io when open has flags O_DIRECT to enjoy the feature
+ parallel_direct_writes (i.e., to get a shared lock, not exclusive lock,
+ for writes to the same file). */
+ if (fi->flags & O_DIRECT) {
+ fi->direct_io = 1;
+ fi->parallel_direct_writes = 1;
+ }
+
fi->fh = fd;
return 0;
}