diff mbox series

btrfs: support other sectorsizes in _scratch_mkfs_blocksized

Message ID d27e3a324f986b5b52d11df7c7bdcde6744fad4b.1622807821.git.anand.jain@oracle.com (mailing list archive)
State New, archived
Headers show
Series btrfs: support other sectorsizes in _scratch_mkfs_blocksized | expand

Commit Message

Anand Jain June 4, 2021, 12:26 p.m. UTC
When btrfs supports sectorsize != pagesize it can run these test cases
now,
generic/205 generic/206 generic/216 generic/217 generic/218 generic/220
generic/222 generic/227 generic/229 generic/238

This change is backward compatible for kernels without non pagesize
sectorsize support.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
RFC->v1:
  Fix path to the supported_sectorsizes path check if the file exists.
  Grep the word.

 common/rc | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Eryu Guan June 6, 2021, 1:59 p.m. UTC | #1
On Fri, Jun 04, 2021 at 08:26:44PM +0800, Anand Jain wrote:
> When btrfs supports sectorsize != pagesize it can run these test cases
> now,
> generic/205 generic/206 generic/216 generic/217 generic/218 generic/220
> generic/222 generic/227 generic/229 generic/238
> 
> This change is backward compatible for kernels without non pagesize
> sectorsize support.
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
> RFC->v1:
>   Fix path to the supported_sectorsizes path check if the file exists.
>   Grep the word.
> 
>  common/rc | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/common/rc b/common/rc
> index 919028eff41c..baa994e33553 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -1121,6 +1121,15 @@ _scratch_mkfs_blocksized()
>      fi
>  
>      case $FSTYP in
> +    btrfs)
> +	test -f /sys/fs/btrfs/features/supported_sectorsizes || \
> +		_notrun "Subpage sectorsize support is not found in $FSTYP"

As we're updating _scratch_mkf_blocksized, would you please unify the
indention for the whole function to use tab instead of spaces? They're
old code, this way we're slowly migrating old/space indention to tab.

> +
> +	grep -q \\b$blocksize\\b /sys/fs/btrfs/features/supported_sectorsizes || \

I think grep -qw should be fine.

> +		_notrun "$FSTYP does not support sectorsize=$blocksize yet"
> +
> +	_scratch_mkfs $MKFS_OPTIONS --sectorsize=$blocksize

No need to specify $MKFS_OPTIONS here, _scratch_mkfs will append
$MKFS_OPTIONS anyway.

> +	;;
>      xfs)
>  	_scratch_mkfs_xfs $MKFS_OPTIONS -b size=$blocksize

So this $MKFS_OPTIONS isn't needed either, but that belongs to another
patch.

Thanks,
Eryu

>  	;;
> -- 
> 2.18.4
Anand Jain June 7, 2021, 11:54 a.m. UTC | #2
On 6/6/21 9:59 pm, Eryu Guan wrote:
> On Fri, Jun 04, 2021 at 08:26:44PM +0800, Anand Jain wrote:
>> When btrfs supports sectorsize != pagesize it can run these test cases
>> now,
>> generic/205 generic/206 generic/216 generic/217 generic/218 generic/220
>> generic/222 generic/227 generic/229 generic/238
>>
>> This change is backward compatible for kernels without non pagesize
>> sectorsize support.
>>
>> Signed-off-by: Anand Jain <anand.jain@oracle.com>
>> ---
>> RFC->v1:
>>    Fix path to the supported_sectorsizes path check if the file exists.
>>    Grep the word.
>>
>>   common/rc | 9 +++++++++
>>   1 file changed, 9 insertions(+)
>>
>> diff --git a/common/rc b/common/rc
>> index 919028eff41c..baa994e33553 100644
>> --- a/common/rc
>> +++ b/common/rc
>> @@ -1121,6 +1121,15 @@ _scratch_mkfs_blocksized()
>>       fi
>>   
>>       case $FSTYP in
>> +    btrfs)
>> +	test -f /sys/fs/btrfs/features/supported_sectorsizes || \
>> +		_notrun "Subpage sectorsize support is not found in $FSTYP"
> 
> As we're updating _scratch_mkf_blocksized, would you please unify the
> indention for the whole function to use tab instead of spaces? They're
> old code, this way we're slowly migrating old/space indention to tab.

Sure. I am sending a patch separately as the diff will too confusing to 
know what fixed.

> 
>> +
>> +	grep -q \\b$blocksize\\b /sys/fs/btrfs/features/supported_sectorsizes || \
> 
> I think grep -qw should be fine.

  Ok. I will fix this.

> 
>> +		_notrun "$FSTYP does not support sectorsize=$blocksize yet"
>> +
>> +	_scratch_mkfs $MKFS_OPTIONS --sectorsize=$blocksize
> 
> No need to specify $MKFS_OPTIONS here, _scratch_mkfs will append
> $MKFS_OPTIONS anyway.

  Thanks will update.

> 
>> +	;;
>>       xfs)
>>   	_scratch_mkfs_xfs $MKFS_OPTIONS -b size=$blocksize
> 
> So this $MKFS_OPTIONS isn't needed either, but that belongs to another
> patch.

  There are other FSs as well.

Thanks, Anand

> 
> Thanks,
> Eryu
> 
>>   	;;
>> -- 
>> 2.18.4
diff mbox series

Patch

diff --git a/common/rc b/common/rc
index 919028eff41c..baa994e33553 100644
--- a/common/rc
+++ b/common/rc
@@ -1121,6 +1121,15 @@  _scratch_mkfs_blocksized()
     fi
 
     case $FSTYP in
+    btrfs)
+	test -f /sys/fs/btrfs/features/supported_sectorsizes || \
+		_notrun "Subpage sectorsize support is not found in $FSTYP"
+
+	grep -q \\b$blocksize\\b /sys/fs/btrfs/features/supported_sectorsizes || \
+		_notrun "$FSTYP does not support sectorsize=$blocksize yet"
+
+	_scratch_mkfs $MKFS_OPTIONS --sectorsize=$blocksize
+	;;
     xfs)
 	_scratch_mkfs_xfs $MKFS_OPTIONS -b size=$blocksize
 	;;