Open-Source Wikis

/

MinIO

/

Packages

/

storage primitives

minio/minio

storage primitives

Drive-level helpers and bounded resource pools used throughout the storage stack.

internal/disk

Thin wrappers around platform syscalls:

  • Statfs — disk usage / free space, with platform-specific implementations (disk_linux.go, disk_other.go, disk_windows.go).
  • Fdatasync — fsync without metadata flush.
  • DirectIO open helpers for the O_DIRECT path.
  • Atime reads.

Tests are in-tree per file. The package is small but unavoidable: every xl-storage operation depends on it.

internal/bpool

A typed sync.Pool for byte buffers. Used to amortise allocations on hot paths (encoder buffers, REST request bodies).

internal/ringbuffer

A bounded circular buffer used by metrics histograms and trace event channels. Lock-free for single-producer cases.

internal/cachevalue

A "TTL-cached value" helper: look up a value, cache it for N seconds, refetch on expiry. Used heavily by the metrics collectors so a single Prometheus scrape doesn't blow up the cluster with 100 round-trip RPCs.

internal/once

Variants of sync.Once:

  • Init for one-shot initialisation.
  • Once[T] for typed one-shot init that returns a value.

internal/init

internal/init/init.go runs cluster-wide process init that must happen before main() does anything else — disabling fmt-based stack traces in panics, locking memory if asked, applying memory limits early. main.go deliberately imports this package first via _ "github.com/minio/minio/internal/init".

internal/mountinfo

Linux-specific helpers that read /proc/mounts to detect bind mounts and overlap, used by xl-storage to refuse drives sharing a filesystem.

Integration points

  • cmd/xl-storage.gointernal/disk, internal/mountinfo, internal/ioutil, internal/lock.
  • cmd/erasure-encode.go / cmd/erasure-decode.gointernal/bpool.
  • Metrics collectors — internal/cachevalue, internal/ringbuffer.
  • main.gointernal/init.

Entry points for modification

  • Platform support. New disk_<os>.go files when adding a port.
  • Pool sizing. internal/bpool defaults are tuned for typical erasure-encode flows; profile before adjusting.
  • New mount-class detection. Extend internal/mountinfo to surface new failure modes (loopback, fuse).

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

storage primitives – MinIO wiki | Factory