On 22/01/27 01:53PM, Qu Wenruo wrote: > There is a long existing bug in btrfs defrag code that it will always > try to defrag compressed extents, even they are already at max capacity. > > This will not reduce the number of extents, but only waste IO/CPU. > > The kernel fix is titled: > > btrfs: defrag: don't defrag extents which is already at its max capacity > > Signed-off-by: Qu Wenruo <wqu@xxxxxxxx> > --- > tests/btrfs/257 | 79 +++++++++++++++++++++++++++++++++++++++++++++ > tests/btrfs/257.out | 2 ++ > 2 files changed, 81 insertions(+) > create mode 100755 tests/btrfs/257 > create mode 100644 tests/btrfs/257.out > > diff --git a/tests/btrfs/257 b/tests/btrfs/257 > new file mode 100755 > index 00000000..326687dc > --- /dev/null > +++ b/tests/btrfs/257 > @@ -0,0 +1,79 @@ > +#! /bin/bash > +# SPDX-License-Identifier: GPL-2.0 > +# Copyright (C) 2022 SUSE Linux Products GmbH. All Rights Reserved. > +# > +# FS QA Test 257 > +# > +# Make sure btrfs defrag ioctl won't defrag compressed extents which are already > +# at their max capacity. Haven't really looked into this fstest. But it is a good practice to add the commit id and the title here for others to easily refer kernel commit. -ritesh