On Wed, Dec 04, 2019 at 05:17:16PM +0900, Naohiro Aota wrote:
[...]
Only commenting on the code, not the design, sorry. I'll leave that to someone
with more experience in BTRFS.
> * at an offset of at least 1MB.
> */
> search_start = max_t(u64, search_start, SZ_1M);
> + /*
> + * For a zoned block device, skip the first zone of the device
> + * entirely.
> + */
> + if (device->zone_info)
> + zone_size = device->zone_info->zone_size;
> + search_start = max_t(u64, search_start, zone_size);
> + search_start = btrfs_zone_align(device, search_start);
if (device->zone_info) {
zone_size = device->zone_info->zone_size;
search_start = max_t(u64, search_start, zone_size);
search_start = btrfs_zone_align(device, search_start);
}
That's the equivalent code, but should make it a bit more clear what's
happening int the HMZONED and !HMZOED cases.
And I /guess/ we're saving some cycles in the !HMZONED case as we don't have
to adjust search start there.
[...]
> @@ -4778,6 +4805,7 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
> int i;
> int j;
> int index;
> + int hmzoned = btrfs_fs_incompat(info, HMZONED);
bool hmzoned = btrfs_fs_incompat(info, HMZONED);