diff options
| author | Nilay Shroff <nilay@linux.ibm.com> | 2025-11-13 14:28:18 +0530 |
|---|---|---|
| committer | Jens Axboe <axboe@kernel.dk> | 2025-11-13 09:27:49 -0700 |
| commit | 232143b605387b372dee0ec7830f93b93df5f67d (patch) | |
| tree | 0a68492c431dc740e995e01ab33a9678b99c77ee /block/elevator.h | |
| parent | c3f42a6de708db6891879547b29cd0d84ad83c92 (diff) | |
| download | linux-232143b605387b372dee0ec7830f93b93df5f67d.tar.gz linux-232143b605387b372dee0ec7830f93b93df5f67d.tar.bz2 linux-232143b605387b372dee0ec7830f93b93df5f67d.zip | |
block: unify elevator tags and type xarrays into struct elv_change_ctx
Currently, the nr_hw_queues update path manages two disjoint xarrays —
one for elevator tags and another for elevator type — both used during
elevator switching. Maintaining these two parallel structures for the
same purpose adds unnecessary complexity and potential for mismatched
state.
This patch unifies both xarrays into a single structure, struct
elv_change_ctx, which holds all per-queue elevator change context. A
single xarray, named elv_tbl, now maps each queue (q->id) in a tagset
to its corresponding elv_change_ctx entry, encapsulating the elevator
tags, type and name references.
This unification simplifies the code, improves maintainability, and
clarifies ownership of per-queue elevator state.
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Yu Kuai <yukuai@fnnas.com>
Signed-off-by: Nilay Shroff <nilay@linux.ibm.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/elevator.h')
| -rw-r--r-- | block/elevator.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/block/elevator.h b/block/elevator.h index c4d20155065e..bad43182361e 100644 --- a/block/elevator.h +++ b/block/elevator.h @@ -32,6 +32,21 @@ struct elevator_tags { struct blk_mq_tags *tags[]; }; +/* Holding context data for changing elevator */ +struct elv_change_ctx { + const char *name; + bool no_uevent; + + /* for unregistering old elevator */ + struct elevator_queue *old; + /* for registering new elevator */ + struct elevator_queue *new; + /* store elevator type */ + struct elevator_type *type; + /* holds sched tags data */ + struct elevator_tags *et; +}; + struct elevator_mq_ops { int (*init_sched)(struct request_queue *, struct elevator_queue *); void (*exit_sched)(struct elevator_queue *); |
