On Mon, Apr 19, 2021 at 08:05:46PM +0800, JeffleXu wrote: > > > On 4/15/21 6:33 PM, Ming Lei wrote: > > For bio based request queue, the queue usage refcnt is only grabbed > > during submission, which isn't consistent with request base queue. > > > > Queue freezing has been used widely, and turns out it is very useful > > to quiesce queue activity. > > > > Support to freeze bio based request queue by the following approach: > > > > 1) grab two queue usage refcount for blk-mq before submitting blk-mq > > bio, one is for bio, anther is for request; > > > Hi, I can't understand the sense of grabbing two refcounts on the > @q_usage_count of the underlying blk-mq device, while > @q_usage_count of the MD/DM device is kept untouched. Follows the point: 1) for blk-mq, we hold one refcount for bio and another for request, and release one after ending bio or completing request. 2) for bio based queue, just holding one refcount for bio, and release it after the bio is ended. As I mentioned to you, the current in-tree code only grabs the refcount during submitting bio for bio base queue, and the refcount is released after returning from submission, see __submit_bio(). > > In the following calling stack > > ``` > queue_poll_store > blk_mq_freeze_queue(q) > ``` > > Is the input @q still the request queue of MD/DM device? It can be either one after bio based io polling is supported, queue/io_poll is exposed for both blk-mq and bio based queue. However, I guess bio based polling doesn't need such strict bio queue freezing, cause QUEUE_FLAG_POLL is only read in submission path, so looks current freezing just during submission is enough. Thanks, Ming