[1/9] fstests: btrfs: _scratch_mkfs_sized fix min size without mixed option
diff mbox series

Message ID 1537784193-24431-2-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
As of now _scratch_mkfs_sized check if the requested size is below 1G
and forces the --mixed option for the mkfs.btrfs. Well the correct size
at which we need to force the mixed option is 114294784bytes. Fix that.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 common/rc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Qu Wenruo Sept. 24, 2018, 10:58 a.m. UTC | #1
On 2018/9/24 下午6:16, Anand Jain wrote:
> As of now _scratch_mkfs_sized check if the requested size is below 1G
> and forces the --mixed option for the mkfs.btrfs. Well the correct size
> at which we need to force the mixed option is 114294784bytes. Fix that.

How this size is get from?
If it's from btrfs_min_dev_size(), I strongly recommend to add reference
here, and don't use the ugly intermediate number.


BTW, this number is related to mkfs profile.
If you really want to use some maximum number, please follow the max
possible value in btrfs_min_dev_size(), which should be 229M other than
106M.

Thanks,
Qu

> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
>  common/rc | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/common/rc b/common/rc
> index d5bb1feee2c3..bcdbf03e1bf0 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -969,7 +969,9 @@ _scratch_mkfs_sized()
>  	;;
>      btrfs)
>  	local mixed_opt=
> -	(( fssize <= 1024 * 1024 * 1024 )) && mixed_opt='--mixed'
> +	# minimum size that's needed without the mixed option.
> +	# Non mixed mode is also the default option.
> +	(( fssize < 114294784 )) && mixed_opt='--mixed'
>  	$MKFS_BTRFS_PROG $MKFS_OPTIONS $mixed_opt -b $fssize $SCRATCH_DEV
>  	;;
>      jfs)
>
Anand Jain Sept. 24, 2018, 11:53 a.m. UTC | #2
On 09/24/2018 06:58 PM, Qu Wenruo wrote:
> 
> 
> On 2018/9/24 下午6:16, Anand Jain wrote:
>> As of now _scratch_mkfs_sized check if the requested size is below 1G
>> and forces the --mixed option for the mkfs.btrfs. Well the correct size
>> at which we need to force the mixed option is 114294784bytes. Fix that.
> 
> How this size is get from?
> If it's from btrfs_min_dev_size(), I strongly recommend to add reference
> here, and don't use the ugly intermediate number.
> 
> 
> BTW, this number is related to mkfs profile.
> If you really want to use some maximum number, please follow the max
> possible value in btrfs_min_dev_size(), which should be 229M other than
> 106M.

  Thanks for the comments. I completely missed out the point of other
  group profile requiring more than ~115 bytes. Will fix.
  Yep the ref for the size is btrfs_min_dev_size().

-Anand


> Thanks,
> Qu
> 
>>
>> Signed-off-by: Anand Jain <anand.jain@oracle.com>
>> ---
>>   common/rc | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/common/rc b/common/rc
>> index d5bb1feee2c3..bcdbf03e1bf0 100644
>> --- a/common/rc
>> +++ b/common/rc
>> @@ -969,7 +969,9 @@ _scratch_mkfs_sized()
>>   	;;
>>       btrfs)
>>   	local mixed_opt=
>> -	(( fssize <= 1024 * 1024 * 1024 )) && mixed_opt='--mixed'
>> +	# minimum size that's needed without the mixed option.
>> +	# Non mixed mode is also the default option.
>> +	(( fssize < 114294784 )) && mixed_opt='--mixed'
>>   	$MKFS_BTRFS_PROG $MKFS_OPTIONS $mixed_opt -b $fssize $SCRATCH_DEV
>>   	;;
>>       jfs)
>>
>
Qu Wenruo Sept. 24, 2018, 12:02 p.m. UTC | #3
On 2018/9/24 下午7:53, Anand Jain wrote:
> 
> 
> On 09/24/2018 06:58 PM, Qu Wenruo wrote:
>>
>>
>> On 2018/9/24 下午6:16, Anand Jain wrote:
>>> As of now _scratch_mkfs_sized check if the requested size is below 1G
>>> and forces the --mixed option for the mkfs.btrfs. Well the correct size
>>> at which we need to force the mixed option is 114294784bytes. Fix that.
>>
>> How this size is get from?
>> If it's from btrfs_min_dev_size(), I strongly recommend to add reference
>> here, and don't use the ugly intermediate number.
>>
>>
>> BTW, this number is related to mkfs profile.
>> If you really want to use some maximum number, please follow the max
>> possible value in btrfs_min_dev_size(), which should be 229M other than
>> 106M.
> 
>  Thanks for the comments. I completely missed out the point of other
>  group profile requiring more than ~115 bytes. Will fix.

I'd go a rounded number, like 256M.

Non of the number from btrfs_min_dev_size() is really easy to remember
nor makes sense out of btrfs realm.

