Pass the ioc pointer explicitly to hweight_after_donation() instead of deriving it from iocg->ioc. The only caller, ioc_timer_fn(), holds ioc->lock. This change prepares for annotating hweight_after_donation() with __must_hold(&ioc->lock). Clang's context analysis cannot determine that iocg->ioc->lock and the ioc->lock held by ioc_timer_fn() refer to the same spinlock. No functional change is intended since ioc_timer_fn() only passes iocgs from its ioc->active_iocgs list and since iocg->ioc equals ioc for these iocgs. Signed-off-by: Bart Van Assche --- block/blk-iocost.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/block/blk-iocost.c b/block/blk-iocost.c index d4448f335c42..6d348df003a4 100644 --- a/block/blk-iocost.c +++ b/block/blk-iocost.c @@ -1823,10 +1823,10 @@ static void iocg_flush_stat(struct list_head *target_iocgs, struct ioc_now *now) * capacity. @hwm is the upper bound and used to signal no donation. This * function also throws away @iocg's excess budget. */ -static u32 hweight_after_donation(struct ioc_gq *iocg, u32 old_hwi, u32 hwm, - u32 usage, struct ioc_now *now) +static u32 hweight_after_donation(struct ioc *ioc, struct ioc_gq *iocg, + u32 old_hwi, u32 hwm, u32 usage, + struct ioc_now *now) { - struct ioc *ioc = iocg->ioc; u64 vtime = atomic64_read(&iocg->vtime); s64 excess, delta, target, new_hwi; @@ -2424,8 +2424,8 @@ static void ioc_timer_fn(struct timer_list *timer) */ current_hweight(iocg, &hwa, &old_hwi); hwm = current_hweight_max(iocg); - new_hwi = hweight_after_donation(iocg, old_hwi, hwm, - usage, &now); + new_hwi = hweight_after_donation(ioc, iocg, old_hwi, + hwm, usage, &now); /* * Donation calculation assumes hweight_after_donation * to be positive, a condition that a donor w/ hwa < 2