Skip to content

Commit 8f8de19

Browse files
Add EnableAutoReaddirplus flag to MountConfig (#180)
1 parent 3e9d24d commit 8f8de19

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

connection.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,10 @@ func (c *Connection) Init() error {
208208
// Enable Readdirplus support, allowing the kernel to use Readdirplus
209209
initOp.Flags |= fusekernel.InitDoReaddirplus
210210

211-
// Enable adaptive Readdirplus, allowing the kernel to choose between Readdirplus and Readdir
212-
initOp.Flags |= fusekernel.InitReaddirplusAuto
211+
if c.cfg.EnableAutoReaddirplus {
212+
// Enable adaptive Readdirplus, allowing the kernel to choose between Readdirplus and Readdir
213+
initOp.Flags |= fusekernel.InitReaddirplusAuto
214+
}
213215
}
214216

215217
return c.Reply(ctx, nil)

mount_config.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,18 @@ type MountConfig struct {
210210
// by returning not just the directory entries (like ReadDir), but also their inode
211211
// attributes, thereby saving one extra Lookup request per directory entry.
212212
EnableReaddirplus bool
213+
214+
// Flag to enable adaptive ReadDirPlus.
215+
// This is only effective if EnableReaddirplus is true.
216+
//
217+
// When both flags are set, the kernel may dynamically choose between issuing
218+
// ReaddirPlus and Readdir requests based on observed access patterns.
219+
// For example, `ls` (which lists filenames only) may fall back to Readdir after an initial ReaddirPlus,
220+
// whereas `ls -l` is more likely to continue using ReaddirPlus.
221+
//
222+
// If EnableReaddirplus is true and this flag is false, the kernel will always
223+
// use ReaddirPlus for directory listing.
224+
EnableAutoReaddirplus bool
213225
}
214226

215227
type FUSEImpl uint8

0 commit comments

Comments
 (0)