* [PATCH v2] common/rc: don't clear superblock for zoned scratch pools
@ 2023-02-27 8:27 Johannes Thumshirn
2023-02-27 9:23 ` David Disseldorp
2023-03-02 7:17 ` Naohiro Aota
0 siblings, 2 replies; 5+ messages in thread
From: Johannes Thumshirn @ 2023-02-27 8:27 UTC (permalink / raw)
To: Zorro Lang; +Cc: linux-btrfs, fstests, Johannes Thumshirn
_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.
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..739abbdbfc8c 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 reset -c 2 $i
+ fi
done
}
--
2.39.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] common/rc: don't clear superblock for zoned scratch pools
2023-02-27 8:27 [PATCH v2] common/rc: don't clear superblock for zoned scratch pools Johannes Thumshirn
@ 2023-02-27 9:23 ` David Disseldorp
2023-02-27 9:31 ` Johannes Thumshirn
2023-03-02 7:17 ` Naohiro Aota
1 sibling, 1 reply; 5+ messages in thread
From: David Disseldorp @ 2023-02-27 9:23 UTC (permalink / raw)
To: Johannes Thumshirn; +Cc: Zorro Lang, linux-btrfs, fstests
Hi Johannes,
On Mon, 27 Feb 2023 00:27:17 -0800, 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.
>
> 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..739abbdbfc8c 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 reset -c 2 $i
> + fi
IIUC, any output from blkzone reset will cause test failures - is that
an intention here, or should output go to /dev/null like dd?
Looks fine otherwise.
Cheers, David
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] common/rc: don't clear superblock for zoned scratch pools
2023-02-27 9:23 ` David Disseldorp
@ 2023-02-27 9:31 ` Johannes Thumshirn
2023-02-27 10:14 ` David Disseldorp
0 siblings, 1 reply; 5+ messages in thread
From: Johannes Thumshirn @ 2023-02-27 9:31 UTC (permalink / raw)
To: David Disseldorp
Cc: Zorro Lang, linux-btrfs@vger.kernel.org, fstests@vger.kernel.org
On 27.02.23 10:22, David Disseldorp wrote:
>> - # 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 reset -c 2 $i
>> + fi
>
> IIUC, any output from blkzone reset will cause test failures - is that
> an intention here, or should output go to /dev/null like dd?
>
> Looks fine otherwise.
If all is well, blkzone reset won't have any output. So I guess we're fine.
Thanks :)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] common/rc: don't clear superblock for zoned scratch pools
2023-02-27 9:31 ` Johannes Thumshirn
@ 2023-02-27 10:14 ` David Disseldorp
0 siblings, 0 replies; 5+ messages in thread
From: David Disseldorp @ 2023-02-27 10:14 UTC (permalink / raw)
To: Johannes Thumshirn
Cc: Zorro Lang, linux-btrfs@vger.kernel.org, fstests@vger.kernel.org
On Mon, 27 Feb 2023 09:31:53 +0000, Johannes Thumshirn wrote:
> On 27.02.23 10:22, David Disseldorp wrote:
> >> - # 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 reset -c 2 $i
> >> + fi
> >
> > IIUC, any output from blkzone reset will cause test failures - is that
> > an intention here, or should output go to /dev/null like dd?
> >
> > Looks fine otherwise.
>
> If all is well, blkzone reset won't have any output. So I guess we're fine.
Thanks for the confirmation. In that case:
Reviewed-by: David Disseldorp <ddiss@suse.de>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] common/rc: don't clear superblock for zoned scratch pools
2023-02-27 8:27 [PATCH v2] common/rc: don't clear superblock for zoned scratch pools Johannes Thumshirn
2023-02-27 9:23 ` David Disseldorp
@ 2023-03-02 7:17 ` Naohiro Aota
1 sibling, 0 replies; 5+ messages in thread
From: Naohiro Aota @ 2023-03-02 7:17 UTC (permalink / raw)
To: Johannes Thumshirn; +Cc: Zorro Lang, linux-btrfs, fstests
On Mon, Feb 27, 2023 at 12:27:17AM -0800, 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.
>
> 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..739abbdbfc8c 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 reset -c 2 $i
We can use "$BLKZONE_PROG reset ..." to honor common/config.
With that,
Reviewed-by: Naohiro Aota <naohiro.aota@wdc.com>
> + fi
> done
> }
>
> --
> 2.39.1
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-03-02 7:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-27 8:27 [PATCH v2] common/rc: don't clear superblock for zoned scratch pools Johannes Thumshirn
2023-02-27 9:23 ` David Disseldorp
2023-02-27 9:31 ` Johannes Thumshirn
2023-02-27 10:14 ` David Disseldorp
2023-03-02 7:17 ` Naohiro Aota
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox