Linux RAID subsystem development
 help / color / mirror / Atom feed
* [PATCH 1/1] Don't set discard sectors for request queue
@ 2022-11-01  5:08 Xiao Ni
  2022-11-01 20:21 ` Song Liu
  0 siblings, 1 reply; 4+ messages in thread
From: Xiao Ni @ 2022-11-01  5:08 UTC (permalink / raw)
  To: song; +Cc: yi.zhang, ming.lei, linux-raid

It should use disk_stack_limits to get a proper max_discard_sectors
rather than setting a value by stack drivers.

And there is a bug. If all member disks are rotational devices,
raid0/raid10 set max_discard_sectors. So the member devices are
not ssd/nvme, but raid0/raid10 export the wrong value. It reports
warning messages in function __blkdev_issue_discard when mkfs.xfs

Signed-off-by: Xiao Ni <xni@redhat.com>
Reported-by: Yi Zhang <yi.zhang@redhat.com>
---
 drivers/md/raid0.c  | 1 -
 drivers/md/raid10.c | 2 --
 2 files changed, 3 deletions(-)

diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index aced0ad8cdab..9d4831ca802c 100644
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -398,7 +398,6 @@ static int raid0_run(struct mddev *mddev)
 
 		blk_queue_max_hw_sectors(mddev->queue, mddev->chunk_sectors);
 		blk_queue_max_write_zeroes_sectors(mddev->queue, mddev->chunk_sectors);
-		blk_queue_max_discard_sectors(mddev->queue, UINT_MAX);
 
 		blk_queue_io_min(mddev->queue, mddev->chunk_sectors << 9);
 		blk_queue_io_opt(mddev->queue,
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 3aa8b6e11d58..9a6503f5cb98 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -4145,8 +4145,6 @@ static int raid10_run(struct mddev *mddev)
 	conf->thread = NULL;
 
 	if (mddev->queue) {
-		blk_queue_max_discard_sectors(mddev->queue,
-					      UINT_MAX);
 		blk_queue_max_write_zeroes_sectors(mddev->queue, 0);
 		blk_queue_io_min(mddev->queue, mddev->chunk_sectors << 9);
 		raid10_set_io_opt(conf);
-- 
2.32.0 (Apple Git-132)


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

* Re: [PATCH 1/1] Don't set discard sectors for request queue
  2022-11-01  5:08 [PATCH 1/1] Don't set discard sectors for request queue Xiao Ni
@ 2022-11-01 20:21 ` Song Liu
  2022-11-01 23:44   ` Xiao Ni
  0 siblings, 1 reply; 4+ messages in thread
From: Song Liu @ 2022-11-01 20:21 UTC (permalink / raw)
  To: Xiao Ni; +Cc: yi.zhang, ming.lei, linux-raid

On Mon, Oct 31, 2022 at 10:08 PM Xiao Ni <xni@redhat.com> wrote:

Please update the subject as md/raid0, raid10: xxx.

>
> It should use disk_stack_limits to get a proper max_discard_sectors
> rather than setting a value by stack drivers.
>
> And there is a bug. If all member disks are rotational devices,
> raid0/raid10 set max_discard_sectors. So the member devices are
> not ssd/nvme, but raid0/raid10 export the wrong value. It reports
> warning messages in function __blkdev_issue_discard when mkfs.xfs

Please provide more information about this bug: the warning message,
the impact, etc. in the commit log.

>
> Signed-off-by: Xiao Ni <xni@redhat.com>
> Reported-by: Yi Zhang <yi.zhang@redhat.com>

Thanks,
Song

> ---
>  drivers/md/raid0.c  | 1 -
>  drivers/md/raid10.c | 2 --
>  2 files changed, 3 deletions(-)
>
> diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
> index aced0ad8cdab..9d4831ca802c 100644
> --- a/drivers/md/raid0.c
> +++ b/drivers/md/raid0.c
> @@ -398,7 +398,6 @@ static int raid0_run(struct mddev *mddev)
>
>                 blk_queue_max_hw_sectors(mddev->queue, mddev->chunk_sectors);
>                 blk_queue_max_write_zeroes_sectors(mddev->queue, mddev->chunk_sectors);
> -               blk_queue_max_discard_sectors(mddev->queue, UINT_MAX);
>
>                 blk_queue_io_min(mddev->queue, mddev->chunk_sectors << 9);
>                 blk_queue_io_opt(mddev->queue,
> diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
> index 3aa8b6e11d58..9a6503f5cb98 100644
> --- a/drivers/md/raid10.c
> +++ b/drivers/md/raid10.c
> @@ -4145,8 +4145,6 @@ static int raid10_run(struct mddev *mddev)
>         conf->thread = NULL;
>
>         if (mddev->queue) {
> -               blk_queue_max_discard_sectors(mddev->queue,
> -                                             UINT_MAX);
>                 blk_queue_max_write_zeroes_sectors(mddev->queue, 0);
>                 blk_queue_io_min(mddev->queue, mddev->chunk_sectors << 9);
>                 raid10_set_io_opt(conf);
> --
> 2.32.0 (Apple Git-132)
>

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

* Re: [PATCH 1/1] Don't set discard sectors for request queue
  2022-11-01 20:21 ` Song Liu
