diff options
author | Bernd Schubert <bernd.schubert@fastmail.fm> | 2024-02-26 09:48:04 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-26 09:48:04 +0100 |
commit | f557f3677586d4e22a6208e5dc2ceea4e1999462 (patch) | |
tree | 1d907e2ee1f016f4fa379707782bab3e399a0d8f /example/passthrough_hp.cc | |
parent | 74b1df2e84e836a1710561f52075d51f20cd5c78 (diff) | |
parent | c45863318889fa6344534537c7ef91a37b3fba32 (diff) | |
download | libfuse-f557f3677586d4e22a6208e5dc2ceea4e1999462.tar.gz |
Merge pull request #888 from yangyun50/master
passthrough examples: enable direct io when open has flag: O_DIRECT
Diffstat (limited to 'example/passthrough_hp.cc')
-rw-r--r-- | example/passthrough_hp.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/example/passthrough_hp.cc b/example/passthrough_hp.cc index 66fe6f8..7f83a7b 100644 --- a/example/passthrough_hp.cc +++ b/example/passthrough_hp.cc @@ -840,6 +840,9 @@ static void sfs_create(fuse_req_t req, fuse_ino_t parent, const char *name, if (fs.direct_io) 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. */ fi->parallel_direct_writes = 1; Inode& inode = get_inode(e.ino); @@ -902,6 +905,15 @@ 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. */ fi->parallel_direct_writes = 1; fi->fh = fd; |