Re: [PATCH v6 2/2] block: cancel all throttled bios in del_gendisk()

From: yukuai (C)
Date: Sun Jan 23 2022 - 22:48:26 EST


在 2022/01/12 11:05, Ming Lei 写道:
Hello Yu Kuai,

On Mon, Jan 10, 2022 at 09:47:58PM +0800, Yu Kuai wrote:
Throttled bios can't be issued after del_gendisk() is done, thus
it's better to cancel them immediately rather than waiting for
throttle is done.

For example, if user thread is throttled with low bps while it's
issuing large io, and the device is deleted. The user thread will
wait for a long time for io to return.

Noted this patch is mainly from revertion of commit 32e3374304c7
("blk-throttle: remove tg_drain_bios") and commit b77412372b68
("blk-throttle: remove blk_throtl_drain").

Signed-off-by: Yu Kuai <yukuai3@xxxxxxxxxx>
---
block/blk-throttle.c | 77 ++++++++++++++++++++++++++++++++++++++++++++
block/blk-throttle.h | 2 ++
block/genhd.c | 2 ++
3 files changed, 81 insertions(+)

Just wondering why not take the built-in way in throtl_upgrade_state() for
canceling throttled bios? Something like the following, then we can avoid
to re-invent the wheel.

Hi, Tejun