btrfs: zoned: reset zones of unused block groups
authorNaohiro Aota <naohiro.aota@wdc.com>
Thu, 4 Feb 2021 10:21:56 +0000 (19:21 +0900)
committerDavid Sterba <dsterba@suse.com>
Tue, 9 Feb 2021 01:46:04 +0000 (02:46 +0100)
commitdcba6e48b518e5e48522e9ea2b73b60827c93146
treec792078c2e5abb52dc23f73fd302f57d033ea106
parent011b41bffa3dd086de3f2c393b35cde6133a7140
btrfs: zoned: reset zones of unused block groups

We must reset the zones of a deleted unused block group to rewind the
zones' write pointers to the zones' start.

To do this, we can use the DISCARD_SYNC code to do the reset when the
filesystem is running on zoned devices.

Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/block-group.c
fs/btrfs/extent-tree.c
fs/btrfs/zoned.h