* [PATCH] dm-table: set non-zero q->limits.discard_granularity
@ 2020-09-24 14:34 Mikulas Patocka
2020-09-24 15:00 ` Mike Snitzer
0 siblings, 1 reply; 3+ messages in thread
From: Mikulas Patocka @ 2020-09-24 14:34 UTC (permalink / raw)
To: Mike Snitzer, Zdenek Kabelac; +Cc: dm-devel
Hi Mike
Could you send this to Linus before v5.9 is released?
Mikulas
From: Mikulas Patocka <mpatocka@redhat.com>
If q->limits.discard_granularity is zero, the block core will warn in
__blkdev_issue_discard. This patch sets it to a minimum - 512 bytes.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Fixes: b35fd7422c2f ("block: check queue's limits.discard_granularity in __blkdev_issue_discard()")
Fixes: 9b15d109a6b2 ("block: improve discard bio alignment in __blkdev_issue_discard()")
Fixes: c52abf563049 ("loop: Better discard support for block devices")
---
drivers/md/dm-table.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
Index: linux-2.6/drivers/md/dm-table.c
===================================================================
--- linux-2.6.orig/drivers/md/dm-table.c 2020-08-31 12:08:27.000000000 +0200
+++ linux-2.6/drivers/md/dm-table.c 2020-09-24 16:23:55.000000000 +0200
@@ -1858,8 +1858,11 @@ void dm_table_set_restrictions(struct dm
q->limits.discard_granularity = 0;
q->limits.discard_alignment = 0;
q->limits.discard_misaligned = 0;
- } else
+ } else {
blk_queue_flag_set(QUEUE_FLAG_DISCARD, q);
+ if (q->limits.discard_granularity < 512)
+ q->limits.discard_granularity = 512;
+ }
if (dm_table_supports_secure_erase(t))
blk_queue_flag_set(QUEUE_FLAG_SECERASE, q);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: dm-table: set non-zero q->limits.discard_granularity
2020-09-24 14:34 [PATCH] dm-table: set non-zero q->limits.discard_granularity Mikulas Patocka
@ 2020-09-24 15:00 ` Mike Snitzer
2020-09-24 16:25 ` Mikulas Patocka
0 siblings, 1 reply; 3+ messages in thread
From: Mike Snitzer @ 2020-09-24 15:00 UTC (permalink / raw)
To: Mikulas Patocka; +Cc: dm-devel, Zdenek Kabelac
On Thu, Sep 24 2020 at 10:34am -0400,
Mikulas Patocka <mpatocka@redhat.com> wrote:
> Hi Mike
>
> Could you send this to Linus before v5.9 is released?
>
> Mikulas
>
>
>
> From: Mikulas Patocka <mpatocka@redhat.com>
>
> If q->limits.discard_granularity is zero, the block core will warn in
> __blkdev_issue_discard. This patch sets it to a minimum - 512 bytes.
>
> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
> Fixes: b35fd7422c2f ("block: check queue's limits.discard_granularity in __blkdev_issue_discard()")
> Fixes: 9b15d109a6b2 ("block: improve discard bio alignment in __blkdev_issue_discard()")
> Fixes: c52abf563049 ("loop: Better discard support for block devices")
>
> ---
> drivers/md/dm-table.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> Index: linux-2.6/drivers/md/dm-table.c
> ===================================================================
> --- linux-2.6.orig/drivers/md/dm-table.c 2020-08-31 12:08:27.000000000 +0200
> +++ linux-2.6/drivers/md/dm-table.c 2020-09-24 16:23:55.000000000 +0200
> @@ -1858,8 +1858,11 @@ void dm_table_set_restrictions(struct dm
> q->limits.discard_granularity = 0;
> q->limits.discard_alignment = 0;
> q->limits.discard_misaligned = 0;
> - } else
> + } else {
> blk_queue_flag_set(QUEUE_FLAG_DISCARD, q);
> + if (q->limits.discard_granularity < 512)
> + q->limits.discard_granularity = 512;
> + }
>
> if (dm_table_supports_secure_erase(t))
> blk_queue_flag_set(QUEUE_FLAG_SECERASE, q);
This patch is wrong, papers over something else. Please identify what
that something else is.
block core has _always_ cheecked if discard_granularity is non-zero to
allow discards.
Why is q->limits.discard_granularity < 512 if discard is supported by
the DM table and targets?
That shouldn't ever be.
Mike
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: dm-table: set non-zero q->limits.discard_granularity
2020-09-24 15:00 ` Mike Snitzer
@ 2020-09-24 16:25 ` Mikulas Patocka
0 siblings, 0 replies; 3+ messages in thread
From: Mikulas Patocka @ 2020-09-24 16:25 UTC (permalink / raw)
To: Mike Snitzer; +Cc: dm-devel, Zdenek Kabelac
On Thu, 24 Sep 2020, Mike Snitzer wrote:
> On Thu, Sep 24 2020 at 10:34am -0400,
> Mikulas Patocka <mpatocka@redhat.com> wrote:
>
> > Hi Mike
> >
> > Could you send this to Linus before v5.9 is released?
> >
> > Mikulas
> >
> >
> >
> > From: Mikulas Patocka <mpatocka@redhat.com>
> >
> > If q->limits.discard_granularity is zero, the block core will warn in
> > __blkdev_issue_discard. This patch sets it to a minimum - 512 bytes.
> >
> > Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
> > Fixes: b35fd7422c2f ("block: check queue's limits.discard_granularity in __blkdev_issue_discard()")
> > Fixes: 9b15d109a6b2 ("block: improve discard bio alignment in __blkdev_issue_discard()")
> > Fixes: c52abf563049 ("loop: Better discard support for block devices")
> >
> > ---
> > drivers/md/dm-table.c | 5 ++++-
> > 1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > Index: linux-2.6/drivers/md/dm-table.c
> > ===================================================================
> > --- linux-2.6.orig/drivers/md/dm-table.c 2020-08-31 12:08:27.000000000 +0200
> > +++ linux-2.6/drivers/md/dm-table.c 2020-09-24 16:23:55.000000000 +0200
> > @@ -1858,8 +1858,11 @@ void dm_table_set_restrictions(struct dm
> > q->limits.discard_granularity = 0;
> > q->limits.discard_alignment = 0;
> > q->limits.discard_misaligned = 0;
> > - } else
> > + } else {
> > blk_queue_flag_set(QUEUE_FLAG_DISCARD, q);
> > + if (q->limits.discard_granularity < 512)
> > + q->limits.discard_granularity = 512;
> > + }
> >
> > if (dm_table_supports_secure_erase(t))
> > blk_queue_flag_set(QUEUE_FLAG_SECERASE, q);
>
> This patch is wrong, papers over something else. Please identify what
> that something else is.
>
> block core has _always_ cheecked if discard_granularity is non-zero to
> allow discards.
>
> Why is q->limits.discard_granularity < 512 if discard is supported by
> the DM table and targets?
>
> That shouldn't ever be.
>
> Mike
OK
I'm sending another patch that changes the function raid_io_hints. This is
where the zero came from.
Mikulas
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-09-24 16:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-24 14:34 [PATCH] dm-table: set non-zero q->limits.discard_granularity Mikulas Patocka
2020-09-24 15:00 ` Mike Snitzer
2020-09-24 16:25 ` Mikulas Patocka
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).