linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs: support other sectorsizes in _scratch_mkfs_blocksized
@ 2021-06-04 12:26 Anand Jain
  2021-06-06 13:59 ` Eryu Guan
  2021-06-07 12:08 ` [PATCH 0/2 v2] fstests: fix _scratch_mkfs_blocksized Anand Jain
  0 siblings, 2 replies; 6+ messages in thread
From: Anand Jain @ 2021-06-04 12:26 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs, g.btrfs, quwenruo.btrfs

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"
+
+	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
 	;;
-- 
2.18.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] btrfs: support other sectorsizes in _scratch_mkfs_blocksized
  2021-06-04 12:26 [PATCH] btrfs: support other sectorsizes in _scratch_mkfs_blocksized Anand Jain
@ 2021-06-06 13:59 ` Eryu Guan
  2021-06-07 11:54   ` Anand Jain
  2021-06-07 12:08 ` [PATCH 0/2 v2] fstests: fix _scratch_mkfs_blocksized Anand Jain
  1 sibling, 1 reply; 6+ messages in thread
From: Eryu Guan @ 2021-06-06 13:59 UTC (permalink / raw)
  To: Anand Jain; +Cc: fstests, linux-btrfs, g.btrfs, quwenruo.btrfs

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] btrfs: support other sectorsizes in _scratch_mkfs_blocksized
  2021-06-06 13:59 ` Eryu Guan
@ 2021-06-07 11:54   ` Anand Jain
  0 siblings, 0 replies; 6+ messages in thread
From: Anand Jain @ 2021-06-07 11:54 UTC (permalink / raw)
  To: Eryu Guan; +Cc: fstests, linux-btrfs, g.btrfs, quwenruo.btrfs

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 0/2 v2] fstests: fix _scratch_mkfs_blocksized
  2021-06-04 12:26 [PATCH] btrfs: support other sectorsizes in _scratch_mkfs_blocksized Anand Jain
  2021-06-06 13:59 ` Eryu Guan
@ 2021-06-07 12:08 ` Anand Jain
  2021-06-07 12:08   ` [PATCH 1/2 v2] btrfs: support other sectorsizes in _scratch_mkfs_blocksized Anand Jain
  2021-06-07 12:08   ` [PATCH 2/2 v2] _scratch_mkfs_blocksized: fix indentation Anand Jain
  1 sibling, 2 replies; 6+ messages in thread
From: Anand Jain @ 2021-06-07 12:08 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs, guan

Fixes _scratch_mkfs_blocksized() to support btrfs. And the functions
indentation to use tab instead of space.

v2:
 Patch 1/2:
    Use grep -w
    Drop redundant $MKFS_OPTIONS

Anand Jain (2):
  btrfs: support other sectorsizes in _scratch_mkfs_blocksized
  _scratch_mkfs_blocksized: fix indentation

 common/rc | 59 +++++++++++++++++++++++++++++++++----------------------
 1 file changed, 35 insertions(+), 24 deletions(-)

-- 
2.27.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2 v2] btrfs: support other sectorsizes in _scratch_mkfs_blocksized
  2021-06-07 12:08 ` [PATCH 0/2 v2] fstests: fix _scratch_mkfs_blocksized Anand Jain
@ 2021-06-07 12:08   ` Anand Jain
  2021-06-07 12:08   ` [PATCH 2/2 v2] _scratch_mkfs_blocksized: fix indentation Anand Jain
  1 sibling, 0 replies; 6+ messages in thread
From: Anand Jain @ 2021-06-07 12:08 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs, guan

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>
---
v2:
 use grep -w
 drop $MKFS_OPTIONS

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

diff --git a/common/rc b/common/rc
index a0aa7300dc94..601540730b8f 100644
--- a/common/rc
+++ b/common/rc
@@ -1124,6 +1124,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 -wq $blocksize /sys/fs/btrfs/features/supported_sectorsizes || \
+		_notrun "$FSTYP does not support sectorsize=$blocksize yet"
+
+	_scratch_mkfs --sectorsize=$blocksize
+	;;
     xfs)
 	_scratch_mkfs_xfs $MKFS_OPTIONS -b size=$blocksize
 	;;
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2 v2] _scratch_mkfs_blocksized: fix indentation
  2021-06-07 12:08 ` [PATCH 0/2 v2] fstests: fix _scratch_mkfs_blocksized Anand Jain
  2021-06-07 12:08   ` [PATCH 1/2 v2] btrfs: support other sectorsizes in _scratch_mkfs_blocksized Anand Jain
