Skip to content

Conversation

@anushka567
Copy link
Contributor

@anushka567 anushka567 commented Nov 19, 2025

This change identifies and propagates the O_DIRECT flag from file open and create operations to the FUSE server. This allows filesystems implemented with this library to be aware of when a user wants to use direct I/O for both new and existing files, which bypasses the kernel's page cache.

The changes in this pull request include:

  • internal/fusekernel/fuse_kernel_linux.go: Defines the OpenDirect flag and a helper function IsDirect().
  • internal/fusekernel/fuse_kernel_darwin.go: Deprecation of unused method Since O_DIRECT is not supported on macOS, this file provides a no-op implementation for Darwin builds. It defines OpenDirect as 0 and an IsDirect() method that always returns false . This is necessary to ensure the library compiles on non-Linux platforms while maintaining a consistent and stable API.
  • fuseops/ops.go: Adds the OpenFlags field to the CreateFileOp struct to carry the open flags as already present in OpenFileOp.
  • conversions.go: Passes the OpenFlags from the incoming FUSE message to the CreateFileOp during conversion as already done in OpenFileOp.

Motivation:
GCSFuse wants to exercise granular control over operations on file handle open with O_DIRECT mode for which we need fuse to propagate the mode explicitly via the OpenFileOp and CreateFileOp so that file handle creation via GCSFuse is done with this information in context.

@anushka567 anushka567 changed the title feat: Propagate O_DIRECT flag in OpenFileOp and CreateFileOp [DNR]feat: Propagate O_DIRECT flag in OpenFileOp and CreateFileOp Nov 19, 2025
@anushka567 anushka567 changed the title [DNR]feat: Propagate O_DIRECT flag in OpenFileOp and CreateFileOp feat: Propagate O_DIRECT flag in OpenFileOp and CreateFileOp Nov 19, 2025
Copy link
Contributor

@geertj geertj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Anushka. I have added some comments for your consideration.

@anushka567 anushka567 requested a review from geertj November 20, 2025 06:12
@geertj
Copy link
Contributor

geertj commented Nov 20, 2025

@stapelberg from my perspective these are ready to merge

@stapelberg stapelberg merged commit f34e17f into jacobsa:master Nov 21, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants