diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2022-07-13 22:38:43 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2022-07-14 01:09:20 -0600 |
commit | 7153fc9379dd5910c688925ccd2e0a03b9551a6d (patch) | |
tree | d1fd8edb223c130cc12c0ef2af3c6ae5130afda5 /lib/btrfsprogs/btrfsutil/open.go | |
parent | 913acf193bfac666cec68e8c3fb13829a7a0c794 (diff) |
Buffer FS IO
Diffstat (limited to 'lib/btrfsprogs/btrfsutil/open.go')
-rw-r--r-- | lib/btrfsprogs/btrfsutil/open.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/btrfsprogs/btrfsutil/open.go b/lib/btrfsprogs/btrfsutil/open.go index 0f3b32a..9491a20 100644 --- a/lib/btrfsprogs/btrfsutil/open.go +++ b/lib/btrfsprogs/btrfsutil/open.go @@ -28,8 +28,13 @@ func Open(ctx context.Context, flag int, filenames ...string) (*btrfs.FS, error) typedFile := &diskio.OSFile[btrfsvol.PhysicalAddr]{ File: osFile, } + bufFile := diskio.NewBufferedFile[btrfsvol.PhysicalAddr]( + typedFile, + 16384, // block size: 16KiB + 1024, // number of blocks to buffer; total of 16MiB + ) devFile := &btrfs.Device{ - File: typedFile, + File: bufFile, } if err := fs.AddDevice(ctx, devFile); err != nil { return nil, fmt.Errorf("device file %q: %w", filename, err) |