]> git.ipfire.org Git - thirdparty/util-linux.git/commit
fstrim: de-duplicate by mount source too
authorKarel Zak <kzak@redhat.com>
Wed, 10 Jun 2015 12:19:45 +0000 (14:19 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 10 Jun 2015 12:19:45 +0000 (14:19 +0200)
commit8dd51c183396c4bf6344d08b01fb84658e0a8eb4
treea9474cce6b6c9ec89e81f3aa544080a0a3d31595
parent8c73e5096d4f3d7a4239f812c904010dd0b3f1cb
fstrim: de-duplicate by mount source too

Now fstrim de-duplicates by target (mountpoint). This patch adds
de-duplication according to mount source (device) to avoid bind mounts
or devices mounted more than once. Note that the patch also check FS
root, the different FS roots of the same multi-root FS (e.g. btrfs)
maybe mounted on different places.

  # mount --bind /home/wine /mnt/test

old version:

  # fstrim -av
  /mnt/test: 0 B (0 bytes) trimmed            <---
  /home/wine: 0 B (0 bytes) trimmed           <---
  /boot: 0 B (0 bytes) trimmed
  /home: 0 B (0 bytes) trimmed
  /: 0 B (0 bytes) trimmed

new version:

  # fstrim -av
  /mnt/test: 0 B (0 bytes) trimmed            <---
  /boot: 0 B (0 bytes) trimmed
  /home: 171.8 MiB (180113408 bytes) trimmed
  /: 0 B (0 bytes) trimmed

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1162213
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/fstrim.c