diff options
Diffstat (limited to 'pkg/btrfs/io2_fs.go')
-rw-r--r-- | pkg/btrfs/io2_fs.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/pkg/btrfs/io2_fs.go b/pkg/btrfs/io2_fs.go index dcf7df8..740e6e6 100644 --- a/pkg/btrfs/io2_fs.go +++ b/pkg/btrfs/io2_fs.go @@ -2,6 +2,7 @@ package btrfs import ( "fmt" + "io" "lukeshu.com/btrfs-tools/pkg/btrfs/btrfsitem" "lukeshu.com/btrfs-tools/pkg/btrfs/btrfsvol" @@ -166,3 +167,15 @@ func (fs *FS) initDev(sb *util.Ref[PhysicalAddr, Superblock]) error { } return nil } + +func (fs *FS) Close() error { + var err error + for _, dev := range fs.LV.PhysicalVolumes() { + if _err := dev.Close(); _err != nil && err == nil { + err = _err + } + } + return err +} + +var _ io.Closer = (*FS)(nil) |