diff options
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/btrfs/btrfsvol/lvm.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/pkg/btrfs/btrfsvol/lvm.go b/pkg/btrfs/btrfsvol/lvm.go index a145f3e..d11b2f0 100644 --- a/pkg/btrfs/btrfsvol/lvm.go +++ b/pkg/btrfs/btrfsvol/lvm.go @@ -122,6 +122,12 @@ func (lv *LogicalVolume[PhysicalVolume]) AddMapping(m Mapping) error { return fmt.Errorf("(%p).AddMapping: %w", lv, err) } + // optimize + if len(logicalOverlaps) == 1 && reflect.DeepEqual(newChunk, logicalOverlaps[0]) && + len(physicalOverlaps) == 1 && reflect.DeepEqual(newExt, physicalOverlaps[0]) { + return nil + } + // logical2physical for _, chunk := range logicalOverlaps { lv.logical2physical = util.RemoveAllFromSliceFunc(lv.logical2physical, func(otherChunk chunkMapping) bool { |