@ 2022-11-01 23:44   ` Xiao Ni
  2022-11-01 23:57     ` Song Liu
  0 siblings, 1 reply; 4+ messages in thread
From: Xiao Ni @ 2022-11-01 23:44 UTC (permalink / raw)
  To: Song Liu; +Cc: yi.zhang, ming.lei, linux-raid

On Wed, Nov 2, 2022 at 4:21 AM Song Liu <song@kernel.org> wrote:
>
> On Mon, Oct 31, 2022 at 10:08 PM Xiao Ni <xni@redhat.com> wrote:
>
> Please update the subject as md/raid0, raid10: xxx.

Sorry for forgetting about this again.

>
> >
> > It should use disk_stack_limits to get a proper max_discard_sectors
> > rather than setting a value by stack drivers.
> >
> > And there is a bug. If all member disks are rotational devices,
> > raid0/raid10 set max_discard_sectors. So the member devices are
> > not ssd/nvme, but raid0/raid10 export the wrong value. It reports
> > warning messages in function __blkdev_issue_discard when mkfs.xfs
>
> Please provide more information about this bug: the warning message,
> the impact, etc. in the commit log.

I remember we need to obey a rule to paste the warning/panic messages,
right? If so, can you tell the position again? I use the keyword
"warning/panic/calltrace"
to search in file process/submitting-patches.rst and can't find the
useful information.
Or it just needs to paste the calltraces in the patch?

Regards
Xiao
>
> >
> > Signed-off-by: Xiao Ni <xni@redhat.com>
> > Reported-by: Yi Zhang <yi.zhang@redhat.com>
>
> Thanks,
> Song
>
> > ---
> >  drivers/md/raid0.c  | 1 -
> >  drivers/md/raid10.c | 2 --
> >  2 files changed, 3 deletions(-)
> >
> > diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
> > index aced0ad8cdab..9d4831ca802c 100644
> > --- a/drivers/md/raid0.c
> > +++ b/drivers/md/raid0.c
> > @@ -398,7 +398,6 @@ static int raid0_run(struct mddev *mddev)
> >
> >                 blk_queue_max_hw_sectors(mddev->queue, mddev->chunk_sectors);
> >                 blk_queue_max_write_zeroes_sectors(mddev->queue, mddev->chunk_sectors);
> > -               blk_queue_max_discard_sectors(mddev->queue, UINT_MAX);
> >
> >                 blk_queue_io_min(mddev->queue, mddev->chunk_sectors << 9);
> >                 blk_queue_io_opt(mddev->queue,
> > diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
> > index 3aa8b6e11d58..9a6503f5cb98 100644
> > --- a/drivers/md/raid10.c
> > +++ b/drivers/md/raid10.c
> > @@ -4145,8 +4145,6 @@ static int raid10_run(struct mddev *mddev)
> >         conf->thread = NULL;
> >
> >         if (mddev->queue) {
> > -               blk_queue_max_discard_sectors(mddev->queue,
> > -                                             UINT_MAX);
> >                 blk_queue_max_write_zeroes_sectors(mddev->queue, 0);
> >                 blk_queue_io_min(mddev->queue, mddev->chunk_sectors << 9);
> >                 raid10_set_io_opt(conf);
> > --
> > 2.32.0 (Apple Git-132)
> >
>


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

* Re: [PATCH 1/1] Don't set discard sectors for request queue
  2022-11-01 23:44   ` Xiao Ni
@ 2022-11-01 23:57     ` Song Liu
  0 siblings, 0 replies; 4+ messages in thread
From: Song Liu @ 2022-11-01 23:57 UTC (permalink / raw)
  To: Xiao Ni; +Cc: yi.zhang, ming.lei, linux-raid

On Tue, Nov 1, 2022 at 4:44 PM Xiao Ni <xni@redhat.com> wrote:
>
> On Wed, Nov 2, 2022 at 4:21 AM Song Liu <song@kernel.org> wrote:
> >
> > On Mon, Oct 31, 2022 at 10:08 PM Xiao Ni <xni@redhat.com> wrote:
> >
> > Please update the subject as md/raid0, raid10: xxx.
>
> Sorry for forgetting about this again.
>
> >
> > >
> > > It should use disk_stack_limits to get a proper max_discard_sectors
> > > rather than setting a value by stack drivers.
> > >
> > > And there is a bug. If all member disks are rotational devices,
> > > raid0/raid10 set max_discard_sectors. So the member devices are
> > > not ssd/nvme, but raid0/raid10 export the wrong value. It reports
> > > warning messages in function __blkdev_issue_discard when mkfs.xfs
> >
> > Please provide more information about this bug: the warning message,
> > the impact, etc. in the commit log.
>
> I remember we need to obey a rule to paste the warning/panic messages,
> right? If so, can you tell the position again? I use the keyword
> "warning/panic/calltrace"
> to search in file process/submitting-patches.rst and can't find the
> useful information.
> Or it just needs to paste the calltraces in the patch?

I think we can just paste the call trace in the commit log.

Thanks,
Song

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

end of thread, other threads:[~2022-11-01 23:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-01  5:08 [PATCH 1/1] Don't set discard sectors for request queue Xiao Ni
2022-11-01 20:21 ` Song Liu
2022-11-01 23:44   ` Xiao Ni
2022-11-01 23:57     ` Song Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox