[dm-devel] [PATCH] dm: fix congested_fn for request-based device

Hou Tao houtao1 at huawei.com
Tue Mar 3 08:45:01 UTC 2020


We neither assign congested_fn for requested-based blk-mq device
nor implement it correctly. So fix both.

Fixes: 4aa9c692e052 ("bdi: separate out congested state into a separate struct")
Signed-off-by: Hou Tao <houtao1 at huawei.com>
---
 drivers/md/dm.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index b89f07ee2eff..80b95e21db43 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1784,11 +1784,13 @@ static int dm_any_congested(void *congested_data, int bdi_bits)
 
 	if (!test_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags)) {
 		if (dm_request_based(md)) {
+			struct backing_dev_info *bdi =
+				md->queue->backing_dev_info;
 			/*
 			 * With request-based DM we only need to check the
 			 * top-level queue for congestion.
 			 */
-			r = md->queue->backing_dev_info->wb.state & bdi_bits;
+			r = bdi->wb.congested->state & bdi_bits;
 		} else {
 			map = dm_get_live_table_fast(md);
 			if (map)
@@ -2265,6 +2267,7 @@ int dm_setup_md_queue(struct mapped_device *md, struct dm_table *t)
 			DMERR("Cannot initialize queue for request-based dm-mq mapped device");
 			return r;
 		}
+		dm_init_normal_md_queue(md);
 		break;
 	case DM_TYPE_BIO_BASED:
 	case DM_TYPE_DAX_BIO_BASED:
-- 
2.25.0.4.g0ad7144999





More information about the dm-devel mailing list