* [PATCH v2] fstests: btrfs/146: make sure hit all stripes in the case of compression
@ 2018-03-08 5:56 Lu Fengqi
2018-03-08 6:10 ` Eryu Guan
0 siblings, 1 reply; 3+ messages in thread
From: Lu Fengqi @ 2018-03-08 5:56 UTC (permalink / raw)
To: linux-btrfs, fstests
In the case of compression, each 128K input data chunk will be compressed
to 4K (because of the characters written are duplicate). Therefore we have
to write (128K * 16) to make sure every stripe can be hit.
Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
---
V2: Modify the regular expression to ensure that it matches various
compress mount options.
tests/btrfs/146 | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/tests/btrfs/146 b/tests/btrfs/146
index 7071c128ca0a..a51eda68eaf3 100755
--- a/tests/btrfs/146
+++ b/tests/btrfs/146
@@ -74,9 +74,16 @@ _scratch_pool_mkfs "-d raid0 -m raid1" > $seqres.full 2>&1
_scratch_mount
# How much do we need to write? We need to hit all of the stripes. btrfs uses
-# a fixed 64k stripesize, so write enough to hit each one
+# a fixed 64k stripesize, so write enough to hit each one. In the case of
+# compression, each 128K input data chunk will be compressed to 4K (because of
+# the characters written are duplicate). Therefore we have to write (128K * 16)
+# to make sure every stripe can be hit.
number_of_devices=`echo $SCRATCH_DEV_POOL | wc -w`
-write_kb=$(($number_of_devices * 64))
+if ! echo $MOUNT_OPTIONS | grep -qoP 'compress(-force)?(=(?!no)|,|$)'; then
+ write_kb=$(($number_of_devices * 64))
+else
+ write_kb=$(($number_of_devices * 2048))
+fi
_require_fs_space $SCRATCH_MNT $write_kb
testfile=$SCRATCH_MNT/fsync-err-test
--
2.16.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] fstests: btrfs/146: make sure hit all stripes in the case of compression
2018-03-08 5:56 [PATCH v2] fstests: btrfs/146: make sure hit all stripes in the case of compression Lu Fengqi
@ 2018-03-08 6:10 ` Eryu Guan
2018-03-08 8:03 ` Lu Fengqi
0 siblings, 1 reply; 3+ messages in thread
From: Eryu Guan @ 2018-03-08 6:10 UTC (permalink / raw)
To: Lu Fengqi; +Cc: linux-btrfs, fstests
On Thu, Mar 08, 2018 at 01:56:45PM +0800, Lu Fengqi wrote:
> In the case of compression, each 128K input data chunk will be compressed
> to 4K (because of the characters written are duplicate). Therefore we have
> to write (128K * 16) to make sure every stripe can be hit.
>
> Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
> ---
>
> V2: Modify the regular expression to ensure that it matches various
> compress mount options.
>
> tests/btrfs/146 | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/tests/btrfs/146 b/tests/btrfs/146
> index 7071c128ca0a..a51eda68eaf3 100755
> --- a/tests/btrfs/146
> +++ b/tests/btrfs/146
> @@ -74,9 +74,16 @@ _scratch_pool_mkfs "-d raid0 -m raid1" > $seqres.full 2>&1
> _scratch_mount
>
> # How much do we need to write? We need to hit all of the stripes. btrfs uses
> -# a fixed 64k stripesize, so write enough to hit each one
> +# a fixed 64k stripesize, so write enough to hit each one. In the case of
> +# compression, each 128K input data chunk will be compressed to 4K (because of
> +# the characters written are duplicate). Therefore we have to write (128K * 16)
> +# to make sure every stripe can be hit.
> number_of_devices=`echo $SCRATCH_DEV_POOL | wc -w`
> -write_kb=$(($number_of_devices * 64))
> +if ! echo $MOUNT_OPTIONS | grep -qoP 'compress(-force)?(=(?!no)|,|$)'; then
I'm wondering if we could just write ($number_of_devices * 2048)K data
unconditionally, so we could get rid of this case switch and the fancy
perl style regexp?
Thanks,
Eryu
> + write_kb=$(($number_of_devices * 64))
> +else
> + write_kb=$(($number_of_devices * 2048))
> +fi
> _require_fs_space $SCRATCH_MNT $write_kb
>
> testfile=$SCRATCH_MNT/fsync-err-test
> --
> 2.16.2
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] fstests: btrfs/146: make sure hit all stripes in the case of compression
2018-03-08 6:10 ` Eryu Guan
@ 2018-03-08 8:03 ` Lu Fengqi
0 siblings, 0 replies; 3+ messages in thread
From: Lu Fengqi @ 2018-03-08 8:03 UTC (permalink / raw)
To: Eryu Guan; +Cc: linux-btrfs, fstests
On Thu, Mar 08, 2018 at 02:10:59PM +0800, Eryu Guan wrote:
>On Thu, Mar 08, 2018 at 01:56:45PM +0800, Lu Fengqi wrote:
>> In the case of compression, each 128K input data chunk will be compressed
>> to 4K (because of the characters written are duplicate). Therefore we have
>> to write (128K * 16) to make sure every stripe can be hit.
>>
>> Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
>> ---
>>
>> V2: Modify the regular expression to ensure that it matches various
>> compress mount options.
>>
>> tests/btrfs/146 | 11 +++++++++--
>> 1 file changed, 9 insertions(+), 2 deletions(-)
>>
>> diff --git a/tests/btrfs/146 b/tests/btrfs/146
>> index 7071c128ca0a..a51eda68eaf3 100755
>> --- a/tests/btrfs/146
>> +++ b/tests/btrfs/146
>> @@ -74,9 +74,16 @@ _scratch_pool_mkfs "-d raid0 -m raid1" > $seqres.full 2>&1
>> _scratch_mount
>>
>> # How much do we need to write? We need to hit all of the stripes. btrfs uses
>> -# a fixed 64k stripesize, so write enough to hit each one
>> +# a fixed 64k stripesize, so write enough to hit each one. In the case of
>> +# compression, each 128K input data chunk will be compressed to 4K (because of
>> +# the characters written are duplicate). Therefore we have to write (128K * 16)
>> +# to make sure every stripe can be hit.
>> number_of_devices=`echo $SCRATCH_DEV_POOL | wc -w`
>> -write_kb=$(($number_of_devices * 64))
>> +if ! echo $MOUNT_OPTIONS | grep -qoP 'compress(-force)?(=(?!no)|,|$)'; then
>
>I'm wondering if we could just write ($number_of_devices * 2048)K data
>unconditionally, so we could get rid of this case switch and the fancy
>perl style regexp?
That is exactly what I want. I'm just not sure if anyone will mind that the
amount of data written is not exactly hitting all stripes. Since you think
it does not matter, I'm glad to delete it.
>
>Thanks,
>Eryu
>
>> + write_kb=$(($number_of_devices * 64))
>> +else
>> + write_kb=$(($number_of_devices * 2048))
>> +fi
>> _require_fs_space $SCRATCH_MNT $write_kb
>>
>> testfile=$SCRATCH_MNT/fsync-err-test
>> --
>> 2.16.2
>>
>>
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
--
Thanks,
Lu
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-03-08 8:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-08 5:56 [PATCH v2] fstests: btrfs/146: make sure hit all stripes in the case of compression Lu Fengqi
2018-03-08 6:10 ` Eryu Guan
2018-03-08 8:03 ` Lu Fengqi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox