fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] common/rc: don't clear superblock for zoned scratch pools
@ 2023-03-02 10:03 Johannes Thumshirn
  2023-03-07  1:44 ` Anand Jain
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Thumshirn @ 2023-03-02 10:03 UTC (permalink / raw)
  To: Zorro Lang
  Cc: linux-btrfs, fstests, Johannes Thumshirn, David Disseldorp, Naohiro Aota

_require_scratch_dev_pool() zeros the first 100 sectors of each device to
clear eventual remains of older filesystems.

On zoned devices this won't work as a plain dd will end up creating
unaligned write errors failing all subsequent actions on the device.

For zoned devices it is enough to simply reset the first two zones of the
device to achieve the same result.

Reviewed-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
 common/rc | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/common/rc b/common/rc
index 654730b21ead..dd0d17959db3 100644
--- a/common/rc
+++ b/common/rc
@@ -3459,9 +3459,15 @@ _require_scratch_dev_pool()
 		            exit 1
 		        fi
 		fi
-		# to help better debug when something fails, we remove
-		# traces of previous btrfs FS on the dev.
-		dd if=/dev/zero of=$i bs=4096 count=100 > /dev/null 2>&1
+		# To help better debug when something fails, we remove
+		# traces of previous btrfs FS on the dev. For zoned devices we
+		# can't use dd as it'll lead to unaligned writes so simply
+		# reset the first two zones.
+		if [ "`_zone_type "$i"`" = "none" ]; then
+			dd if=/dev/zero of=$i bs=4096 count=100 > /dev/null 2>&1
+		else
+			$BLKZONE_PROG reset -c 2 $i
+		fi
 	done
 }
 
-- 
2.39.1


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

* Re: [PATCH v3] common/rc: don't clear superblock for zoned scratch pools
  2023-03-02 10:03 [PATCH v3] common/rc: don't clear superblock for zoned scratch pools Johannes Thumshirn
@ 2023-03-07  1:44 ` Anand Jain
  2023-03-07  1:47   ` Anand Jain
  0 siblings, 1 reply; 3+ messages in thread
From: Anand Jain @ 2023-03-07  1:44 UTC (permalink / raw)
  To: Johannes Thumshirn, Zorro Lang
  Cc: linux-btrfs, fstests, David Disseldorp, Naohiro Aota

On 02/03/2023 18:03, Johannes Thumshirn wrote:
> _require_scratch_dev_pool() zeros the first 100 sectors of each device to
> clear eventual remains of older filesystems.
> 
> On zoned devices this won't work as a plain dd will end up creating
> unaligned write errors failing all subsequent actions on the device.
> 
> For zoned devices it is enough to simply reset the first two zones of the
> device to achieve the same result.
> 
> Reviewed-by: David Disseldorp <ddiss@suse.de>
> Reviewed-by: Naohiro Aota <naohiro.aota@wdc.com>
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> ---
>   common/rc | 12 +++++++++---
>   1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/common/rc b/common/rc
> index 654730b21ead..dd0d17959db3 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -3459,9 +3459,15 @@ _require_scratch_dev_pool()
>   		            exit 1
>   		        fi
>   		fi
> -		# to help better debug when something fails, we remove
> -		# traces of previous btrfs FS on the dev.
> -		dd if=/dev/zero of=$i bs=4096 count=100 > /dev/null 2>&1
> +		# To help better debug when something fails, we remove
> +		# traces of previous btrfs FS on the dev. For zoned devices we
> +		# can't use dd as it'll lead to unaligned writes so simply
> +		# reset the first two zones.
> +		if [ "`_zone_type "$i"`" = "none" ]; then
> +			dd if=/dev/zero of=$i bs=4096 count=100 > /dev/null 2>&1
> +		else
> +			$BLKZONE_PROG reset -c 2 $i
> +		fi
>   	done
>   }
>   

Reviewed-by: Anand Jain <anand.jain@oracle.com>



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

* Re: [PATCH v3] common/rc: don't clear superblock for zoned scratch pools
  2023-03-07  1:44 ` Anand Jain
@ 2023-03-07  1:47   ` Anand Jain
  0 siblings, 0 replies; 3+ messages in thread
From: Anand Jain @ 2023-03-07  1:47 UTC (permalink / raw)
  To: Johannes Thumshirn, Zorro Lang
  Cc: linux-btrfs, fstests, David Disseldorp, Naohiro Aota

On 07/03/2023 09:44, Anand Jain wrote:
> On 02/03/2023 18:03, Johannes Thumshirn wrote:
>> _require_scratch_dev_pool() zeros the first 100 sectors of each device to
>> clear eventual remains of older filesystems.
>>
>> On zoned devices this won't work as a plain dd will end up creating
>> unaligned write errors failing all subsequent actions on the device.
>>
>> For zoned devices it is enough to simply reset the first two zones of the
>> device to achieve the same result.
>>
>> Reviewed-by: David Disseldorp <ddiss@suse.de>
>> Reviewed-by: Naohiro Aota <naohiro.aota@wdc.com>
>> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
>> ---
>>   common/rc | 12 +++++++++---
>>   1 file changed, 9 insertions(+), 3 deletions(-)
>>
>> diff --git a/common/rc b/common/rc
>> index 654730b21ead..dd0d17959db3 100644
>> --- a/common/rc
>> +++ b/common/rc
>> @@ -3459,9 +3459,15 @@ _require_scratch_dev_pool()
>>                       exit 1
>>                   fi
>>           fi
>> -        # to help better debug when something fails, we remove
>> -        # traces of previous btrfs FS on the dev.
>> -        dd if=/dev/zero of=$i bs=4096 count=100 > /dev/null 2>&1
>> +        # To help better debug when something fails, we remove
>> +        # traces of previous btrfs FS on the dev. For zoned devices we
>> +        # can't use dd as it'll lead to unaligned writes so simply
>> +        # reset the first two zones.
>> +        if [ "`_zone_type "$i"`" = "none" ]; then
>> +            dd if=/dev/zero of=$i bs=4096 count=100 > /dev/null 2>&1
>> +        else
>> +            $BLKZONE_PROG reset -c 2 $i
>> +        fi
>>       done
>>   }
> 
> Reviewed-by: Anand Jain <anand.jain@oracle.com>


Pls Ignore.

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

end of thread, other threads:[~2023-03-07  1:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-02 10:03 [PATCH v3] common/rc: don't clear superblock for zoned scratch pools Johannes Thumshirn
2023-03-07  1:44 ` Anand Jain
2023-03-07  1:47   ` 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).