Just to make sure the fstrim is not trimming anything vital (like tree blocks still in use) on btrfs. The first patch is to enhance log-writes to check each DISCARD operation. The feature is not used in test cases, as it's too time consuming. But should be a pretty handy feature for small logwrites. The second patch is the test case. Which triggers fsstress and a loop of fstrim, all recorded by dm-log-writes. Then check each FLUSH after the 'prepare' mark. The test case in theory can go generic, but I'm using various btrfs specific hack to speed up the test and has a workaround to avoid false alert. So far I haven't triggered a bug. Qu Wenruo (2): fstests: log-writes: Add new discard check point fstests: btrfs: dm-logwrites test for fstrim and fsstress workload src/log-writes/replay-log.c | 10 ++- tests/btrfs/197 | 131 ++++++++++++++++++++++++++++++++++++ tests/btrfs/197.out | 2 + tests/btrfs/group | 1 + 4 files changed, 142 insertions(+), 2 deletions(-) create mode 100755 tests/btrfs/197 create mode 100644 tests/btrfs/197.out -- 2.23.0