Thanks for your advice, I will send a new patch soon.
在 2023/8/8 0:05, Michal Koutný 写道:
Hello.
On Fri, Aug 04, 2023 at 07:36:59PM +0800, Li Lingfeng <lilingfeng@xxxxxxxxxxxxxxx> wrote:
From: Li Lingfeng <lilingfeng3@xxxxxxxxxx>
Commit a13696b83da4 ("blk-iolatency: Make initialization lazy") adds
a mutex named "init_mutex" in blk_iolatency_try_init for the race
condition of initializing RQ_QOS_LATENCY.
Now a new lock has been add to struct request_queue by commit a13bd91be223
("block/rq_qos: protect rq_qos apis with a new lock"). And it has been
held in blkg_conf_open_bdev before calling blk_iolatency_init.
So it's not necessary to keep init_mutex in blk_iolatency_try_init, just
remove it.
I'm looking at ioc_cost_model_write() or ioc_qos_write() where is
a similar pattern.
Could the check+init be open-coded back to iolatency_set_limit() to make
code more regular?
Michal