linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] block: keep bdi->io_pages in sync with max_sectors_kb for stacked devices
@ 2020-02-28 14:51 Konstantin Khlebnikov
  2020-03-02 10:41 ` Paul Menzel
  2020-03-02 12:16 ` Bob Liu
  0 siblings, 2 replies; 6+ messages in thread
From: Konstantin Khlebnikov @ 2020-02-28 14:51 UTC (permalink / raw)
  To: linux-block, Jens Axboe, linux-kernel
  Cc: linux-raid, Song Liu, Dmitry Monakhov

Field bdi->io_pages added in commit 9491ae4aade6 ("mm: don't cap request
size based on read-ahead setting") removes unneeded split of read requests.

Stacked drivers do not call blk_queue_max_hw_sectors(). Instead they setup
limits of their devices by blk_set_stacking_limits() + disk_stack_limits().
Field bio->io_pages stays zero until user set max_sectors_kb via sysfs.

This patch updates io_pages after merging limits in disk_stack_limits().

Commit c6d6e9b0f6b4 ("dm: do not allow readahead to limit IO size") fixed
the same problem for device-mapper devices, this one fixes MD RAIDs.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
---
 block/blk-settings.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/block/blk-settings.c b/block/blk-settings.c
index c8eda2e7b91e..66c45fd79545 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -664,6 +664,8 @@ void disk_stack_limits(struct gendisk *disk, struct block_device *bdev,
 		printk(KERN_NOTICE "%s: Warning: Device %s is misaligned\n",
 		       top, bottom);
 	}
+
+	t->backing_dev_info->io_pages = t->limits.max_sectors >> (PAGE_SHIFT-9);
 }
 EXPORT_SYMBOL(disk_stack_limits);
 


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] block: keep bdi->io_pages in sync with max_sectors_kb for stacked devices
  2020-02-28 14:51 [PATCH] block: keep bdi->io_pages in sync with max_sectors_kb for stacked devices Konstantin Khlebnikov
@ 2020-03-02 10:41 ` Paul Menzel
  2020-03-02 10:51   ` Konstantin Khlebnikov
  2020-03-02 12:16 ` Bob Liu
  1 sibling, 1 reply; 6+ messages in thread
From: Paul Menzel @ 2020-03-02 10:41 UTC (permalink / raw)
  To: Konstantin Khlebnikov, linux-block, Jens Axboe, linux-kernel
  Cc: linux-raid, Song Liu, Dmitry Monakhov

[-- Attachment #1: Type: text/plain, Size: 1597 bytes --]

Dear Konstantin,


Thank you for the patch.


On 2020-02-28 15:51, Konstantin Khlebnikov wrote:
> Field bdi->io_pages added in commit 9491ae4aade6 ("mm: don't cap request
> size based on read-ahead setting") removes unneeded split of read requests.
> 
> Stacked drivers do not call blk_queue_max_hw_sectors(). Instead they setup

The verb is spelled with a space *set up*.

> limits of their devices by blk_set_stacking_limits() + disk_stack_limits().
> Field bio->io_pages stays zero until user set max_sectors_kb via sysfs.
> 
> This patch updates io_pages after merging limits in disk_stack_limits().
> 
> Commit c6d6e9b0f6b4 ("dm: do not allow readahead to limit IO size") fixed
> the same problem for device-mapper devices, this one fixes MD RAIDs.

Add a Fixes: tag?

Fixes: 9491ae4aade6 ("mm: don't cap request size based on read-ahead setting")

> Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
> ---
>  block/blk-settings.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/block/blk-settings.c b/block/blk-settings.c
> index c8eda2e7b91e..66c45fd79545 100644
> --- a/block/blk-settings.c
> +++ b/block/blk-settings.c
> @@ -664,6 +664,8 @@ void disk_stack_limits(struct gendisk *disk, struct block_device *bdev,
>  		printk(KERN_NOTICE "%s: Warning: Device %s is misaligned\n",
>  		       top, bottom);
>  	}
> +
> +	t->backing_dev_info->io_pages = t->limits.max_sectors >> (PAGE_SHIFT-9);
>  }
>  EXPORT_SYMBOL(disk_stack_limits);

Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>


Kind regards,

Paul


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 5174 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] block: keep bdi->io_pages in sync with max_sectors_kb for stacked devices
  2020-03-02 10:41 ` Paul Menzel
