btrfs: test fstrim after doing a device replace

Test that after replacing a device, if we run fstrim against the filesystem
we do not trim/discard allocated chunks in the new device. We verify that
allocated chunks in the new device were not trim/discarded by mounting the
new device only in degraded mode, as this is the easiest way to verify it.

This currently fails on btrfs (since kernel 5.2) and is fixed by a patch
that has the following subject:

  "btrfs: fix filesystem corruption after a device replace"

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
3 files changed