Lines Matching refs:zinfo
226 struct btrfs_zoned_device_info *zinfo = device->zone_info; in btrfs_get_dev_zones() local
239 if (zinfo->zone_cache) { in btrfs_get_dev_zones()
243 ASSERT(IS_ALIGNED(pos, zinfo->zone_size)); in btrfs_get_dev_zones()
244 zno = pos >> zinfo->zone_size_shift; in btrfs_get_dev_zones()
249 *nr_zones = min_t(u32, *nr_zones, zinfo->nr_zones - zno); in btrfs_get_dev_zones()
254 zone_info = &zinfo->zone_cache[zno + i]; in btrfs_get_dev_zones()
261 memcpy(zones, zinfo->zone_cache + zno, in btrfs_get_dev_zones()
262 sizeof(*zinfo->zone_cache) * *nr_zones); in btrfs_get_dev_zones()
281 if (zinfo->zone_cache) { in btrfs_get_dev_zones()
282 u32 zno = pos >> zinfo->zone_size_shift; in btrfs_get_dev_zones()
284 memcpy(zinfo->zone_cache + zno, zones, in btrfs_get_dev_zones()
285 sizeof(*zinfo->zone_cache) * *nr_zones); in btrfs_get_dev_zones()
918 struct btrfs_zoned_device_info *zinfo = device->zone_info; in btrfs_sb_log_location() local
932 zone_num = sb_zone_number(zinfo->zone_size_shift, mirror); in btrfs_sb_log_location()
933 if (zone_num + 1 >= zinfo->nr_zones) in btrfs_sb_log_location()
937 &zinfo->sb_zones[BTRFS_NR_SB_LOG_ZONES * mirror], in btrfs_sb_log_location()
941 static inline bool is_sb_log_zone(struct btrfs_zoned_device_info *zinfo, in is_sb_log_zone() argument
946 if (!zinfo) in is_sb_log_zone()
949 zone_num = sb_zone_number(zinfo->zone_size_shift, mirror); in is_sb_log_zone()
950 if (zone_num + 1 >= zinfo->nr_zones) in is_sb_log_zone()
953 if (!test_bit(zone_num, zinfo->seq_zones)) in is_sb_log_zone()
961 struct btrfs_zoned_device_info *zinfo = device->zone_info; in btrfs_advance_sb_log() local
965 if (!is_sb_log_zone(zinfo, mirror)) in btrfs_advance_sb_log()
968 zone = &zinfo->sb_zones[BTRFS_NR_SB_LOG_ZONES * mirror]; in btrfs_advance_sb_log()
1047 struct btrfs_zoned_device_info *zinfo = device->zone_info; in btrfs_find_allocatable_zones() local
1048 const u8 shift = zinfo->zone_size_shift; in btrfs_find_allocatable_zones()
1055 ASSERT(IS_ALIGNED(hole_start, zinfo->zone_size)); in btrfs_find_allocatable_zones()
1056 ASSERT(IS_ALIGNED(num_bytes, zinfo->zone_size)); in btrfs_find_allocatable_zones()
1062 if (end > zinfo->nr_zones) in btrfs_find_allocatable_zones()
1067 !bitmap_test_range_all_set(zinfo->empty_zones, begin, nzones)) { in btrfs_find_allocatable_zones()
1068 pos += zinfo->zone_size; in btrfs_find_allocatable_zones()
1082 sb_zone + BTRFS_NR_SB_LOG_ZONES, zinfo); in btrfs_find_allocatable_zones()
1092 zinfo->zone_size); in btrfs_find_allocatable_zones()
1163 struct btrfs_zoned_device_info *zinfo = device->zone_info; in btrfs_ensure_empty_zones() local
1164 const u8 shift = zinfo->zone_size_shift; in btrfs_ensure_empty_zones()
1170 ASSERT(IS_ALIGNED(start, zinfo->zone_size)); in btrfs_ensure_empty_zones()
1171 ASSERT(IS_ALIGNED(size, zinfo->zone_size)); in btrfs_ensure_empty_zones()
1173 if (begin + nbits > zinfo->nr_zones) in btrfs_ensure_empty_zones()
1177 if (bitmap_test_range_all_zero(zinfo->seq_zones, begin, nbits)) in btrfs_ensure_empty_zones()
1181 if (bitmap_test_range_all_set(zinfo->seq_zones, begin, nbits) && in btrfs_ensure_empty_zones()
1182 bitmap_test_range_all_set(zinfo->empty_zones, begin, nbits)) in btrfs_ensure_empty_zones()
1185 for (pos = start; pos < start + size; pos += zinfo->zone_size) { in btrfs_ensure_empty_zones()
1199 ret = btrfs_reset_device_zone(device, pos, zinfo->zone_size, in btrfs_ensure_empty_zones()
1992 struct btrfs_zoned_device_info *zinfo; in btrfs_zone_activate() local
1997 zinfo = device->zone_info; in btrfs_zone_activate()
1999 if (zinfo->max_active_zones == 0) in btrfs_zone_activate()
2003 reserved = zinfo->reserved_active_zones; in btrfs_zone_activate()
2008 if (atomic_read(&zinfo->active_zones_left) <= reserved) { in btrfs_zone_activate()
2021 zinfo->reserved_active_zones--; in btrfs_zone_activate()
2160 struct btrfs_zoned_device_info *zinfo = device->zone_info; in do_zone_finish() local
2162 if (zinfo->max_active_zones == 0) in do_zone_finish()
2167 zinfo->zone_size >> SECTOR_SHIFT, in do_zone_finish()
2174 zinfo->reserved_active_zones++; in do_zone_finish()
2215 struct btrfs_zoned_device_info *zinfo = device->zone_info; in btrfs_can_activate_zone() local
2221 if (!zinfo->max_active_zones) { in btrfs_can_activate_zone()
2227 reserved = zinfo->reserved_active_zones; in btrfs_can_activate_zone()
2231 ret = (atomic_read(&zinfo->active_zones_left) >= (1 + reserved)); in btrfs_can_activate_zone()
2234 ret = (atomic_read(&zinfo->active_zones_left) >= (2 + reserved)); in btrfs_can_activate_zone()