diff options
author | Johannes Thumshirn <johannes.thumshirn@wdc.com> | 2023-03-02 02:03:21 -0800 |
---|---|---|
committer | Zorro Lang <zlang@kernel.org> | 2023-03-02 23:05:30 +0800 |
commit | b3096c996a48960160b72738e5599df808a53260 (patch) | |
tree | 66ff0fcbf09c089b265572309a2b9587aadada35 /common | |
parent | fc0a397e3ec479a5883fbaba7dea75fd5cbf5ebf (diff) |
common/rc: don't clear superblock for zoned scratch pools
_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>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/rc | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -3517,9 +3517,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 } |