block/bfq-wf2q.c
Source file repositories/reference/linux-study-clean/block/bfq-wf2q.c
File Facts
- System
- Linux kernel
- Corpus path
block/bfq-wf2q.c- Extension
.c- Size
- 53678 bytes
- Lines
- 1702
- Domain
- Representative Device Path
- Bucket
- PCIe NVMe Storage Path
- Inferred role
- Representative Device Path: implementation source
- Status
- source implementation candidate
Why This File Exists
Part of the selected hardware vertical slice: PCI discovery, driver binding, NVMe queues, block requests, DMA, interrupts, and completion.
- Part of the selected hardware vertical slice: PCI discovery, driver binding, NVMe queues, block requests, DMA, interrupts, and completion.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
bfq-iosched.h
Detected Declarations
function queuesfunction bfq_class_idxfunction bfq_tot_busy_queuesfunction bfq_update_next_in_servicefunction bfq_update_parent_budgetfunction bfq_no_longer_next_in_servicefunction bfq_inc_active_entitiesfunction bfq_dec_active_entitiesfunction bfq_update_parent_budgetfunction bfq_no_longer_next_in_servicefunction bfq_inc_active_entitiesfunction bfq_deltafunction bfq_calc_finishfunction bfq_extractfunction bfq_idle_extractfunction bfq_insertfunction bfq_update_minfunction bfq_update_active_nodefunction bfq_update_active_treefunction childrenfunction bfq_ioprio_to_weightfunction weightsfunction bfq_get_entityfunction bfq_active_extractfunction bfq_idle_insertfunction queuefunction bfq_put_idle_entityfunction bfq_forget_idlefunction __bfq_entity_update_weight_priofunction bfq_bfqq_servedfunction bfq_bfqq_charge_timefunction bfq_update_fin_time_enqueuefunction entityfunction __bfq_activate_entityfunction treefunction __bfq_activate_requeue_entityfunction bfq_activate_requeue_entityfunction __bfq_deactivate_entityfunction bfq_deactivate_entityfunction for_each_entity_safefunction bfq_calc_vtime_jumpfunction bfq_update_vtimefunction eligiblefunction entityfunction classfunction next_queue_may_preemptfunction __bfq_bfqd_reset_in_servicefunction represents
Annotated Snippet
if (next_in_service) {
unsigned int new_entity_class_idx =
bfq_class_idx(new_entity);
struct bfq_service_tree *st =
sd->service_tree + new_entity_class_idx;
change_without_lookup =
(new_entity_class_idx ==
bfq_class_idx(next_in_service)
&&
!bfq_gt(new_entity->start, st->vtime)
&&
bfq_gt(next_in_service->finish,
new_entity->finish));
}
if (change_without_lookup)
next_in_service = new_entity;
}
if (!change_without_lookup) /* lookup needed */
next_in_service = bfq_lookup_next_entity(sd, expiration);
if (next_in_service) {
bool new_budget_triggers_change =
bfq_update_parent_budget(next_in_service);
parent_sched_may_change = !sd->next_in_service ||
new_budget_triggers_change;
}
sd->next_in_service = next_in_service;
return parent_sched_may_change;
}
#ifdef CONFIG_BFQ_GROUP_IOSCHED
/*
* Returns true if this budget changes may let next_in_service->parent
* become the next_in_service entity for its parent entity.
*/
static bool bfq_update_parent_budget(struct bfq_entity *next_in_service)
{
struct bfq_entity *bfqg_entity;
struct bfq_group *bfqg;
struct bfq_sched_data *group_sd;
bool ret = false;
group_sd = next_in_service->sched_data;
bfqg = container_of(group_sd, struct bfq_group, sched_data);
/*
* bfq_group's my_entity field is not NULL only if the group
* is not the root group. We must not touch the root entity
* as it must never become an in-service entity.
*/
bfqg_entity = bfqg->my_entity;
if (bfqg_entity) {
if (bfqg_entity->budget > next_in_service->budget)
ret = true;
bfqg_entity->budget = next_in_service->budget;
}
return ret;
}
/*
* This function tells whether entity stops being a candidate for next
* service, according to the restrictive definition of the field
* next_in_service. In particular, this function is invoked for an
* entity that is about to be set in service.
*
* If entity is a queue, then the entity is no longer a candidate for
* next service according to the that definition, because entity is
* about to become the in-service queue. This function then returns
* true if entity is a queue.
*
* In contrast, entity could still be a candidate for next service if
* it is not a queue, and has more than one active child. In fact,
* even if one of its children is about to be set in service, other
* active children may still be the next to serve, for the parent
* entity, even according to the above definition. As a consequence, a
* non-queue entity is not a candidate for next-service only if it has
* only one active child. And only if this condition holds, then this
* function returns true for a non-queue entity.
*/
static bool bfq_no_longer_next_in_service(struct bfq_entity *entity)
{
struct bfq_group *bfqg;
Annotation
- Immediate include surface: `bfq-iosched.h`.
- Detected declarations: `function queues`, `function bfq_class_idx`, `function bfq_tot_busy_queues`, `function bfq_update_next_in_service`, `function bfq_update_parent_budget`, `function bfq_no_longer_next_in_service`, `function bfq_inc_active_entities`, `function bfq_dec_active_entities`, `function bfq_update_parent_budget`, `function bfq_no_longer_next_in_service`.
- Atlas domain: Representative Device Path / PCIe NVMe Storage Path.
- 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.