[2/9] generic/015 fix to test the default non-mixed mode
diff mbox series

Message ID 1537784193-24431-3-git-send-email-anand.jain@oracle.com
State New
Headers show
Series
  • Fix _scratch_mkfs_sized() for btrfs
Related show

Commit Message

Anand Jain Sept. 24, 2018, 10:16 a.m. UTC
commit 97575acd7495 (generic/015: Change the test filesystem size to
101mb), created 101mb FS instead of 100mb FS to make sure we create
a FS which is non mixed mode, which is our default mode.

btrfs-progs commit 18e2663db3e1 (btrfs-progs: Add minimum device size
check) added a more accurate minimum required space to create the btrfs
FS in non mixed mode. Which is at 14294784 bytes.

So this patch changes the FS size to be created by _scratch_sized_mkfs
to 200mb so that we create the FS in non mixed mode.

To test mixed blockgroup its better we set it using the MKFS_OPTIONS
explicitly.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 tests/generic/015 | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Comments

Qu Wenruo Sept. 24, 2018, 11:01 a.m. UTC | #1
On 2018/9/24 下午6:16, Anand Jain wrote:
> commit 97575acd7495 (generic/015: Change the test filesystem size to
> 101mb), created 101mb FS instead of 100mb FS to make sure we create
> a FS which is non mixed mode, which is our default mode.
> 
> btrfs-progs commit 18e2663db3e1 (btrfs-progs: Add minimum device size
> check) added a more accurate minimum required space to create the btrfs
> FS in non mixed mode. Which is at 14294784 bytes.
> 
> So this patch changes the FS size to be created by _scratch_sized_mkfs
> to 200mb so that we create the FS in non mixed mode.
> 
> To test mixed blockgroup its better we set it using the MKFS_OPTIONS
> explicitly.
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
>  tests/generic/015 | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/tests/generic/015 b/tests/generic/015
> index 0f4d29800f4f..14941ab6d552 100755
> --- a/tests/generic/015
> +++ b/tests/generic/015
> @@ -37,11 +37,10 @@ _supported_os Linux
>  _require_scratch
>  _require_no_large_scratch_dev
>  
> -# With filesystems less than 100mb btrfs is created in mixed mode
> -# which can lead to slight accounting errors of 1mb. Having the
> -# fs be at least 101 mb ensures those errors are within the error
> -# tolerance of 1%
> -_scratch_mkfs_sized `expr 101 \* 1024 \* 1024` >/dev/null 2>&1 \
> +# With filesystems less than ~200mb _scratch_mkfs_sized will create
> +# data and metadata mixed mode btrfs, so use 200mb so that we test
> +# the default btrfs.
> +_scratch_mkfs_sized $((200 * 1024 * 1024)) >> $seqres.full 2>&1 \
>      || _fail "mkfs failed"

Just as mentioned in the first patch, the minimal size for non-mixed
btrfs depends on mkfs profile.

Metadata DUP and data DUP would fail using 200M mkfs size:

 $ mkfs.btrfs  -m DUP -d DUP -b 200M /dev/data/btrfs -f
 btrfs-progs v4.17.1
 See http://btrfs.wiki.kernel.org for more information.

 ERROR: size 209715200 is too small to make a usable filesystem
 ERROR: minimum size for btrfs filesystem is 240123904

This problem applies to all patches, unfortunately.

Thanks,
Qu

>  _scratch_mount
>  out=$SCRATCH_MNT/fillup.$$
>
Anand Jain Sept. 24, 2018, 11:55 a.m. UTC | #2
On 09/24/2018 07:01 PM, Qu Wenruo wrote:
> 
> 
> On 2018/9/24 下午6:16, Anand Jain wrote:
>> commit 97575acd7495 (generic/015: Change the test filesystem size to
>> 101mb), created 101mb FS instead of 100mb FS to make sure we create
>> a FS which is non mixed mode, which is our default mode.
>>
>> btrfs-progs commit 18e2663db3e1 (btrfs-progs: Add minimum device size
>> check) added a more accurate minimum required space to create the btrfs
>> FS in non mixed mode. Which is at 14294784 bytes.
>>
>> So this patch changes the FS size to be created by _scratch_sized_mkfs
>> to 200mb so that we create the FS in non mixed mode.
>>
>> To test mixed blockgroup its better we set it using the MKFS_OPTIONS
>> explicitly.
>>
>> Signed-off-by: Anand Jain <anand.jain@oracle.com>
>> ---
>>   tests/generic/015 | 9 ++++-----
>>   1 file changed, 4 insertions(+), 5 deletions(-)
>>
>> diff --git a/tests/generic/015 b/tests/generic/015
>> index 0f4d29800f4f..14941ab6d552 100755
>> --- a/tests/generic/015
>> +++ b/tests/generic/015
>> @@ -37,11 +37,10 @@ _supported_os Linux
>>   _require_scratch
>>   _require_no_large_scratch_dev
>>   
>> -# With filesystems less than 100mb btrfs is created in mixed mode
>> -# which can lead to slight accounting errors of 1mb. Having the
>> -# fs be at least 101 mb ensures those errors are within the error
>> -# tolerance of 1%
>> -_scratch_mkfs_sized `expr 101 \* 1024 \* 1024` >/dev/null 2>&1 \
>> +# With filesystems less than ~200mb _scratch_mkfs_sized will create
>> +# data and metadata mixed mode btrfs, so use 200mb so that we test
>> +# the default btrfs.
>> +_scratch_mkfs_sized $((200 * 1024 * 1024)) >> $seqres.full 2>&1 \
>>       || _fail "mkfs failed"
> 
> Just as mentioned in the first patch, the minimal size for non-mixed
> btrfs depends on mkfs profile.
> 
> Metadata DUP and data DUP would fail using 200M mkfs size:
> 
>   $ mkfs.btrfs  -m DUP -d DUP -b 200M /dev/data/btrfs -f
>   btrfs-progs v4.17.1
>   See http://btrfs.wiki.kernel.org for more information.
> 
>   ERROR: size 209715200 is too small to make a usable filesystem
>   ERROR: minimum size for btrfs filesystem is 240123904
> 
> This problem applies to all patches, unfortunately.

  Yes. Handling the other (non default) group profiles is missing.
  Will fix.

Thanks, Anand


> Thanks,
> Qu
> 
>>   _scratch_mount
>>   out=$SCRATCH_MNT/fillup.$$
>>
>

Patch
diff mbox series

diff --git a/tests/generic/015 b/tests/generic/015
index 0f4d29800f4f..14941ab6d552 100755
--- a/tests/generic/015
+++ b/tests/generic/015
@@ -37,11 +37,10 @@  _supported_os Linux
 _require_scratch
 _require_no_large_scratch_dev
 
-# With filesystems less than 100mb btrfs is created in mixed mode
-# which can lead to slight accounting errors of 1mb. Having the
-# fs be at least 101 mb ensures those errors are within the error
-# tolerance of 1%
-_scratch_mkfs_sized `expr 101 \* 1024 \* 1024` >/dev/null 2>&1 \
+# With filesystems less than ~200mb _scratch_mkfs_sized will create
+# data and metadata mixed mode btrfs, so use 200mb so that we test
+# the default btrfs.
+_scratch_mkfs_sized $((200 * 1024 * 1024)) >> $seqres.full 2>&1 \
     || _fail "mkfs failed"
 _scratch_mount
 out=$SCRATCH_MNT/fillup.$$