Revert "btrfs: Honour FITRIM range constraints during free space trim"
commit6250c25a2aa516d375a9bb8b730a28531f632ff5
authorDavid Sterba <dsterba@suse.com>
Wed, 29 May 2019 17:25:43 +0000 (29 19:25 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 31 May 2019 13:47:14 +0000 (31 06:47 -0700)
tree4f5b503ebbcfe7e190a8c692e80c63625031c67b
parent1d629bf9b5767cdbe902f32b058ae8c99df72516
Revert "btrfs: Honour FITRIM range constraints during free space trim"

This reverts commit b327ff8a9b5767ce39db650d468fb124b48974a5.

There is currently no corresponding patch in master due to additional
changes that would be significantly different from plain revert in the
respective stable branch.

The range argument was not handled correctly and could cause trim to
overlap allocated areas or reach beyond the end of the device. The
address space that fitrim normally operates on is in logical
coordinates, while the discards are done on the physical device extents.
This distinction cannot be made with the current ioctl interface and
caused the confusion.

The bug depends on the layout of block groups and does not always
happen. The whole-fs trim (run by default by the fstrim tool) is not
affected.

Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/extent-tree.c