@ 2020-03-02 10:51   ` Konstantin Khlebnikov
  0 siblings, 0 replies; 6+ messages in thread
From: Konstantin Khlebnikov @ 2020-03-02 10:51 UTC (permalink / raw)
  To: Paul Menzel, linux-block, Jens Axboe, linux-kernel
  Cc: linux-raid, Song Liu, Dmitry Monakhov

On 02/03/2020 13.41, Paul Menzel wrote:
> Dear Konstantin,
> 
> 
> Thank you for the patch.
> 
> 
> On 2020-02-28 15:51, Konstantin Khlebnikov wrote:
>> Field bdi->io_pages added in commit 9491ae4aade6 ("mm: don't cap request
>> size based on read-ahead setting") removes unneeded split of read requests.
>>
>> Stacked drivers do not call blk_queue_max_hw_sectors(). Instead they setup
> 
> The verb is spelled with a space *set up*.
> 
>> limits of their devices by blk_set_stacking_limits() + disk_stack_limits().
>> Field bio->io_pages stays zero until user set max_sectors_kb via sysfs.
>>
>> This patch updates io_pages after merging limits in disk_stack_limits().
>>
>> Commit c6d6e9b0f6b4 ("dm: do not allow readahead to limit IO size") fixed
>> the same problem for device-mapper devices, this one fixes MD RAIDs.
> 
> Add a Fixes: tag?
> 
> Fixes: 9491ae4aade6 ("mm: don't cap request size based on read-ahead setting")

Maybe, but this isn't fatal bug. Just incomplete fix.

Same problem exists for non-disk BDIs. I.e. network filesystem must
set io_pages manually if doesn't want split read requests.

> 
>> Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
>> ---
>>   block/blk-settings.c |    2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/block/blk-settings.c b/block/blk-settings.c
>> index c8eda2e7b91e..66c45fd79545 100644
>> --- a/block/blk-settings.c
>> +++ b/block/blk-settings.c
>> @@ -664,6 +664,8 @@ void disk_stack_limits(struct gendisk *disk, struct block_device *bdev,
>>   		printk(KERN_NOTICE "%s: Warning: Device %s is misaligned\n",
>>   		       top, bottom);
>>   	}
>> +
>> +	t->backing_dev_info->io_pages = t->limits.max_sectors >> (PAGE_SHIFT-9);
>>   }
>>   EXPORT_SYMBOL(disk_stack_limits);
> 
> Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
> 
> 
> Kind regards,
> 
> Paul
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] block: keep bdi->io_pages in sync with max_sectors_kb for stacked devices
  2020-02-28 14:51 [PATCH] block: keep bdi->io_pages in sync with max_sectors_kb for stacked devices Konstantin Khlebnikov
  2020-03-02 10:41 ` Paul Menzel
@ 2020-03-02 12:16 ` Bob Liu
  2020-03-10 21:40   ` Song Liu
  1 sibling, 1 reply; 6+ messages in thread
From: Bob Liu @ 2020-03-02 12:16 UTC (permalink / raw)
  To: Konstantin Khlebnikov, linux-block, Jens Axboe, linux-kernel
  Cc: linux-raid, Song Liu, Dmitry Monakhov

On 2/28/20 10:51 PM, Konstantin Khlebnikov wrote:
> Field bdi->io_pages added in commit 9491ae4aade6 ("mm: don't cap request
> size based on read-ahead setting") removes unneeded split of read requests.
> 
> Stacked drivers do not call blk_queue_max_hw_sectors(). Instead they setup
> limits of their devices by blk_set_stacking_limits() + disk_stack_limits().
> Field bio->io_pages stays zero until user set max_sectors_kb via sysfs.
> 
> This patch updates io_pages after merging limits in disk_stack_limits().
> 
> Commit c6d6e9b0f6b4 ("dm: do not allow readahead to limit IO size") fixed
> the same problem for device-mapper devices, this one fixes MD RAIDs.
> 
> Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
> ---
>  block/blk-settings.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/block/blk-settings.c b/block/blk-settings.c
> index c8eda2e7b91e..66c45fd79545 100644
> --- a/block/blk-settings.c
> +++ b/block/blk-settings.c
> @@ -664,6 +664,8 @@ void disk_stack_limits(struct gendisk *disk, struct block_device *bdev,
>  		printk(KERN_NOTICE "%s: Warning: Device %s is misaligned\n",
>  		       top, bottom);
>  	}
> +
> +	t->backing_dev_info->io_pages = t->limits.max_sectors >> (PAGE_SHIFT-9);
>  }
>  EXPORT_SYMBOL(disk_stack_limits);
>  
> 