@ 2021-06-07 12:08   ` Anand Jain
  1 sibling, 0 replies; 6+ messages in thread
From: Anand Jain @ 2021-06-07 12:08 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs, guan

No function change. Fix indentation.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 v2: born

 common/rc | 60 ++++++++++++++++++++++++++++---------------------------
 1 file changed, 31 insertions(+), 29 deletions(-)

diff --git a/common/rc b/common/rc
index 601540730b8f..9c42a6aedc8b 100644
--- a/common/rc
+++ b/common/rc
@@ -1116,42 +1116,44 @@ _scratch_mkfs_geom()
 # _scratch_mkfs_blocksized blocksize
 _scratch_mkfs_blocksized()
 {
-    local blocksize=$1
+	local blocksize=$1
 
-    local re='^[0-9]+$'
-    if ! [[ $blocksize =~ $re ]] ; then
-        _notrun "error: _scratch_mkfs_sized: block size \"$blocksize\" not an integer."
-    fi
+	local re='^[0-9]+$'
+	if ! [[ $blocksize =~ $re ]] ; then
+_notrun "error: _scratch_mkfs_sized: block size \"$blocksize\" not an integer."
+	fi
 
-    case $FSTYP in
-    btrfs)
-	test -f /sys/fs/btrfs/features/supported_sectorsizes || \
+	case $FSTYP in
+	btrfs)
+		test -f /sys/fs/btrfs/features/supported_sectorsizes || \
 		_notrun "Subpage sectorsize support is not found in $FSTYP"
 
-	grep -wq $blocksize /sys/fs/btrfs/features/supported_sectorsizes || \
+		grep -wq $blocksize /sys/fs/btrfs/features/supported_sectorsizes || \
 		_notrun "$FSTYP does not support sectorsize=$blocksize yet"
 
-	_scratch_mkfs --sectorsize=$blocksize
-	;;
-    xfs)
-	_scratch_mkfs_xfs $MKFS_OPTIONS -b size=$blocksize
-	;;
-    ext2|ext3|ext4)
-	${MKFS_PROG} -t $FSTYP -F $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV
-	;;
-    gfs2)
-	${MKFS_PROG} -t $FSTYP $MKFS_OPTIONS -O -b $blocksize $SCRATCH_DEV
-	;;
-    ocfs2)
-	yes | ${MKFS_PROG} -t $FSTYP -F $MKFS_OPTIONS -b $blocksize -C $blocksize $SCRATCH_DEV
-	;;
-    bcachefs)
-	${MKFS_PROG} -t $FSTYP $MKFS_OPTIONS --block_size=$blocksize $SCRATCH_DEV
-	;;
-    *)
+		_scratch_mkfs --sectorsize=$blocksize
+		;;
+	xfs)
+		_scratch_mkfs_xfs $MKFS_OPTIONS -b size=$blocksize
+		;;
+	ext2|ext3|ext4)
+		${MKFS_PROG} -t $FSTYP -F $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV
+		;;
+	gfs2)
+		${MKFS_PROG} -t $FSTYP $MKFS_OPTIONS -O -b $blocksize $SCRATCH_DEV
+		;;
+	ocfs2)
+		yes | ${MKFS_PROG} -t $FSTYP -F $MKFS_OPTIONS -b $blocksize \
+						-C $blocksize $SCRATCH_DEV
+		;;
+	bcachefs)
+		${MKFS_PROG} -t $FSTYP $MKFS_OPTIONS --block_size=$blocksize \
+								$SCRATCH_DEV
+		;;
+	*)
 	_notrun "Filesystem $FSTYP not supported in _scratch_mkfs_blocksized"
-	;;
-    esac
+		;;
+	esac
 }
 
 _scratch_resvblks()
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-06-07 12:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-04 12:26 [PATCH] btrfs: support other sectorsizes in _scratch_mkfs_blocksized Anand Jain
2021-06-06 13:59 ` Eryu Guan
2021-06-07 11:54   ` Anand Jain
2021-06-07 12:08 ` [PATCH 0/2 v2] fstests: fix _scratch_mkfs_blocksized Anand Jain
2021-06-07 12:08   ` [PATCH 1/2 v2] btrfs: support other sectorsizes in _scratch_mkfs_blocksized Anand Jain
2021-06-07 12:08   ` [PATCH 2/2 v2] _scratch_mkfs_blocksized: fix indentation Anand Jain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).