github.com/pingcap/badger@v1.5.1-0.20230103063557-828f39b09b6d/fileutil/preallocate.go (about) 1 package fileutil 2 3 import "os" 4 5 func Preallocate(f *os.File, size int64) error { 6 if size == 0 { 7 return nil 8 } 9 return preallocate(f, size) 10 } 11 12 func preallocateTrunc(f *os.File, size int64) error { 13 return f.Truncate(size) 14 }