Lines Matching refs:zone

55 	struct logical_zone *zone = &zones->zones[zone_number];  in initialize_zone()  local
58 result = vdo_int_map_create(VDO_LOCK_MAP_CAPACITY, &zone->lbn_operations); in initialize_zone()
63 zone->next = &zones->zones[zone_number + 1]; in initialize_zone()
65 vdo_initialize_completion(&zone->completion, vdo, in initialize_zone()
67 zone->zones = zones; in initialize_zone()
68 zone->zone_number = zone_number; in initialize_zone()
69 zone->thread_id = vdo->thread_config.logical_threads[zone_number]; in initialize_zone()
70 zone->block_map_zone = &vdo->block_map->zones[zone_number]; in initialize_zone()
71 INIT_LIST_HEAD(&zone->write_vios); in initialize_zone()
72 vdo_set_admin_state_code(&zone->state, VDO_ADMIN_STATE_NORMAL_OPERATION); in initialize_zone()
74 allocation_zone_number = zone->thread_id % vdo->thread_config.physical_zone_count; in initialize_zone()
75 zone->allocation_zone = &vdo->physical_zones->zones[allocation_zone_number]; in initialize_zone()
77 return vdo_make_default_thread(vdo, zone->thread_id); in initialize_zone()
91 zone_count_t zone; in vdo_make_logical_zones() local
104 for (zone = 0; zone < zone_count; zone++) { in vdo_make_logical_zones()
105 result = initialize_zone(zones, zone); in vdo_make_logical_zones()
143 static inline void assert_on_zone_thread(struct logical_zone *zone, const char *what) in assert_on_zone_thread() argument
145 VDO_ASSERT_LOG_ONLY((vdo_get_callback_thread_id() == zone->thread_id), in assert_on_zone_thread()
153 static void check_for_drain_complete(struct logical_zone *zone) in check_for_drain_complete() argument
155 if (!vdo_is_state_draining(&zone->state) || zone->notifying || in check_for_drain_complete()
156 !list_empty(&zone->write_vios)) in check_for_drain_complete()
159 vdo_finish_draining(&zone->state); in check_for_drain_complete()
203 struct logical_zone *zone = &(((struct logical_zones *) context)->zones[zone_number]); in resume_logical_zone() local
205 vdo_fail_completion(parent, vdo_resume_if_quiescent(&zone->state)); in resume_logical_zone()
225 static bool update_oldest_active_generation(struct logical_zone *zone) in update_oldest_active_generation() argument
228 list_first_entry_or_null(&zone->write_vios, struct data_vio, in update_oldest_active_generation()
231 (data_vio == NULL) ? zone->flush_generation : data_vio->flush_generation; in update_oldest_active_generation()
233 if (oldest == zone->oldest_active_generation) in update_oldest_active_generation()
236 WRITE_ONCE(zone->oldest_active_generation, oldest); in update_oldest_active_generation()
246 void vdo_increment_logical_zone_flush_generation(struct logical_zone *zone, in vdo_increment_logical_zone_flush_generation() argument
249 assert_on_zone_thread(zone, __func__); in vdo_increment_logical_zone_flush_generation()
250 VDO_ASSERT_LOG_ONLY((zone->flush_generation == expected_generation), in vdo_increment_logical_zone_flush_generation()
252 zone->zone_number, (unsigned long long) zone->flush_generation, in vdo_increment_logical_zone_flush_generation()
255 zone->flush_generation++; in vdo_increment_logical_zone_flush_generation()
256 zone->ios_in_flush_generation = 0; in vdo_increment_logical_zone_flush_generation()
257 update_oldest_active_generation(zone); in vdo_increment_logical_zone_flush_generation()
267 struct logical_zone *zone = data_vio->logical.zone; in vdo_acquire_flush_generation_lock() local
269 assert_on_zone_thread(zone, __func__); in vdo_acquire_flush_generation_lock()
270 VDO_ASSERT_LOG_ONLY(vdo_is_state_normal(&zone->state), "vdo state is normal"); in vdo_acquire_flush_generation_lock()
272 data_vio->flush_generation = zone->flush_generation; in vdo_acquire_flush_generation_lock()
273 list_add_tail(&data_vio->write_entry, &zone->write_vios); in vdo_acquire_flush_generation_lock()
274 zone->ios_in_flush_generation++; in vdo_acquire_flush_generation_lock()
287 struct logical_zone *zone = as_logical_zone(completion); in notify_flusher() local
289 vdo_complete_flushes(zone->zones->vdo->flusher); in notify_flusher()
292 zone->thread_id); in notify_flusher()
302 struct logical_zone *zone = as_logical_zone(completion); in attempt_generation_complete_notification() local
304 assert_on_zone_thread(zone, __func__); in attempt_generation_complete_notification()
305 if (zone->oldest_active_generation <= zone->notification_generation) { in attempt_generation_complete_notification()
306 zone->notifying = false; in attempt_generation_complete_notification()
307 check_for_drain_complete(zone); in attempt_generation_complete_notification()
311 zone->notifying = true; in attempt_generation_complete_notification()
312 zone->notification_generation = zone->oldest_active_generation; in attempt_generation_complete_notification()
313 vdo_launch_completion_callback(&zone->completion, notify_flusher, in attempt_generation_complete_notification()
314 vdo_get_flusher_thread_id(zone->zones->vdo->flusher)); in attempt_generation_complete_notification()
327 struct logical_zone *zone = data_vio->logical.zone; in vdo_release_flush_generation_lock() local
329 assert_on_zone_thread(zone, __func__); in vdo_release_flush_generation_lock()
335 VDO_ASSERT_LOG_ONLY((zone->oldest_active_generation <= data_vio->flush_generation), in vdo_release_flush_generation_lock()
338 (unsigned long long) zone->oldest_active_generation); in vdo_release_flush_generation_lock()
340 if (!update_oldest_active_generation(zone) || zone->notifying) in vdo_release_flush_generation_lock()
343 attempt_generation_complete_notification(&zone->completion); in vdo_release_flush_generation_lock()
346 struct physical_zone *vdo_get_next_allocation_zone(struct logical_zone *zone) in vdo_get_next_allocation_zone() argument
348 if (zone->allocation_count == ALLOCATIONS_PER_ZONE) { in vdo_get_next_allocation_zone()
349 zone->allocation_count = 0; in vdo_get_next_allocation_zone()
350 zone->allocation_zone = zone->allocation_zone->next; in vdo_get_next_allocation_zone()
353 zone->allocation_count++; in vdo_get_next_allocation_zone()
354 return zone->allocation_zone; in vdo_get_next_allocation_zone()
364 void vdo_dump_logical_zone(const struct logical_zone *zone) in vdo_dump_logical_zone() argument
366 vdo_log_info("logical_zone %u", zone->zone_number); in vdo_dump_logical_zone()
368 (unsigned long long) READ_ONCE(zone->flush_generation), in vdo_dump_logical_zone()
369 (unsigned long long) READ_ONCE(zone->oldest_active_generation), in vdo_dump_logical_zone()
370 (unsigned long long) READ_ONCE(zone->notification_generation), in vdo_dump_logical_zone()
371 vdo_bool_to_string(READ_ONCE(zone->notifying)), in vdo_dump_logical_zone()
372 (unsigned long long) READ_ONCE(zone->ios_in_flush_generation)); in vdo_dump_logical_zone()