Lines Matching refs:zones
72 struct blk_zone *zones = data; in copy_zone_info_cb() local
74 memcpy(&zones[idx], zone, sizeof(*zone)); in copy_zone_info_cb()
79 static int sb_write_pointer(struct block_device *bdev, struct blk_zone *zones, in sb_write_pointer() argument
88 ASSERT(zones[i].type != BLK_ZONE_TYPE_CONVENTIONAL); in sb_write_pointer()
89 empty[i] = (zones[i].cond == BLK_ZONE_COND_EMPTY); in sb_write_pointer()
90 full[i] = sb_zone_is_full(&zones[i]); in sb_write_pointer()
112 *wp_ret = zones[0].start << SECTOR_SHIFT; in sb_write_pointer()
122 u64 zone_end = (zones[i].start + zones[i].capacity) << SECTOR_SHIFT; in sb_write_pointer()
138 sector = zones[1].start; in sb_write_pointer()
140 sector = zones[0].start; in sb_write_pointer()
145 sector = zones[0].wp; in sb_write_pointer()
147 sector = zones[1].wp; in sb_write_pointer()
192 struct blk_zone *zones, unsigned int nr_zones) in emulate_report_zones() argument
200 zones[i].start = i * zone_sectors + pos; in emulate_report_zones()
201 zones[i].len = zone_sectors; in emulate_report_zones()
202 zones[i].capacity = zone_sectors; in emulate_report_zones()
203 zones[i].wp = zones[i].start + zone_sectors; in emulate_report_zones()
204 zones[i].type = BLK_ZONE_TYPE_CONVENTIONAL; in emulate_report_zones()
205 zones[i].cond = BLK_ZONE_COND_NOT_WP; in emulate_report_zones()
207 if (zones[i].wp >= bdev_size) { in emulate_report_zones()
217 struct blk_zone *zones, unsigned int *nr_zones) in btrfs_get_dev_zones() argument
227 ret = emulate_report_zones(device, pos, zones, *nr_zones); in btrfs_get_dev_zones()
254 memcpy(zones, zinfo->zone_cache + zno, in btrfs_get_dev_zones()
261 copy_zone_info_cb, zones); in btrfs_get_dev_zones()
275 memcpy(zinfo->zone_cache + zno, zones, in btrfs_get_dev_zones()
359 struct blk_zone *zones = NULL; in btrfs_get_dev_zone_info() local
469 zones = kvcalloc(BTRFS_REPORT_NR_ZONES, sizeof(struct blk_zone), GFP_KERNEL); in btrfs_get_dev_zone_info()
470 if (!zones) { in btrfs_get_dev_zone_info()
496 ret = btrfs_get_dev_zones(device, sector << SECTOR_SHIFT, zones, in btrfs_get_dev_zone_info()
502 if (zones[i].type == BLK_ZONE_TYPE_SEQWRITE_REQ) in btrfs_get_dev_zone_info()
504 switch (zones[i].cond) { in btrfs_get_dev_zone_info()
517 sector = zones[nr_zones - 1].start + zones[nr_zones - 1].len; in btrfs_get_dev_zone_info()
589 kvfree(zones); in btrfs_get_dev_zone_info()
621 kvfree(zones); in btrfs_get_dev_zone_info()
805 static int sb_log_location(struct block_device *bdev, struct blk_zone *zones, in sb_log_location() argument
811 if (zones[0].type == BLK_ZONE_TYPE_CONVENTIONAL) { in sb_log_location()
812 *bytenr_ret = zones[0].start << SECTOR_SHIFT; in sb_log_location()
816 ret = sb_write_pointer(bdev, zones, &wp); in sb_log_location()
823 if (wp == zones[0].start << SECTOR_SHIFT) in sb_log_location()
824 reset = &zones[0]; in sb_log_location()
825 else if (wp == zones[1].start << SECTOR_SHIFT) in sb_log_location()
826 reset = &zones[1]; in sb_log_location()
847 if (wp == zones[0].start << SECTOR_SHIFT) in sb_log_location()
848 zone_end = zones[1].start + zones[1].capacity; in sb_log_location()
849 else if (wp == zones[1].start << SECTOR_SHIFT) in sb_log_location()
850 zone_end = zones[0].start + zones[0].capacity; in sb_log_location()
866 struct blk_zone zones[BTRFS_NR_SB_LOG_ZONES]; in btrfs_sb_log_location_bdev() local
894 zones); in btrfs_sb_log_location_bdev()
900 return sb_log_location(bdev, zones, rw, bytenr_ret); in btrfs_sb_log_location_bdev()