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