Lines Matching refs:zones

23 /* Maximum number of zones to report per blkdev_report_zones() call */
44 /* Number of superblock log zones */
48 * Minimum of active zones we need:
50 * - BTRFS_SUPER_MIRROR_MAX zones for superblock mirrors
51 * - 3 zones to ensure at least one zone per SYSTEM, META and DATA block group
79 struct blk_zone *zones = data;
81 memcpy(&zones[idx], zone, sizeof(*zone));
86 static int sb_write_pointer(struct block_device *bdev, struct blk_zone *zones,
95 ASSERT(zones[i].type != BLK_ZONE_TYPE_CONVENTIONAL);
96 empty[i] = (zones[i].cond == BLK_ZONE_COND_EMPTY);
97 full[i] = sb_zone_is_full(&zones[i]);
101 * Possible states of log buffer zones
110 * 0: Use write pointer of zones[0]
111 * 1: Use write pointer of zones[1]
112 * C: Compare super blocks from zones[0] and zones[1], use the latest
119 *wp_ret = zones[0].start << SECTOR_SHIFT;
129 u64 zone_end = (zones[i].start + zones[i].capacity) << SECTOR_SHIFT;
145 sector = zones[1].start;
147 sector = zones[0].start;
152 sector = zones[0].wp;
154 sector = zones[1].wp;
199 struct blk_zone *zones, unsigned int nr_zones)
207 zones[i].start = i * zone_sectors + pos;
208 zones[i].len = zone_sectors;
209 zones[i].capacity = zone_sectors;
210 zones[i].wp = zones[i].start + zone_sectors;
211 zones[i].type = BLK_ZONE_TYPE_CONVENTIONAL;
212 zones[i].cond = BLK_ZONE_COND_NOT_WP;
214 if (zones[i].wp >= bdev_size) {
224 struct blk_zone *zones, unsigned int *nr_zones)
233 ret = emulate_report_zones(device, pos, zones, *nr_zones);
246 * We cannot report zones beyond the zone end. So, it is OK to
260 /* Cache hit on all the zones */
261 memcpy(zones, zinfo->zone_cache + zno,
268 copy_zone_info_cb, zones);
284 memcpy(zinfo->zone_cache + zno, zones,
369 struct blk_zone *zones = NULL;
433 "zoned: %s: max active zones %u is too small, need at least %u active zones",
459 zones = kvcalloc(BTRFS_REPORT_NR_ZONES, sizeof(struct blk_zone), GFP_KERNEL);
460 if (!zones) {
467 * fill the zone info with emulated CONVENTIONAL zones, so no need to
482 /* Get zones type */
486 ret = btrfs_get_dev_zones(device, sector << SECTOR_SHIFT, zones,
492 if (zones[i].type == BLK_ZONE_TYPE_SEQWRITE_REQ)
494 switch (zones[i].cond) {
507 sector = zones[nr_zones - 1].start + zones[nr_zones - 1].len;
512 "inconsistent number of zones on %s (%u/%u)",
522 "zoned: %u active zones on %s exceeds max_active_zones %u",
560 * If zones[0] is conventional, always use the beginning of the
579 kvfree(zones);
611 kvfree(zones);
799 * in sequential zones.
817 static int sb_log_location(struct block_device *bdev, struct blk_zone *zones,
823 if (zones[0].type == BLK_ZONE_TYPE_CONVENTIONAL) {
824 *bytenr_ret = zones[0].start << SECTOR_SHIFT;
828 ret = sb_write_pointer(bdev, zones, &wp);
835 if (wp == zones[0].start << SECTOR_SHIFT)
836 reset = &zones[0];
837 else if (wp == zones[1].start << SECTOR_SHIFT)
838 reset = &zones[1];
859 if (wp == zones[0].start << SECTOR_SHIFT)
860 zone_end = zones[1].start + zones[1].capacity;
861 else if (wp == zones[1].start << SECTOR_SHIFT)
862 zone_end = zones[0].start + zones[0].capacity;
878 struct blk_zone zones[BTRFS_NR_SB_LOG_ZONES];
906 zones);
912 return sb_log_location(bdev, zones, rw, bytenr_ret);
1006 /* All the zones are FULL. Should not reach here. */
1034 * Find allocatable zones within a given region.
1040 * @return: position of allocatable zones
1065 /* Check if zones in the region are all empty */
1108 /* We can use any number of zones */
1130 /* We can use any number of zones */
1176 /* All the zones are conventional */
1180 /* All the zones are sequential and empty */
1210 * for a block group consist of conventional zones. It is pointed to the
1377 * active zones.
1505 "zoned: write pointer offset mismatch of zones in DUP profile");
1957 * Activate block group and underlying device zones
2005 * For the data block group, leave active zones for one
2022 /* Successfully activated all the zones */
2207 /* Check if there is a device with active zones left */
2484 * Reserve zones for one metadata block group, one tree-log block group, and one
2492 /* Reserve zones for normal SINGLE metadata and tree-log block group. */