And this also leaves a little more headroom for later modification
(although I hope such modification never happen)

Thanks,
Qu

>  Yep the ref for the size is btrfs_min_dev_size().
> 
> -Anand
> 
> 
>> Thanks,
>> Qu
>>
>>>
>>> Signed-off-by: Anand Jain <anand.jain@oracle.com>
>>> ---
>>>   common/rc | 4 +++-
>>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/common/rc b/common/rc
>>> index d5bb1feee2c3..bcdbf03e1bf0 100644
>>> --- a/common/rc
>>> +++ b/common/rc
>>> @@ -969,7 +969,9 @@ _scratch_mkfs_sized()
>>>       ;;
>>>       btrfs)
>>>       local mixed_opt=
>>> -    (( fssize <= 1024 * 1024 * 1024 )) && mixed_opt='--mixed'
>>> +    # minimum size that's needed without the mixed option.
>>> +    # Non mixed mode is also the default option.
>>> +    (( fssize < 114294784 )) && mixed_opt='--mixed'
>>>       $MKFS_BTRFS_PROG $MKFS_OPTIONS $mixed_opt -b $fssize $SCRATCH_DEV
>>>       ;;
>>>       jfs)
>>>
>>
Anand Jain Sept. 24, 2018, 1:40 p.m. UTC | #4
On 09/24/2018 08:02 PM, Qu Wenruo wrote:
> 
> 
> On 2018/9/24 下午7:53, Anand Jain wrote:
>>
>>
>> On 09/24/2018 06:58 PM, Qu Wenruo wrote:
>>>
>>>
>>> On 2018/9/24 下午6:16, Anand Jain wrote:
>>>> As of now _scratch_mkfs_sized check if the requested size is below 1G
>>>> and forces the --mixed option for the mkfs.btrfs. Well the correct size
>>>> at which we need to force the mixed option is 114294784bytes. Fix that.
>>>
>>> How this size is get from?
>>> If it's from btrfs_min_dev_size(), I strongly recommend to add reference
>>> here, and don't use the ugly intermediate number.
>>>
>>>
>>> BTW, this number is related to mkfs profile.
>>> If you really want to use some maximum number, please follow the max
>>> possible value in btrfs_min_dev_size(), which should be 229M other than
>>> 106M.
>>
>>   Thanks for the comments. I completely missed out the point of other
>>   group profile requiring more than ~115 bytes. Will fix.
> 
> I'd go a rounded number, like 256M.
> 
> Non of the number from btrfs_min_dev_size() is really easy to remember
> nor makes sense out of btrfs realm.
> 
> And this also leaves a little more headroom for later modification
> (although I hope such modification never happen)

  I agree. Actually I was thinking it should be like that when I was 
writing this patch, then my logical mind didn't provide any strong 
reason to back that up. As ideas match, Will fix it at 256M.

Thanks, Anand


> Thanks,
> Qu
> 
>>   Yep the ref for the size is btrfs_min_dev_size().
>>
>> -Anand
>>
>>
>>> Thanks,
>>> Qu
>>>
>>>>
>>>> Signed-off-by: Anand Jain <anand.jain@oracle.com>
>>>> ---
>>>>    common/rc | 4 +++-
>>>>    1 file changed, 3 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/common/rc b/common/rc
>>>> index d5bb1feee2c3..bcdbf03e1bf0 100644
>>>> --- a/common/rc
>>>> +++ b/common/rc
>>>> @@ -969,7 +969,9 @@ _scratch_mkfs_sized()
>>>>        ;;
>>>>        btrfs)
>>>>        local mixed_opt=
>>>> -    (( fssize <= 1024 * 1024 * 1024 )) && mixed_opt='--mixed'
>>>> +    # minimum size that's needed without the mixed option.
>>>> +    # Non mixed mode is also the default option.
>>>> +    (( fssize < 114294784 )) && mixed_opt='--mixed'
>>>>        $MKFS_BTRFS_PROG $MKFS_OPTIONS $mixed_opt -b $fssize $SCRATCH_DEV
>>>>        ;;
>>>>        jfs)
>>>>
>>>
>

Patch
diff mbox series

diff --git a/common/rc b/common/rc
index d5bb1feee2c3..bcdbf03e1bf0 100644
--- a/common/rc
+++ b/common/rc
@@ -969,7 +969,9 @@  _scratch_mkfs_sized()
 	;;
     btrfs)
 	local mixed_opt=
-	(( fssize <= 1024 * 1024 * 1024 )) && mixed_opt='--mixed'
+	# minimum size that's needed without the mixed option.
+	# Non mixed mode is also the default option.
+	(( fssize < 114294784 )) && mixed_opt='--mixed'
 	$MKFS_BTRFS_PROG $MKFS_OPTIONS $mixed_opt -b $fssize $SCRATCH_DEV
 	;;
     jfs)