Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ var contextKey interface{} = contextKeyType(0)
// Reading a page at a time is a drag. Ask for a larger size.
const maxReadahead = 1 << 20

const (
defaultMaxBackground = 128
defaultCongestionThreshold = 96
)

// Connection represents a connection to the fuse kernel process. It is used to
// receive and reply to requests from the kernel.
type Connection struct {
Expand Down Expand Up @@ -159,6 +164,17 @@ func (c *Connection) Init() error {
initOp.Library = c.protocol
initOp.MaxReadahead = maxReadahead
initOp.MaxWrite = buffer.MaxWriteSize
initOp.MaxBackground = c.cfg.MaxBackground
if initOp.MaxBackground == 0 {
initOp.MaxBackground = defaultMaxBackground
}
initOp.CongestionThreshold = c.cfg.CongestionThreshold
if initOp.CongestionThreshold == 0 {
initOp.CongestionThreshold = defaultCongestionThreshold
if initOp.CongestionThreshold >= initOp.MaxBackground {
initOp.CongestionThreshold = initOp.MaxBackground * 3 / 4
}
}

initOp.Flags = 0

Expand Down
5 changes: 2 additions & 3 deletions conversions.go
Original file line number Diff line number Diff line change
Expand Up @@ -1061,9 +1061,8 @@ func (c *Connection) kernelResponseForOp(
out.Minor = o.Library.Minor
out.MaxReadahead = o.MaxReadahead
out.Flags = uint32(o.Flags)
// Default values
out.MaxBackground = 12
out.CongestionThreshold = 9
out.MaxBackground = o.MaxBackground
out.CongestionThreshold = o.CongestionThreshold
out.MaxWrite = o.MaxWrite
out.TimeGran = 1
out.MaxPages = o.MaxPages
Expand Down
4 changes: 2 additions & 2 deletions internal/buffer/in_message_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ package buffer

// The maximum fuse write request size that InMessage can acommodate.
//
// As of kernel 4.20 Linux accepts writes up to 256 pages or 1MiB
const MaxWriteSize = 1 << 17
// As of kernel 4.20 Linux accepts writes up to 256 pages or 1MiB.
const MaxWriteSize = 1 << 20
10 changes: 10 additions & 0 deletions mount_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,16 @@ type MountConfig struct {
// being read from the file as a list of slices in ReadFileOp.Data.
UseVectoredRead bool

// Linux only. Controls the maximum number of outstanding FUSE requests the
// kernel may queue before applying backpressure. If zero, the library uses a
// high-throughput default.
MaxBackground uint16

// Linux only. Controls the number of outstanding FUSE requests at which the
// kernel considers the connection congested. If zero, the library derives a
// value from MaxBackground.
CongestionThreshold uint16

// OS X only.
//
// The name of the mounted volume, as displayed in the Finder. If empty, a
Expand Down
11 changes: 6 additions & 5 deletions ops.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ type initOp struct {
Flags fusekernel.InitFlags

// Out
Library fusekernel.Protocol
MaxReadahead uint32
MaxBackground uint16
MaxWrite uint32
MaxPages uint16
Library fusekernel.Protocol
MaxReadahead uint32
MaxBackground uint16
CongestionThreshold uint16
MaxWrite uint32
MaxPages uint16
}
Loading