elevator: add new field flags in struct elevator_queue

There are only one flag to indicate that elevator is registered currently,
prepare to add a flag to disable wbt if default elevator is bfq.

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20221019121518.3865235-6-yukuai1@huaweicloud.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Yu Kuai 2022-10-19 20:15:17 +08:00 committed by Jens Axboe
parent 3642ef4d95
commit 181d066374
2 changed files with 5 additions and 5 deletions

View File

@ -512,7 +512,7 @@ int elv_register_queue(struct request_queue *q, bool uevent)
if (uevent)
kobject_uevent(&e->kobj, KOBJ_ADD);
e->registered = 1;
set_bit(ELEVATOR_FLAG_REGISTERED, &e->flags);
}
return error;
}
@ -523,11 +523,9 @@ void elv_unregister_queue(struct request_queue *q)
lockdep_assert_held(&q->sysfs_lock);
if (e && e->registered) {
if (e && test_and_clear_bit(ELEVATOR_FLAG_REGISTERED, &e->flags)) {
kobject_uevent(&e->kobj, KOBJ_REMOVE);
kobject_del(&e->kobj);
e->registered = 0;
}
}

View File

@ -100,10 +100,12 @@ struct elevator_queue
void *elevator_data;
struct kobject kobj;
struct mutex sysfs_lock;
unsigned int registered:1;
unsigned long flags;
DECLARE_HASHTABLE(hash, ELV_HASH_BITS);
};
#define ELEVATOR_FLAG_REGISTERED 0
/*
* block elevator interface
*/