# \[Question\] Question on blk\_freeze\_queue()

- From: JeffleXu \<hidden\>
- Date: 2021-02-23 07:13:36 
- List: linux-block
- Page: https://ratatoskr.run/linux-block/2021/02/6401059
- Thread: https://ratatoskr.run/linux-block/2021/02/6401059/t.md

````text
Hi,

I have some questions on blk_freeze_queue() and related functions. I
would appreciate if someone could help me.

There's only blk_mq_unfreeze_queue(), without blk_XXX version (e.g.,
blk_unfreeze_queue()).

As the comment (introduced by commit
3ef28e83ab15799742e55fd13243a5f678b04242 ("block: generic request_queue
reference counting")) of blk_freeze_queue says:

```
void blk_freeze_queue(struct request_queue *q)
{
	/*
	 * In the !blk_mq case we are only calling this to kill the
	 * q_usage_counter, otherwise this increases the freeze depth
	 * and waits for it to return to zero.  For this reason there is
	 * no blk_unfreeze_queue(), and blk_freeze_queue() is not
	 * exported to drivers as the only user for unfreeze is blk_mq.
	 */
	blk_freeze_queue_start(q);
	blk_mq_freeze_queue_wait(q);
}
```

I can't understand why blk_unfreeze_queue() is unnecessary for bio-based
devices, in other words, why q->mq_freeze_depth won't be greater than 1
in blk_freeze_queue_start() for !blk_mq cases. Is that because in
!blk_mq cases (bio-based devices, e.g., dm), blk_freeze_queue() won't be
called in a nested way?

If that's the case, then I can see
blk_mq_freeze_queue()/blk_mq_unfreeze_queue() are used in pair in
blk-iolatency.c:iolatency_set_limit() and
blk-sysfs.c:queue_wb_lat_store(), for example. Though I'm not familiar
with iolatency or wbt, an intuition shows that they shall also apply to
bio-based devices (e.g., dm). Please let me know if I'm wrong.


-- 
Thanks,
Jeffle
````
