dm: fix congested_fn for request-based device
PATCH 1/1 dm: fix congested_fn for request-based device
We neither assign congested_fn for requested-based blk-mq device nor implement it correctly. So fix both.
--- drivers/md/dm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/md/dm.c +4 -1
@@ -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 :
Signature · 1 line
2.25.0.4.g0ad7144999
Quoted 18 lines · Hou Tao
We neither assign
congested_fnfor 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 <[email protected]>--- drivers/md/dm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/md/dm.c +1
-0@@ -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 =
drivers/md/dm.c static int dm_any_congested(void *congested_data, int bdi_bits) · line 1796
Quoted 10 lines
drivers/md/dm.c +2
-1+ 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)
The above change does indeed fix missing conversion that should've occurred in commit 4aa9c692e052.
drivers/md/dm.c int dm_setup_md_queue(struct mapped_device *md, struct dm_table *t) · line 2273
Quoted 8 lines
drivers/md/dm.c +1
-0@@ -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 :
I've renamed dm_init_normal_md_queue to dm_init_congested_fn and removed it's incorrect comment.
Here is the final fix I just staged:
https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git/commit/?h=dm-5.6&id=974f51e8633f0f3f33e8f86bbb5ae66758aa63c7
Thanks,
Mike
Hi Mike,
Quoted 35 lines · Mike Snitzer
Quoted 18 lines · Hou Tao
We neither assign
congested_fnfor 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 <[email protected]>--- drivers/md/dm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/md/dm.c +1
-0@@ -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 =drivers/md/dm.c static int dm_any_congested(void *congested_data, int bdi_bits) · line 1796
Quoted 10 lines
drivers/md/dm.c +2
-1+ 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)The above change does indeed fix missing conversion that should've occurred in commit
4aa9c692e052.
Quoted 12 lines
drivers/md/dm.c int dm_setup_md_queue(struct mapped_device *md, struct dm_table *t) · line 2273
Quoted 8 lines
drivers/md/dm.c +1
-0@@ -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 :I've renamed
dm_init_normal_md_queuetodm_init_congested_fnand removed it's incorrect comment.
Thanks for that.
Regards,
Tao
Quoted 9 lines
Here is the final fix I just staged:
https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git/commit/?h=dm-5.6&id=974f51e8633f0f3f33e8f86bbb5ae66758aa63c7Thanks,
Mike.