mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Wise <pabs3@bonedaddy.net>
To: Alasdair Kergon <agk@redhat.com>,
	Mike Snitzer <snitzer@redhat.com>,
	dm-devel@redhat.com, linux-kernel@vger.kernel.org
Cc: Paul Wise <pabs3@bonedaddy.net>
Subject: [PATCH 2/3] dm raid: only check for RAID 4/5/6 once during discard support setup
Date: Sun, 19 Apr 2020 15:30:25 +0800	[thread overview]
Message-ID: <20200419073026.197967-3-pabs3@bonedaddy.net> (raw)
In-Reply-To: <20200419073026.197967-1-pabs3@bonedaddy.net>

The RAID level 4/5/6 check no longer looks at the devices in the array,
so it isn't necessary for it to be checked once for each device,
so check it before the loop over the devices.

This makes the code cleaner and easier to understand since it
disentangles whole-array checks from per-device checks.

Commit 48920ff2a5a9 ("block: remove the discard_zeroes_data flag") removed
the per-device discard_zeroes_data check since REQ_OP_WRITE_ZEROES
operation was used everywhere and commit 48cf06bc5f50 ("dm raid: add
discard support for RAID levels 4, 5 and 6") introduced the RAID 4/5/6
check.

Signed-off-by: Paul Wise <pabs3@bonedaddy.net>
---
 drivers/md/dm-raid.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c
index 9a18bef0a5ff..0f95e50e62a8 100644
--- a/drivers/md/dm-raid.c
+++ b/drivers/md/dm-raid.c
@@ -2944,13 +2944,16 @@ static int rs_setup_reshape(struct raid_set *rs)
 static void configure_discard_support(struct raid_set *rs)
 {
 	int i;
-	bool raid456;
 	struct dm_target *ti = rs->ti;
 
 	/*
 	 * XXX: RAID level 4,5,6 require zeroing for safety.
 	 */
-	raid456 = rs_is_raid456(rs);
+	if (rs_is_raid456(rs) && !devices_handle_discard_safely) {
+		DMERR("raid456 discard support disabled due to discard_zeroes_data uncertainty.");
+		DMERR("Set dm-raid.devices_handle_discard_safely=Y to override.");
+		return;
+	}
 
 	for (i = 0; i < rs->raid_disks; i++) {
 		struct request_queue *q;
@@ -2961,14 +2964,6 @@ static void configure_discard_support(struct raid_set *rs)
 		q = bdev_get_queue(rs->dev[i].rdev.bdev);
 		if (!q || !blk_queue_discard(q))
 			return;
-
-		if (raid456) {
-			if (!devices_handle_discard_safely) {
-				DMERR("raid456 discard support disabled due to discard_zeroes_data uncertainty.");
-				DMERR("Set dm-raid.devices_handle_discard_safely=Y to override.");
-				return;
-			}
-		}
 	}
 
 	ti->num_discard_bios = 1;
-- 
2.26.1


  parent reply	other threads:[~2020-04-19  7:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-19  7:30 [PATCH 0/3] dm raid/raid1: enable discard support when any devices support discard Paul Wise
2020-04-19  7:30 ` [PATCH 1/3] dm: add support for targets that allow discard when one device does Paul Wise
2020-04-19  7:30 ` Paul Wise [this message]
2020-04-19  7:30 ` [PATCH 3/3] dm raid/raid1: enable discard support when any devices support discard Paul Wise
2020-04-19 13:19 ` [PATCH 0/3] " Mike Snitzer
2020-04-19 14:48   ` Paul Wise
2020-04-20  7:35     ` [dm-devel] " Ondrej Kozina
2020-04-20 10:13       ` Paul Wise
2020-04-20 10:22         ` Ondrej Kozina
2020-04-25  2:46   ` Paul Wise

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=20200419073026.197967-3-pabs3@bonedaddy.net \
    --to=pabs3@bonedaddy.net \
    --cc=agk@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=linux-kernel@vger.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

all inboxes | Powered by JetHome®