]> git.baikalelectronics.ru Git - kernel.git/commit
dm snapshot: add optional discard support features
authorMike Snitzer <snitzer@redhat.com>
Wed, 19 Jun 2019 21:05:54 +0000 (17:05 -0400)
committerMike Snitzer <snitzer@redhat.com>
Fri, 12 Jul 2019 13:59:36 +0000 (09:59 -0400)
commit03d91511ec10a8459af7c444d7e7b8f7ff1ecc5a
tree16011a026c78d54f09acfdeb459cb9cc5f80437d
parent9dee6c47e2d77bead7658dc2a4e7806312115757
dm snapshot: add optional discard support features

discard_zeroes_cow - a discard issued to the snapshot device that maps
to entire chunks to will zero the corresponding exception(s) in the
snapshot's exception store.

discard_passdown_origin - a discard to the snapshot device is passed down
to the snapshot-origin's underlying device.  This doesn't cause copy-out
to the snapshot exception store because the snapshot-origin target is
bypassed.

The discard_passdown_origin feature depends on the discard_zeroes_cow
feature being enabled.

When these 2 features are enabled they allow a temporarily read-only
device that has completely exhausted its free space to recover space.
To do so dm-snapshot provides temporary buffer to accommodate writes
that the temporarily read-only device cannot handle yet.  Once the upper
layer frees space (e.g. fstrim to XFS) the discards issued to the
dm-snapshot target will be issued to underlying read-only device whose
free space was exhausted.  In addition those discards will also cause
zeroes to be written to the snapshot exception store if corresponding
exceptions exist.  If the underlying origin device provides
deduplication for zero blocks then if/when the snapshot is merged backed
to the origin those blocks will become unused.  Once the origin has
gained adequate space, merging the snapshot back to the thinly
provisioned device will permit continued use of that device without the
temporary space provided by the snapshot.

Requested-by: John Dorminy <jdorminy@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Documentation/device-mapper/snapshot.txt
drivers/md/dm-snap.c