in file.go [714:735]
func doGrowFile(f *File, opts Options) reason {
maxPages, maxSize, err := initTxMaxSize(f, opts.MaxSize)
if err != nil {
return err
}
// Transaction completed. Update file allocator limits
f.allocator.maxPages = maxPages
f.allocator.maxSize = maxSize
// Allocate space on disk if prealloc is enabled and new file size is bounded.
if opts.Prealloc && maxSize > 0 {
if err := f.truncate(int64(maxSize)); err != nil {
return err
}
if err := f.mmapUpdate(); err != nil {
return wrapErr(err)
}
}
return nil
}