drivers/md/dm-vdo/logical-zone.c
Source file repositories/reference/linux-study-clean/drivers/md/dm-vdo/logical-zone.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/md/dm-vdo/logical-zone.c- Extension
.c- Size
- 11386 bytes
- Lines
- 361
- Domain
- Driver Families
- Bucket
- drivers/md
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
logical-zone.hlogger.hmemory-alloc.hpermassert.hstring-utils.haction-manager.hadmin-state.hblock-map.hcompletion.hconstants.hdata-vio.hflush.hint-map.hphysical-zone.hvdo.h
Detected Declarations
function as_logical_zonefunction get_thread_id_for_zonefunction initialize_zonefunction vdo_make_logical_zonesfunction vdo_free_logical_zonesfunction assert_on_zone_threadfunction check_for_drain_completefunction initiate_drainfunction drain_logical_zonefunction vdo_drain_logical_zonesfunction resume_logical_zonefunction vdo_resume_logical_zonesfunction update_oldest_active_generationfunction vdo_increment_logical_zone_flush_generationfunction vdo_acquire_flush_generation_lockfunction notify_flusherfunction attempt_generation_complete_notificationfunction vdo_release_flush_generation_lockfunction vdo_dump_logical_zone
Annotated Snippet
if (result != VDO_SUCCESS) {
vdo_free_logical_zones(zones);
return result;
}
}
result = vdo_make_action_manager(zones->zone_count, get_thread_id_for_zone,
vdo->thread_config.admin_thread, zones, NULL,
vdo, &zones->manager);
if (result != VDO_SUCCESS) {
vdo_free_logical_zones(zones);
return result;
}
*zones_ptr = zones;
return VDO_SUCCESS;
}
/**
* vdo_free_logical_zones() - Free a set of logical zones.
* @zones: The set of zones to free.
*/
void vdo_free_logical_zones(struct logical_zones *zones)
{
zone_count_t index;
if (zones == NULL)
return;
vdo_free(vdo_forget(zones->manager));
for (index = 0; index < zones->zone_count; index++)
vdo_int_map_free(vdo_forget(zones->zones[index].lbn_operations));
vdo_free(zones);
}
static inline void assert_on_zone_thread(struct logical_zone *zone, const char *what)
{
VDO_ASSERT_LOG_ONLY((vdo_get_callback_thread_id() == zone->thread_id),
"%s() called on correct thread", what);
}
/**
* check_for_drain_complete() - Check whether this zone has drained.
* @zone: The zone to check.
*/
static void check_for_drain_complete(struct logical_zone *zone)
{
if (!vdo_is_state_draining(&zone->state) || zone->notifying ||
!list_empty(&zone->write_vios))
return;
vdo_finish_draining(&zone->state);
}
/** Implements vdo_admin_initiator_fn. */
static void initiate_drain(struct admin_state *state)
{
check_for_drain_complete(container_of(state, struct logical_zone, state));
}
/** Implements vdo_zone_action_fn. */
static void drain_logical_zone(void *context, zone_count_t zone_number,
struct vdo_completion *parent)
{
struct logical_zones *zones = context;
vdo_start_draining(&zones->zones[zone_number].state,
vdo_get_current_manager_operation(zones->manager), parent,
initiate_drain);
}
void vdo_drain_logical_zones(struct logical_zones *zones,
const struct admin_state_code *operation,
struct vdo_completion *parent)
{
vdo_schedule_operation(zones->manager, operation, NULL, drain_logical_zone, NULL,
parent);
}
/** Implements vdo_zone_action_fn. */
static void resume_logical_zone(void *context, zone_count_t zone_number,
struct vdo_completion *parent)
{
struct logical_zone *zone = &(((struct logical_zones *) context)->zones[zone_number]);
vdo_fail_completion(parent, vdo_resume_if_quiescent(&zone->state));
}
Annotation
- Immediate include surface: `logical-zone.h`, `logger.h`, `memory-alloc.h`, `permassert.h`, `string-utils.h`, `action-manager.h`, `admin-state.h`, `block-map.h`.
- Detected declarations: `function as_logical_zone`, `function get_thread_id_for_zone`, `function initialize_zone`, `function vdo_make_logical_zones`, `function vdo_free_logical_zones`, `function assert_on_zone_thread`, `function check_for_drain_complete`, `function initiate_drain`, `function drain_logical_zone`, `function vdo_drain_logical_zones`.
- Atlas domain: Driver Families / drivers/md.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.