We cannot use log-structured superblock writing in conventional zones since there is no write pointer to determine the last written superblock position. So, we write a superblock at a static location in a conventional zone. The written position is at the beginning of a zone, which is different from an SB position of regular btrfs. This difference causes a "chicken-and-egg problem" when supporting zoned emulation on a regular device. To know if btrfs is (emulated) zoned btrfs, we need to load an SB and check the feature flag. However, to load an SB, we need to know that it is zoned btrfs to load it from a different position. This patch moves the SB location on conventional zones so that the first SB location will be the same as regular btrfs. Signed-off-by: Naohiro Aota <naohiro.aota@xxxxxxx> --- fs/btrfs/zoned.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c index 90b8d1d5369f..e5619c8bcebb 100644 --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -465,7 +465,8 @@ static int sb_log_location(struct block_device *bdev, struct blk_zone *zones, int ret; if (zones[0].type == BLK_ZONE_TYPE_CONVENTIONAL) { - *bytenr_ret = zones[0].start << SECTOR_SHIFT; + *bytenr_ret = (zones[0].start << SECTOR_SHIFT) + + btrfs_sb_offset(0); return 0; } -- 2.27.0