FUSE Adding Support For Non-Extending Parallel Direct Writes To The Same File

Written by Michael Larabel in Linux Storage on 24 October 2022 at 04:22 AM EDT. 4 Comments
Queued up in FUSE's "for-next" kernel branch is a patch worked on in recent months for allowing non-extending parallel direct writes to the same file.

Direct writes to the same file with FUSE (File-Systems in User-Space) have been serialized by an inode lock during write requests while this change allows for multiple direct writes to happen concurrently to the same file, permitting they are not extending the file. With this change expected for Linux 6.2 barring any issues from creeping up, relaxes the exclusive lock for direct non-extending writes. The developers might even be able to allow for parallel direct writes when extending the file size, but they are less sure of that behavioral change and do not modify it with this queued "for-next" FUSE patch.
With these changes, we allow non-extending parallel direct writes on the same file with the help of a flag called FOPEN_PARALLEL_DIRECT_WRITES. If this flag is set on the file (flag is passed from libfuse to fuse kernel as part of file open/create), we do not take exclusive lock anymore, but instead use a shared lock that allows non-extending writes to run in parallel. FUSE implementations which rely on this inode lock for serialization can continue to do so and serialized direct writes are still the default. Implementations that do not do write serialization need to be updated and need to set the FOPEN_PARALLEL_DIRECT_WRITES flag in their file open/create reply.

Those interested in this work can learn more via the patch comments.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week