Skip to content

Commit e3ae043

Browse files
conditionally enable direct io (#20)
* enable direct io * set directio to false by default
1 parent 593236d commit e3ae043

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

pkg/blobfs_node.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,11 @@ func (n *FSNode) Opendir(ctx context.Context) syscall.Errno {
149149
func (n *FSNode) Open(ctx context.Context, flags uint32) (fh fs.FileHandle, fuseFlags uint32, errno syscall.Errno) {
150150
n.log("Open called with flags: %v", flags)
151151

152-
return nil, 0, fs.OK
152+
if n.filesystem.Config.BlobFs.DirectIO {
153+
flags |= fuse.FOPEN_DIRECT_IO
154+
}
155+
156+
return nil, flags, fs.OK
153157
}
154158

155159
func (n *FSNode) Read(ctx context.Context, f fs.FileHandle, dest []byte, off int64) (fuse.ReadResult, syscall.Errno) {

pkg/config.default.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ grpcMessageSizeBytes: 1000000000
99
grpcDialTimeoutS: 1
1010
discoveryIntervalS: 5
1111
discoveryMode: metadata
12+
directIO: false
1213
blobfs:
1314
enabled: false
1415
mountPoint: /tmp/test

pkg/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ type BlobFsConfig struct {
9595
Sources []SourceConfig `key:"sources" json:"sources"`
9696
MaxBackgroundTasks int `key:"maxBackgroundTasks" json:"max_background_tasks"`
9797
MaxReadAheadKB int `key:"maxReadAheadKB" json:"max_read_ahead_kb"`
98+
DirectIO bool `key:"directIO" json:"direct_io"`
9899
}
99100

100101
type SourceConfig struct {

0 commit comments

Comments
 (0)