Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

358 B
Raw Blame
//go:build !windows

package storage

import (
	"os"
	"syscall"
)

// AllocatedSize reports the bytes the filesystem holds for a file, which
// exceeds its size when the file was preallocated with FALLOC_FL_KEEP_SIZE.
func AllocatedSize(fi os.FileInfo) uint64 {
	st, ok := fi.Sys().(*syscall.Stat_t)
	if !ok {
		return 0
	}
	return uint64(st.Blocks) * 512
}