aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--example/passthrough.c8
-rw-r--r--example/passthrough_fh.c8
-rw-r--r--example/passthrough_hp.cc6
-rw-r--r--example/passthrough_ll.c6
4 files changed, 28 insertions, 0 deletions
diff --git a/example/passthrough.c b/example/passthrough.c
index 5a0d6d7..30a8ad5 100644
--- a/example/passthrough.c
+++ b/example/passthrough.c
@@ -303,6 +303,14 @@ static int xmp_open(const char *path, struct fuse_file_info *fi)
if (res == -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 = res;
return 0;
}
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;
}
diff --git a/example/passthrough_hp.cc b/example/passthrough_hp.cc
index 9b17de0..7f83a7b 100644
--- a/example/passthrough_hp.cc
+++ b/example/passthrough_hp.cc
@@ -905,6 +905,12 @@ static void sfs_open(fuse_req_t req, fuse_ino_t ino, fuse_file_info *fi) {
if (fs.direct_io)
fi->direct_io = 1;
+ /* 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;
+
/* parallel_direct_writes feature depends on direct_io features.
To make parallel_direct_writes valid, need set fi->direct_io
in current function. */
diff --git a/example/passthrough_ll.c b/example/passthrough_ll.c
index b15725f..46cc8e0 100644
--- a/example/passthrough_ll.c
+++ b/example/passthrough_ll.c
@@ -837,6 +837,12 @@ static void lo_open(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi)
else if (lo->cache == CACHE_ALWAYS)
fi->keep_cache = 1;
+ /* 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 in the kernel). */
+ if (fi->flags & O_DIRECT)
+ fi->direct_io = 1;
+
/* parallel_direct_writes feature depends on direct_io features.
To make parallel_direct_writes valid, need set fi->direct_io
in current function. */