]> git.baikalelectronics.ru Git - kernel.git/commit
blk-iocost: grab ioc->lock for debt handling
authorTejun Heo <tj@kernel.org>
Tue, 1 Sep 2020 18:52:42 +0000 (14:52 -0400)
committerJens Axboe <axboe@kernel.dk>
Wed, 2 Sep 2020 01:38:32 +0000 (19:38 -0600)
commit006cfbc1db58a5104e54caefab2bbfb73d3e28a0
tree9bc64072204d09302f96aa71d088a4f5646c1eee
parent89e640cff9a24da3935ba8657348f7059afa5efd
blk-iocost: grab ioc->lock for debt handling

Currently, debt handling requires only iocg->waitq.lock. In the future, we
want to adjust and propagate inuse changes depending on debt status. Let's
grab ioc->lock in debt handling paths in preparation.

* Because ioc->lock nests outside iocg->waitq.lock, the decision to grab
  ioc->lock needs to be made before entering the critical sections.

* Add and use iocg_[un]lock() which handles the conditional double locking.

* Add @pay_debt to iocg_kick_waitq() so that debt payment happens only when
  the caller grabbed both locks.

This patch is prepatory and the comments contain references to future
changes.

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-iocost.c