feat: add directio option for scoutfs backend

This commit is contained in:
Ben McClelland
2026-09-29 09:38:12 -07:00
parent b91e178a12
commit 0c79ae7e23
4 changed files with 19 additions and 6 deletions
+3
View File
@@ -68,6 +68,9 @@ type ScoutfsOpts struct {
// (e.g. "CRC64NVME-<base64>"). For multipart uploads, part ETags become
// CRC64NVME-based values and the completed object ETag is checksum-derived.
DataIntegrityEtag bool
// EnableODirect enables best-effort O_DIRECT for object data reads/writes.
// Disabled by default.
EnableODirect bool
// ObjectLockMode selects local or none for conditional object publishes.
ObjectLockMode posix.ObjectLockMode
}
+1
View File
@@ -84,6 +84,7 @@ func New(rootdir string, opts ScoutfsOpts) (*ScoutFS, error) {
CopyObjectThreshold: opts.CopyObjectThreshold,
DefaultEtag: opts.DefaultEtag,
DataIntegrityEtag: opts.DataIntegrityEtag,
EnableODirect: opts.EnableODirect,
ObjectLockMode: objectLockMode,
}
if opts.newDirPermSet {
+7
View File
@@ -138,6 +138,12 @@ move interfaces as well as support for tiered filesystems.`,
EnvVars: []string{"VGW_DATA_INTEGRITY_ETAG"},
Destination: &dataIntegrityEtag,
},
&cli.BoolFlag{
Name: "enable-odirect",
Usage: "enable best-effort O_DIRECT for object data reads/writes",
EnvVars: []string{"VGW_ENABLE_O_DIRECT"},
Destination: &enableODirect,
},
},
}
}
@@ -177,6 +183,7 @@ func runScoutfs(ctx *cli.Context) error {
opts.ObjectLockMode = posix.ObjectLockMode(scoutfsLockMode)
opts.DefaultEtag = defaultEtag
opts.DataIntegrityEtag = dataIntegrityEtag
opts.EnableODirect = enableODirect
opts.SetNewDirPerm(fs.FileMode(dirPerms))
opts.SetNewFilePerm(fs.FileMode(filePerms))
+8 -6
View File
@@ -727,12 +727,13 @@ ROOT_SECRET_ACCESS_KEY=
#VGW_DISABLE_OBJECT_LOCK_FILE=false
# The VGW_ENABLE_O_DIRECT option enables best-effort O_DIRECT for object data
# reads and writes. This is disabled by default. When enabled, versitygw
# attempts to open object data files with O_DIRECT and automatically falls back
# to buffered I/O when O_DIRECT is not supported by the filesystem/open call.
# Some systems may still enforce alignment constraints for direct I/O. The
# VGW_POSIX_IO_BUFFER_SIZE setting can be used to tune buffered read/write
# chunk sizing while keeping O_DIRECT best-effort behavior enabled.
# reads and writes on the posix and scoutfs backends. This is disabled by
# default. When enabled, versitygw attempts to open object data files with
# O_DIRECT and automatically falls back to buffered I/O when O_DIRECT is not
# supported by the filesystem/open call. Some systems may still enforce
# alignment constraints for direct I/O. For the posix backend, the
# VGW_POSIX_IO_BUFFER_SIZE setting can tune buffered read/write chunk sizing
# while keeping O_DIRECT best-effort behavior enabled.
#VGW_ENABLE_O_DIRECT=false
# The VGW_DEFAULT_ETAG option sets the ETag value returned for objects that do
@@ -767,6 +768,7 @@ ROOT_SECRET_ACCESS_KEY=
# give feedback to clients about object state and offer ability to request
# data to be staged back to disk without the client dealing with long
# request timeout settings.
# VGW_ENABLE_O_DIRECT also applies to ScoutFS; see the POSIX section above.
# The VGW_SCOUTFS_GLACIER option enables the following Glacier API behavior.
# GET object: if file offline, return invalid object state