Re: [PATCH v2 2/2] btrfs: zoned: bail out if we can't read a reliable write pointer
From: David Sterba <hidden>
Date: 2021-05-05 22:54:57
On Tue, May 04, 2021 at 10:30:24AM +0200, Johannes Thumshirn wrote:
+ btrfs_err(fs_info, + "zoned: cannot read write pointer for zone %llu", + physical >> ilog2(fs_info->zone_size));
This converts the offset to the zone index, I think we should keep it consistent, one way or another. The other message was printing the raw offset (pysical or logical) and this is IMHO more friendly as this is related to other on-disk structures. Translation to the zone index can be done but the offset is not dependent on the device so I'd prefer that. I've checked other messages and there are always raw offsets so I've switched that back to the 'physical'.
quoted hunk ↗ jump to hunk
+ ret = -EIO; + goto out; + } cache->alloc_offset = alloc_offsets[0]; break; case BTRFS_BLOCK_GROUP_DUP:@@ -1208,6 +1215,13 @@ int btrfs_load_block_group_zone_info(struct btrfs_block_group *cache, bool new) } out: + if (cache->alloc_offset > fs_info->zone_size) { + btrfs_err(fs_info, + "zoned: write pointer %llu in BG %llu behind end of zone",
s/BG/block group/ And I've added the block group start as this is an anchor for any potential debugging.
+ cache->alloc_offset, logical);
+ ret = -EIO;
+ }
+
/* An extent is allocated after the write pointer */
if (!ret && num_conventional && last_alloc > cache->alloc_offset) {
btrfs_err(fs_info,
--
2.31.1