From: NeilBrown <neilb@suse.de>
To: Mike Snitzer <snitzer@redhat.com>
Cc: Heinz Mauelshagen <heinzm@redhat.com>,
device-mapper development <dm-devel@redhat.com>,
Shaohua Li <shli@kernel.org>,
"Martin K. Petersen" <martin.petersen@oracle.com>
Subject: Re: dm-raid: add RAID discard support
Date: Thu, 2 Oct 2014 09:34:03 +1000 [thread overview]
Message-ID: <20141002093403.25cc832f@notabene.brown> (raw)
In-Reply-To: <20141001133237.GB16521@redhat.com>
[-- Attachment #1.1: Type: text/plain, Size: 4321 bytes --]
On Wed, 1 Oct 2014 09:32:37 -0400 Mike Snitzer <snitzer@redhat.com> wrote:
> On Tue, Sep 30 2014 at 10:56pm -0400,
> NeilBrown <neilb@suse.de> wrote:
>
> > On Wed, 24 Sep 2014 13:02:28 +0200 Heinz Mauelshagen <heinzm@redhat.com>
> > wrote:
> >
> > >
> > > Martin,
> > >
> > > thanks for the good explanation of the state of the discard union.
> > > Do you have an ETA for the 'zeroout, deallocate' ... support you mentioned?
> > >
> > > I was planning to have a followup patch for dm-raid supporting a dm-raid
> > > table
> > > line argument to prohibit discard passdown.
> > >
> > > In lieu of the fuzzy field situation wrt SSD fw and discard_zeroes_data
> > > support
> > > related to RAID4/5/6, we need that in upstream together with the initial
> > > patch.
> > >
> > > That 'no_discard_passdown' table line can be added to dm-raid RAID4/5/6
> > > table
> > > lines to avoid possible data corruption but can be avoided on RAID1/10
> > > table lines,
> > > because the latter are not suffering from any discard_zeroes_data flaw.
> > >
> > >
> > > Neil,
> > >
> > > are you going to disable discards in RAID4/5/6 shortly
> > > or rather go with your bitmap solution?
> >
> > Can I just close my eyes and hope it goes away?
> >
> > The idea of a bitmap of uninitialised areas is not a short-term solution.
> > But I'm not really keen on simply disabling discard for RAID4/5/6 either. It
> > would mean that people with good sensible hardware wouldn't be able to use
> > it properly.
> >
> > I would really rather that discard_zeroes_data were only set on devices where
> > it was actually true. Then it wouldn't be my problem any more.
> >
> > Maybe I could do a loud warning
> > "Not enabling DISCARD on RAID5 because we cannot trust committees.
> > Set "md_mod.willing_to_risk_discard=Y" if your devices reads discarded
> > sectors as zeros"
> >
> > and add an appropriate module parameter......
>
> I had the same thought and would be happy with this too. I was going to
> update Heinz's patch to have the same default off but allow user to
> enable:
> https://git.kernel.org/cgit/linux/kernel/git/device-mapper/linux-dm.git/commit/?h=for-next&id=8e0cff64f35971135a6de7907bbc8c3a010aff8f
>
> But I'd love to just follow what you arrive at with MD (using the same
> name for the module param in dm-raid).
>
> I'm open to getting this done now and included in 3.18 if you are.
>
> Mike
How about something like this?
I want to keep it well away from regular API stuff as I hope it is just a
temporary hack until a more general solution can be found and implemented.
Thanks,
NeilBrown
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 183588b11fc1..3ed668c5378c 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -64,6 +64,10 @@
#define cpu_to_group(cpu) cpu_to_node(cpu)
#define ANY_GROUP NUMA_NO_NODE
+static bool devices_handle_discard_safely = false;
+module_param(devices_handle_discard_safely, bool, false);
+MODULE_PARM_DESC(devices_handle_discard_safely,
+ "Set to Y if all devices in array reliably return zeroes on reads from discarded regions");
static struct workqueue_struct *raid5_wq;
/*
* Stripe cache
@@ -6208,7 +6212,7 @@ static int run(struct mddev *mddev)
mddev->queue->limits.discard_granularity = stripe;
/*
* unaligned part of discard request will be ignored, so can't
- * guarantee discard_zerors_data
+ * guarantee discard_zeroes_data
*/
mddev->queue->limits.discard_zeroes_data = 0;
@@ -6233,6 +6237,18 @@ static int run(struct mddev *mddev)
!bdev_get_queue(rdev->bdev)->
limits.discard_zeroes_data)
discard_supported = false;
+ /* Unfortunately, discard_zeroes_data is not currently
+ * a guarantee - just a hint. So we only allow DISCARD
+ * if the sysadmin has confirmed that only safe devices
+ * are in use but setting a module parameter.
+ */
+ if (!devices_handle_discard_safely) {
+ if (discard_supported) {
+ pr_info("md/raid456: discard support disabled due to uncertainty.\n");
+ pr_info("Set raid456.devices_handle_discard_safely=Y to override.\n");
+ }
+ discard_supported = false;
+ }
}
if (discard_supported &&
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
next prev parent reply other threads:[~2014-10-01 23:34 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-23 16:51 [PATCH] dm-raid: add RAID discard support heinzm
2014-09-23 21:52 ` Brassow Jonathan
2014-09-23 23:07 ` Martin K. Petersen
2014-09-23 23:33 ` NeilBrown
2014-09-24 2:20 ` Martin K. Petersen
2014-09-24 4:05 ` Brassow Jonathan
2014-09-24 4:21 ` NeilBrown
2014-09-24 4:35 ` Brassow Jonathan
2014-09-24 11:02 ` Heinz Mauelshagen
2014-10-01 2:56 ` NeilBrown
2014-10-01 11:13 ` Heinz Mauelshagen
2014-10-03 1:12 ` Martin K. Petersen
2014-10-01 13:32 ` Mike Snitzer
2014-10-01 23:34 ` NeilBrown [this message]
2014-10-02 1:31 ` Mike Snitzer
2014-10-02 2:00 ` NeilBrown
2014-10-02 4:04 ` [dm-devel] " NeilBrown
2014-10-02 13:52 ` Mike Snitzer
2014-10-02 18:00 ` Mike Snitzer
2014-10-03 1:14 ` [dm-devel] " Martin K. Petersen
2014-10-01 16:00 ` [PATCH] " Andrey Kuzmin
2014-10-01 23:15 ` NeilBrown
2014-10-01 18:57 ` Brassow Jonathan
2014-10-01 23:18 ` NeilBrown
2014-10-03 1:09 ` Martin K. Petersen
2014-09-24 14:21 ` Christoph Hellwig
2014-09-24 14:38 ` Heinz Mauelshagen
2014-09-24 15:11 ` Martin K. Petersen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141002093403.25cc832f@notabene.brown \
--to=neilb@suse.de \
--cc=dm-devel@redhat.com \
--cc=heinzm@redhat.com \
--cc=martin.petersen@oracle.com \
--cc=shli@kernel.org \
--cc=snitzer@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox