erofs: trim fsync_on_commit comments

Shorten the fsync_on_commit comments as asked in review on #14334.

Signed-off-by: Mykhaylo Sul <mykhaylo.sul@oss.qualcomm.com>
This commit is contained in:
Mykhaylo Sul authored and Mike Sul committed 2026-10-15 12:11:10 +02:00
1 parent 02771a9d6d
commit 8f3aafa298
3 files changed
+5 -26

No files matched your search

+1 -4
View File
@@ -141,10 +141,7 @@ forget to restart containerd after changing the configuration.
# Enable fsverity support for EROFS layers, default is false
enable_fsverity = true
# fsync the snapshot directory, everything in it and its entry in
# snapshots/ before a snapshot is committed, so a power loss cannot
# leave a committed snapshot without its blob or directory. Blobs served
# from layer_content_caches are not synced. Costs a few fsyncs per layer,
# Enable fsyncing a snapshot's directory before the snapshot is committed,
# default is false
fsync_on_commit = true
+3 -17
View File
@@ -51,8 +51,7 @@ type SnapshotterConfig struct {
enableFsverity bool
// setImmutable enables IMMUTABLE_FL file attribute for EROFS layers
setImmutable bool
// fsyncOnCommit makes Commit sync the layer blob and the snapshot
// directories before the snapshot is recorded as committed
// fsyncOnCommit enables fsyncing a snapshot's directory before the snapshot is committed
fsyncOnCommit bool
// defaultSize creates a default size writable layer for active snapshots
defaultSize int64
@@ -91,8 +90,7 @@ func WithImmutable() Opt {
}
}
// WithFsyncOnCommit makes Commit sync the layer blob and the snapshot
// directories to disk before the snapshot is recorded as committed
// WithFsyncOnCommit enables fsyncing a snapshot's directory before the snapshot is committed
func WithFsyncOnCommit() Opt {
return func(config *SnapshotterConfig) {
config.fsyncOnCommit = true
@@ -296,9 +294,7 @@ func (s *snapshotter) layerBlobPath(id string) string {
return filepath.Join(s.root, "snapshots", id, "layer.erofs")
}
// syncDir fsyncs the immediate entries of dir, then dir itself and its parent,
// so that the files in dir, its entry list and its own entry in the parent are
// on disk before the caller records them elsewhere. It does not recurse.
// syncDir fsyncs the entries of dir, then dir and its parent.
func syncDir(dir string) error {
entries, err := os.ReadDir(dir)
if err != nil {
@@ -1003,16 +999,6 @@ func (s *snapshotter) Commit(ctx context.Context, name, key string, opts ...snap
// Note: dm-verity formatting is handled by the EROFS differ, not here
// The metadata store syncs its own file when the snapshot is committed, so
// with fsync_on_commit enabled the layer is made durable first; otherwise
// a power loss shortly after a successful pull can leave a committed
// snapshot whose blob is truncated or whose directory does not exist, and
// nothing re-pulls a layer whose chain ID already exists. Everything in
// the snapshot directory is synced rather than a list of known files, then
// the directory and its entry in snapshots/, which was created by a rename
// in Prepare and may still be unwritten. A blob served from the layer
// content cache lives elsewhere and is not synced; whoever populates the
// cache must make it durable.
if s.fsyncOnCommit {
if err := syncDir(filepath.Join(s.root, "snapshots", id)); err != nil {
return err
+1 -5
View File
@@ -51,11 +51,7 @@ type Config struct {
// If `SetImmutable` is enabled, IMMUTABLE_FL will be set on layer blobs.
SetImmutable bool `toml:"set_immutable"`
// FsyncOnCommit makes Commit fsync the snapshot directory, everything in
// it and its entry in snapshots/ before the snapshot is recorded, so that
// a power loss cannot leave a committed snapshot without its blob or
// directory. Blobs served from a layer content cache are not synced. Off
// by default, like the diff service's sync_fs.
// FsyncOnCommit enables fsyncing a snapshot's directory before the snapshot is committed
FsyncOnCommit bool `toml:"fsync_on_commit"`
// DefaultSize is the default size of a writable layer in string