On 31/01/2021 02:20, Anand Jain wrote: >> +static int emulate_report_zones(struct btrfs_device *device, u64 pos, >> + struct blk_zone *zones, unsigned int nr_zones) >> +{ >> + const sector_t zone_sectors = >> + device->fs_info->zone_size >> SECTOR_SHIFT; >> + sector_t bdev_size = bdev_nr_sectors(device->bdev); >> + unsigned int i; >> + >> + pos >>= SECTOR_SHIFT; >> + for (i = 0; i < nr_zones; i++) { >> + zones[i].start = i * zone_sectors + pos; >> + zones[i].len = zone_sectors; >> + zones[i].capacity = zone_sectors; >> + zones[i].wp = zones[i].start + zone_sectors; > I missed something. > Hmm, why write-point is again at a zone_sector offset from the start? > Should it be just... > > zones[i].wp = zones[i].start; > > Also, a typo is below. > >> + zones[i].type = BLK_ZONE_TYPE_CONVENTIONAL; >> + zones[i].cond = BLK_ZONE_COND_NOT_WP; >> + It doesn't really matter. The emulation code emulates conventional zones, which don't have a write pointer. A read drive will report a wp value of -1 AFAIR. null_blk uses the zone's end so we opted for this as well in the emulation code, hence also the 'zones[i].cond = BLK_ZONE_COND_NOT_WP;' line. Hope this helps, Johannes