Skip to content

Commit

Permalink
block: move blk_queue_registered() check into elv_iosched_store()
Browse files Browse the repository at this point in the history
Move blk_queue_registered() check into elv_iosched_store() and prepare
for using elevator_change() for covering any kind of elevator change in
adding/deleting disk and updating nr_hw_queue.

Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Nilay Shroff <nilay@linux.ibm.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20250505141805.2751237-13-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Ming Lei authored and Jens Axboe committed May 6, 2025
1 parent 1bb7fba commit ac55b71
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions block/elevator.c
Original file line number Diff line number Diff line change
Expand Up @@ -676,10 +676,6 @@ int elevator_switch(struct request_queue *q, const char *name)
*/
static int elevator_change(struct request_queue *q, const char *elevator_name)
{
/* Make sure queue is not in the middle of being removed */
if (!blk_queue_registered(q))
return -ENOENT;

if (q->elevator && elevator_match(q->elevator->type, elevator_name))
return 0;

Expand Down Expand Up @@ -708,6 +704,10 @@ ssize_t elv_iosched_store(struct gendisk *disk, const char *buf,
struct request_queue *q = disk->queue;
struct blk_mq_tag_set *set = q->tag_set;

/* Make sure queue is not in the middle of being removed */
if (!blk_queue_registered(q))
return -ENOENT;

/*
* If the attribute needs to load a module, do it before freezing the
* queue to ensure that the module file can be read when the request
Expand Down

0 comments on commit ac55b71

Please sign in to comment.