Re: [PATCH 1/2] blk-mq: add two interfaces to lock/unlock blk_mq_tags->lock
From: Bart Van Assche <bvanassche@acm.org>
Date: 2021-08-08 16:44:47
Also in:
lkml
From: Bart Van Assche <bvanassche@acm.org>
Date: 2021-08-08 16:44:47
Also in:
lkml
On 8/7/21 8:17 PM, Yu Kuai wrote:
+void blk_mq_tags_lock(struct blk_mq_tags *tags, unsigned long *flags)
+{
+ spin_lock_irqsave(&tags->lock, *flags);
+}
+EXPORT_SYMBOL(blk_mq_tags_lock);
+
+void blk_mq_tags_unlock(struct blk_mq_tags *tags, unsigned long *flags)
+{
+ spin_unlock_irqrestore(&tags->lock, *flags);
+}
+EXPORT_SYMBOL(blk_mq_tags_unlock);The tag map lock is an implementation detail and hence this lock must not be used directly by block drivers. I propose to introduce and export a new function to block drivers that does the following: * Lock tags->lock. * Call blk_mq_tag_to_rq(). * Check whether the request is in the started state. If so, increment its reference count. * Unlock tags->lock. Thanks, Bart.