Lines Matching full:zones
21 /* Maximum number of zones to report per blkdev_report_zones() call */
42 /* Number of superblock log zones */
46 * Minimum of active zones we need:
48 * - BTRFS_SUPER_MIRROR_MAX zones for superblock mirrors
49 * - 3 zones to ensure at least one zone per SYSTEM, META and DATA block group
77 struct blk_zone *zones = data; in copy_zone_info_cb() local
79 memcpy(&zones[idx], zone, sizeof(*zone)); in copy_zone_info_cb()
84 static int sb_write_pointer(struct block_device *bdev, struct blk_zone *zones, in sb_write_pointer() argument
92 ASSERT(zones[i].type != BLK_ZONE_TYPE_CONVENTIONAL); in sb_write_pointer()
93 empty[i] = (zones[i].cond == BLK_ZONE_COND_EMPTY); in sb_write_pointer()
94 full[i] = sb_zone_is_full(&zones[i]); in sb_write_pointer()
98 * Possible states of log buffer zones in sb_write_pointer()
107 * 0: Use write pointer of zones[0] in sb_write_pointer()
108 * 1: Use write pointer of zones[1] in sb_write_pointer()
109 * C: Compare super blocks from zones[0] and zones[1], use the latest in sb_write_pointer()
116 *wp_ret = zones[0].start << SECTOR_SHIFT; in sb_write_pointer()
125 u64 zone_end = (zones[i].start + zones[i].capacity) << SECTOR_SHIFT; in sb_write_pointer()
141 sector = zones[1].start; in sb_write_pointer()
143 sector = zones[0].start; in sb_write_pointer()
148 sector = zones[0].wp; in sb_write_pointer()
150 sector = zones[1].wp; in sb_write_pointer()
195 struct blk_zone *zones, unsigned int nr_zones) in emulate_report_zones() argument
203 zones[i].start = i * zone_sectors + pos; in emulate_report_zones()
204 zones[i].len = zone_sectors; in emulate_report_zones()
205 zones[i].capacity = zone_sectors; in emulate_report_zones()
206 zones[i].wp = zones[i].start + zone_sectors; in emulate_report_zones()
207 zones[i].type = BLK_ZONE_TYPE_CONVENTIONAL; in emulate_report_zones()
208 zones[i].cond = BLK_ZONE_COND_NOT_WP; in emulate_report_zones()
210 if (zones[i].wp >= bdev_size) { in emulate_report_zones()
220 struct blk_zone *zones, unsigned int *nr_zones) in btrfs_get_dev_zones() argument
229 ret = emulate_report_zones(device, pos, zones, *nr_zones); in btrfs_get_dev_zones()
242 * We cannot report zones beyond the zone end. So, it is OK to in btrfs_get_dev_zones()
256 /* Cache hit on all the zones */ in btrfs_get_dev_zones()
257 memcpy(zones, zinfo->zone_cache + zno, in btrfs_get_dev_zones()
264 copy_zone_info_cb, zones); in btrfs_get_dev_zones()
280 memcpy(zinfo->zone_cache + zno, zones, in btrfs_get_dev_zones()
358 struct blk_zone *zones = NULL; in btrfs_get_dev_zone_info() local
422 "zoned: %s: max active zones %u is too small, need at least %u active zones", in btrfs_get_dev_zone_info()
448 zones = kvcalloc(BTRFS_REPORT_NR_ZONES, sizeof(struct blk_zone), GFP_KERNEL); in btrfs_get_dev_zone_info()
449 if (!zones) { in btrfs_get_dev_zone_info()
456 * fill the zone info with emulated CONVENTIONAL zones, so no need to in btrfs_get_dev_zone_info()
471 /* Get zones type */ in btrfs_get_dev_zone_info()
475 ret = btrfs_get_dev_zones(device, sector << SECTOR_SHIFT, zones, in btrfs_get_dev_zone_info()
481 if (zones[i].type == BLK_ZONE_TYPE_SEQWRITE_REQ) in btrfs_get_dev_zone_info()
483 switch (zones[i].cond) { in btrfs_get_dev_zone_info()
496 sector = zones[nr_zones - 1].start + zones[nr_zones - 1].len; in btrfs_get_dev_zone_info()
501 "inconsistent number of zones on %s (%u/%u)", in btrfs_get_dev_zone_info()
511 "zoned: %u active zones on %s exceeds max_active_zones %u", in btrfs_get_dev_zone_info()
549 * If zones[0] is conventional, always use the beginning of the in btrfs_get_dev_zone_info()
568 kvfree(zones); in btrfs_get_dev_zone_info()
586 kvfree(zones); in btrfs_get_dev_zone_info()
775 * in sequential zones. in btrfs_check_mountopts_zoned()
796 static int sb_log_location(struct block_device *bdev, struct blk_zone *zones, in sb_log_location() argument
802 if (zones[0].type == BLK_ZONE_TYPE_CONVENTIONAL) { in sb_log_location()
803 *bytenr_ret = zones[0].start << SECTOR_SHIFT; in sb_log_location()
807 ret = sb_write_pointer(bdev, zones, &wp); in sb_log_location()
814 if (wp == zones[0].start << SECTOR_SHIFT) in sb_log_location()
815 reset = &zones[0]; in sb_log_location()
816 else if (wp == zones[1].start << SECTOR_SHIFT) in sb_log_location()
817 reset = &zones[1]; in sb_log_location()
841 if (wp == zones[0].start << SECTOR_SHIFT) in sb_log_location()
842 zone_end = zones[1].start + zones[1].capacity; in sb_log_location()
843 else if (wp == zones[1].start << SECTOR_SHIFT) in sb_log_location()
844 zone_end = zones[0].start + zones[0].capacity; in sb_log_location()
860 struct blk_zone zones[BTRFS_NR_SB_LOG_ZONES]; in btrfs_sb_log_location_bdev() local
888 zones); in btrfs_sb_log_location_bdev()
894 return sb_log_location(bdev, zones, rw, bytenr_ret); in btrfs_sb_log_location_bdev()
991 /* All the zones are FULL. Should not reach here. */ in btrfs_advance_sb_log()
1024 * Find allocatable zones within a given region.
1030 * @return: position of allocatable zones
1055 /* Check if zones in the region are all empty */ in btrfs_find_allocatable_zones()
1098 /* We can use any number of zones */ in btrfs_dev_set_active_zone()
1120 /* We can use any number of zones */ in btrfs_dev_clear_active_zone()
1168 /* All the zones are conventional */ in btrfs_ensure_empty_zones()
1172 /* All the zones are sequential and empty */ in btrfs_ensure_empty_zones()
1202 * for a block group consist of conventional zones. It is pointed to the
1300 /* Consider a zone as active if we can allow any number of active zones. */ in btrfs_load_zone_info()
1417 "zoned: write pointer offset mismatch of zones in DUP profile"); in btrfs_load_block_group_dup()
1457 "zoned: write pointer offset mismatch of zones in %s profile", in btrfs_load_block_group_raid1()
2072 * Activate block group and underlying device zones
2123 * For the data block group, leave active zones for one in btrfs_zone_activate()
2140 /* Successfully activated all the zones */ in btrfs_zone_activate()
2334 /* Check if there is a device with active zones left */ in btrfs_can_activate_zone()
2611 * Reserve zones for one metadata block group, one tree-log block group, and one
2619 /* Reserve zones for normal SINGLE metadata and tree-log block group. */ in btrfs_check_active_zone_reservation()
2663 * Reset the zones of unused block groups from @space_info->bytes_zone_unusable.
2668 * This one resets the zones of a block group, so we can reuse the region
2670 * just removes a block group and frees up the underlying zones. So, we still
2671 * need to allocate a new block group to reuse the zones.