* [PATCH] dm: fix congested_fn for request-based device
@ 2020-03-03 8:45 Hou Tao
2020-03-03 16:15 ` Mike Snitzer
0 siblings, 1 reply; 3+ messages in thread
From: Hou Tao @ 2020-03-03 8:45 UTC (permalink / raw)
To: dm-devel; +Cc: tj, agk, snitzer
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@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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: dm: fix congested_fn for request-based device
2020-03-03 8:45 [PATCH] dm: fix congested_fn for request-based device Hou Tao
@ 2020-03-03 16:15 ` Mike Snitzer
2020-03-04 0:54 ` Hou Tao
0 siblings, 1 reply; 3+ messages in thread
From: Mike Snitzer @ 2020-03-03 16:15 UTC (permalink / raw)
To: Hou Tao; +Cc: tj, dm-devel, agk
On Tue, Mar 03 2020 at 3:45am -0500,
Hou Tao <houtao1@huawei.com> wrote:
> 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@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)
The above change does indeed fix missing conversion that should've
occurred in commit 4aa9c692e052.
> @@ -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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: dm: fix congested_fn for request-based device
2020-03-03 16:15 ` Mike Snitzer
@ 2020-03-04 0:54 ` Hou Tao
0 siblings, 0 replies; 3+ messages in thread
From: Hou Tao @ 2020-03-04 0:54 UTC (permalink / raw)
To: Mike Snitzer; +Cc: tj, dm-devel, agk
Hi Mike,
On 2020/3/4 0:15, Mike Snitzer wrote:
> On Tue, Mar 03 2020 at 3:45am -0500,
> Hou Tao <houtao1@huawei.com> wrote:
>
>> 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@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)
>
> The above change does indeed fix missing conversion that should've
> occurred in commit 4aa9c692e052.
>
>> @@ -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.
>
Thanks for that.
Regards,
Tao
> 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
>
>
> .
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-03-04 0:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-03 8:45 [PATCH] dm: fix congested_fn for request-based device Hou Tao
2020-03-03 16:15 ` Mike Snitzer
2020-03-04 0:54 ` Hou Tao
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.