Nitpick.. (PAGE_SHIFT - 9)
Reviewed-by: Bob Liu <bob.liu@oracle.com>



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] block: keep bdi->io_pages in sync with max_sectors_kb for stacked devices
  2020-03-02 12:16 ` Bob Liu
@ 2020-03-10 21:40   ` Song Liu
  2020-03-12 13:40     ` Jens Axboe
  0 siblings, 1 reply; 6+ messages in thread
From: Song Liu @ 2020-03-10 21:40 UTC (permalink / raw)
  To: Bob Liu
  Cc: Konstantin Khlebnikov, linux-block, Jens Axboe, open list,
	linux-raid, Dmitry Monakhov

On Mon, Mar 2, 2020 at 4:16 AM Bob Liu <bob.liu@oracle.com> wrote:
>
> On 2/28/20 10:51 PM, Konstantin Khlebnikov wrote:
> > Field bdi->io_pages added in commit 9491ae4aade6 ("mm: don't cap request
> > size based on read-ahead setting") removes unneeded split of read requests.
> >
> > Stacked drivers do not call blk_queue_max_hw_sectors(). Instead they setup
> > limits of their devices by blk_set_stacking_limits() + disk_stack_limits().
> > Field bio->io_pages stays zero until user set max_sectors_kb via sysfs.
> >
> > This patch updates io_pages after merging limits in disk_stack_limits().
> >
> > Commit c6d6e9b0f6b4 ("dm: do not allow readahead to limit IO size") fixed
> > the same problem for device-mapper devices, this one fixes MD RAIDs.
> >
> > Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
> > ---
> >  block/blk-settings.c |    2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/block/blk-settings.c b/block/blk-settings.c
> > index c8eda2e7b91e..66c45fd79545 100644
> > --- a/block/blk-settings.c
> > +++ b/block/blk-settings.c
> > @@ -664,6 +664,8 @@ void disk_stack_limits(struct gendisk *disk, struct block_device *bdev,
> >               printk(KERN_NOTICE "%s: Warning: Device %s is misaligned\n",
> >                      top, bottom);
> >       }
> > +
> > +     t->backing_dev_info->io_pages = t->limits.max_sectors >> (PAGE_SHIFT-9);
> >  }
> >  EXPORT_SYMBOL(disk_stack_limits);
> >
> >
>
> Nitpick.. (PAGE_SHIFT - 9)
> Reviewed-by: Bob Liu <bob.liu@oracle.com>

Thanks for the fix. I fixed it based on the comments and applied it to md-next.

Jens, I picked the patch to md-next because md is the only user of
disk_stack_limits().

Please let me know if you prefer routing it via the block tree.

Thanks,
Song

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] block: keep bdi->io_pages in sync with max_sectors_kb for stacked devices
  2020-03-10 21:40   ` Song Liu
@ 2020-03-12 13:40     ` Jens Axboe
  0 siblings, 0 replies; 6+ messages in thread
From: Jens Axboe @ 2020-03-12 13:40 UTC (permalink / raw)
  To: Song Liu, Bob Liu
  Cc: Konstantin Khlebnikov, linux-block, open list, linux-raid,
	Dmitry Monakhov

On 3/10/20 3:40 PM, Song Liu wrote:
> On Mon, Mar 2, 2020 at 4:16 AM Bob Liu <bob.liu@oracle.com> wrote:
>>
>> On 2/28/20 10:51 PM, Konstantin Khlebnikov wrote:
>>> Field bdi->io_pages added in commit 9491ae4aade6 ("mm: don't cap request
>>> size based on read-ahead setting") removes unneeded split of read requests.
>>>
>>> Stacked drivers do not call blk_queue_max_hw_sectors(). Instead they setup
>>> limits of their devices by blk_set_stacking_limits() + disk_stack_limits().
>>> Field bio->io_pages stays zero until user set max_sectors_kb via sysfs.
>>>
>>> This patch updates io_pages after merging limits in disk_stack_limits().
>>>
>>> Commit c6d6e9b0f6b4 ("dm: do not allow readahead to limit IO size") fixed
>>> the same problem for device-mapper devices, this one fixes MD RAIDs.
>>>
>>> Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
>>> ---
>>>  block/blk-settings.c |    2 ++
>>>  1 file changed, 2 insertions(+)
>>>
>>> diff --git a/block/blk-settings.c b/block/blk-settings.c
>>> index c8eda2e7b91e..66c45fd79545 100644
>>> --- a/block/blk-settings.c
>>> +++ b/block/blk-settings.c
>>> @@ -664,6 +664,8 @@ void disk_stack_limits(struct gendisk *disk, struct block_device *bdev,
>>>               printk(KERN_NOTICE "%s: Warning: Device %s is misaligned\n",
>>>                      top, bottom);
>>>       }
>>> +
>>> +     t->backing_dev_info->io_pages = t->limits.max_sectors >> (PAGE_SHIFT-9);
>>>  }
>>>  EXPORT_SYMBOL(disk_stack_limits);
>>>
>>>
>>
>> Nitpick.. (PAGE_SHIFT - 9)
>> Reviewed-by: Bob Liu <bob.liu@oracle.com>
> 
> Thanks for the fix. I fixed it based on the comments and applied it to md-next.
> 
> Jens, I picked the patch to md-next because md is the only user of
> disk_stack_limits().
> 
> Please let me know if you prefer routing it via the block tree.

That's fine, thanks.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-03-12 13:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-28 14:51 [PATCH] block: keep bdi->io_pages in sync with max_sectors_kb for stacked devices Konstantin Khlebnikov
2020-03-02 10:41 ` Paul Menzel
2020-03-02 10:51   ` Konstantin Khlebnikov
2020-03-02 12:16 ` Bob Liu
2020-03-10 21:40   ` Song Liu
2020-03-12 13:40     ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).