Skip to contentSkip to conversation

Don't set discard sectors for request queue

PATCH Superseded Xiao Ni 2 participants 4 messages Nov 1, 2022 MD RAID

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Xiao Ni

author
#0 lore raw

PATCH 1/1 Don't set discard sectors for request queue

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

---
 drivers/md/raid0.c  | 1 -
 drivers/md/raid10.c | 2 --
 2 files changed, 3 deletions(-)
drivers/md/raid0.c +0 -1
index aced0ad8cdab..9d4831ca802c 100644
@@ -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,
drivers/md/raid10.c +0 -2
index 3aa8b6e11d58..9a6503f5cb98 100644
@@ -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);
Signature · 1 line
2.32.0 (Apple Git-132)
maintainer
#1 lore raw

On Mon, Oct 31, 2022 at 10:08 PM Xiao Ni <[email protected]> wrote:

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

Quoted 8 lines

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.

Quoted 3 lines

Thanks,
Song

Quoted 33 lines
---
 drivers/md/raid0.c  | 1 -
 drivers/md/raid10.c | 2 --
 2 files changed, 3 deletions(-)
drivers/md/raid0.c +0 -1
index aced0ad8cdab..9d4831ca802c 100644
@@ -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,
drivers/md/raid10.c +0 -3
index 3aa8b6e11d58..9a6503f5cb98 100644
@@ -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)

author
#2 lore raw
Quoted 4 lines · Song Liu

On Mon, Oct 31, 2022 at 10:08 PM Xiao Ni <[email protected]> wrote:

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

Sorry for forgetting about this again.

Quoted 5 lines
Quoted 5 lines

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

Quoted 7 lines
Quoted 4 lines

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

Quoted 42 lines
Quoted 4 lines

Thanks,
Song

Quoted 33 lines
---
 drivers/md/raid0.c  | 1 -
 drivers/md/raid10.c | 2 --
 2 files changed, 3 deletions(-)
drivers/md/raid0.c +0 -1
index aced0ad8cdab..9d4831ca802c 100644
@@ -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,
drivers/md/raid10.c +0 -3
index 3aa8b6e11d58..9a6503f5cb98 100644
@@ -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)

maintainer
#3 lore raw
Quoted 22 lines · Xiao Ni
Quoted 4 lines · Song Liu

On Mon, Oct 31, 2022 at 10:08 PM Xiao Ni <[email protected]> wrote:

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

Sorry for forgetting about this again.

Quoted 5 lines
Quoted 5 lines

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

Quoted 7 lines
Quoted 4 lines

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.

Quoted 6 lines

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