* [PATCH v2] generic: make 17[1-4] work well when btrfs compression is enabled
@ 2016-10-10 8:06 Wang Xiaoguang
2016-10-10 23:31 ` Dave Chinner
0 siblings, 1 reply; 2+ messages in thread
From: Wang Xiaoguang @ 2016-10-10 8:06 UTC (permalink / raw)
To: fstests; +Cc: linux-btrfs
When enabling btrfs compression, original codes can not fill fs
correctly, fix this.
Signed-off-by: Wang Xiaoguang <wangxg.fnst@cn.fujitsu.com>
---
V2: In common/, I did't find an existing function suitable for
these 4 test cases to fill fs, so I still use _pwrite_byte() with
a big enough file length fo fill fs. Note, for btrfs, metadata space
still is not full, only data space is full, but it's OK for these
4 test cases.
All these 4 cases pass in xfs and btrfs(without compression), if
btrfs has compression enabled, these 4 cases will fail for false
enospc error, I have sent kernel patches to fix this bug.
---
tests/generic/171 | 7 ++++---
tests/generic/172 | 6 ++++--
tests/generic/173 | 7 ++++---
tests/generic/174 | 7 ++++---
4 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/tests/generic/171 b/tests/generic/171
index f391685..2d7f683 100755
--- a/tests/generic/171
+++ b/tests/generic/171
@@ -75,9 +75,10 @@ _cp_reflink $testdir/bigfile $testdir/clonefile
sync
echo "Allocate the rest of the space"
-nr_free=$(stat -f -c '%f' $testdir)
-touch $testdir/file0 $testdir/file1
-_pwrite_byte 0x61 0 $((blksz * nr_free)) $testdir/eat_my_space >> $seqres.full 2>&1
+# here we try to write big enough data in case some fs support
+# compression, such as btrfs.
+len=$((2 ** 36))
+_pwrite_byte 0x61 0 $len $testdir/eat_my_space >> $seqres.full 2>&1
sync
echo "CoW the big file"
diff --git a/tests/generic/172 b/tests/generic/172
index 8192290..63637bd 100755
--- a/tests/generic/172
+++ b/tests/generic/172
@@ -72,8 +72,10 @@ _cp_reflink $testdir/bigfile $testdir/clonefile
sync
echo "Allocate the rest of the space"
-touch $testdir/file0 $testdir/file1
-_pwrite_byte 0x61 0 $fs_size $testdir/eat_my_space >> $seqres.full 2>&1
+# here we try to write big enough data in case some fs support
+# compression, such as btrfs.
+len=$((2 ** 36))
+_pwrite_byte 0x61 0 $len $testdir/eat_my_space >> $seqres.full 2>&1
sync
echo "CoW the big file"
diff --git a/tests/generic/173 b/tests/generic/173
index c5fac9e..c8525c1 100755
--- a/tests/generic/173
+++ b/tests/generic/173
@@ -75,9 +75,10 @@ _cp_reflink $testdir/bigfile $testdir/clonefile
sync
echo "Allocate the rest of the space"
-nr_free=$(stat -f -c '%f' $testdir)
-touch $testdir/file0 $testdir/file1
-_pwrite_byte 0x61 0 $((blksz * nr_free)) $testdir/eat_my_space >> $seqres.full 2>&1
+# here we try to write big enough data in case some fs support
+# compression, such as btrfs.
+len=$((2 ** 36))
+_pwrite_byte 0x61 0 $len $testdir/eat_my_space >> $seqres.full 2>&1
sync
echo "mmap CoW the big file"
diff --git a/tests/generic/174 b/tests/generic/174
index 8077d76..7fca339 100755
--- a/tests/generic/174
+++ b/tests/generic/174
@@ -76,9 +76,10 @@ _cp_reflink $testdir/bigfile $testdir/clonefile
sync
echo "Allocate the rest of the space"
-nr_free=$(stat -f -c '%f' $testdir)
-touch $testdir/file0 $testdir/file1
-_pwrite_byte 0x61 0 $((blksz * nr_free)) $testdir/eat_my_space >> $seqres.full 2>&1
+# here we try to write big enough data in case some fs support
+# compression, such as btrfs.
+len=$((2 ** 36))
+_pwrite_byte 0x61 0 $len $testdir/eat_my_space >> $seqres.full 2>&1
sync
echo "CoW the big file"
--
2.9.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] generic: make 17[1-4] work well when btrfs compression is enabled
2016-10-10 8:06 [PATCH v2] generic: make 17[1-4] work well when btrfs compression is enabled Wang Xiaoguang
@ 2016-10-10 23:31 ` Dave Chinner
0 siblings, 0 replies; 2+ messages in thread
From: Dave Chinner @ 2016-10-10 23:31 UTC (permalink / raw)
To: Wang Xiaoguang; +Cc: fstests, linux-btrfs
On Mon, Oct 10, 2016 at 04:06:17PM +0800, Wang Xiaoguang wrote:
> When enabling btrfs compression, original codes can not fill fs
> correctly, fix this.
>
> Signed-off-by: Wang Xiaoguang <wangxg.fnst@cn.fujitsu.com>
> ---
> V2: In common/, I did't find an existing function suitable for
> these 4 test cases to fill fs, so I still use _pwrite_byte() with
> a big enough file length fo fill fs. Note, for btrfs, metadata space
> still is not full, only data space is full, but it's OK for these
> 4 test cases.
>
> All these 4 cases pass in xfs and btrfs(without compression), if
> btrfs has compression enabled, these 4 cases will fail for false
> enospc error, I have sent kernel patches to fix this bug.
> ---
> tests/generic/171 | 7 ++++---
> tests/generic/172 | 6 ++++--
> tests/generic/173 | 7 ++++---
> tests/generic/174 | 7 ++++---
> 4 files changed, 16 insertions(+), 11 deletions(-)
>
> diff --git a/tests/generic/171 b/tests/generic/171
> index f391685..2d7f683 100755
> --- a/tests/generic/171
> +++ b/tests/generic/171
> @@ -75,9 +75,10 @@ _cp_reflink $testdir/bigfile $testdir/clonefile
> sync
>
> echo "Allocate the rest of the space"
> -nr_free=$(stat -f -c '%f' $testdir)
> -touch $testdir/file0 $testdir/file1
> -_pwrite_byte 0x61 0 $((blksz * nr_free)) $testdir/eat_my_space >> $seqres.full 2>&1
> +# here we try to write big enough data in case some fs support
> +# compression, such as btrfs.
> +len=$((2 ** 36))
> +_pwrite_byte 0x61 0 $len $testdir/eat_my_space >> $seqres.full 2>&1
NACK. This is no better than the last proposal. 2^36 = 64GB, which
will not fill filesystems of any significant size, especially as the
data will compress down to nearly nothing.
Trying to hack around compression artifacts by inflating the size of
the file just doesn't work reliably. The way to fix this is to
either use one of the "fill filesystem" functions that isn't
affected by compression, or to add the ability to xfs_io to write
incompressible data patterns and otherwise leave the test alone.
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-10-10 23:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-10 8:06 [PATCH v2] generic: make 17[1-4] work well when btrfs compression is enabled Wang Xiaoguang
2016-10-10 23:31 ` Dave Chinner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox