Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2417212ybz; Sun, 19 Apr 2020 00:47:37 -0700 (PDT) X-Google-Smtp-Source: APiQypKR8YRDUjPBA71id6YG0fP+oGA1azwpWeaXjDCRfP0dXLg9NzsCkoc5K3IItNtJAkOyQ/0H X-Received: by 2002:a17:906:560b:: with SMTP id f11mr10041122ejq.264.1587282457093; Sun, 19 Apr 2020 00:47:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587282457; cv=none; d=google.com; s=arc-20160816; b=beUmqNAwgRFFfQ8nDQfiFeRAn9bSTG1KoX/u6JT2/Eok+WtsXA1t6ZrRhw2NuqvZyN TyNbUHu0RCO+cMOyzLPc3FHoU5hJGYm+MchGWemOZ5cb15gNxFs9ZRc7xjgg8qC5OyPG SoMi6wY16y+dgGkuZamVXo0HpMnsTM5rURiAGbK9NjbA9UJS6mABHW9K4Dt/bcSUazyK vlNi3tCyhUWsKI8Mt/afMFXkQMFGq1AmJE7h3jJG/yZ383E+odEMo3Xzg/MpD28JjaCm bm1BKTYkxMwV8HpH2fYOOmLt3ZWleBIXsYWilqS2+QTaOV/0Etxc2dGzx/ct5wwKgcAL 6hzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=FWvkGvVQh8KbZRBYIXV30QDHHO81zMIEQ+BivV713pg=; b=xukYq3mxwa+e9ARkrtM60P1L7uLUblEsUyWMLXlfH/rBoRp3NcTBdCIDd7TDTwbo/8 hzRBoEDkLcManvwBbqlFs5E7U9au1i4X8DVFG/gOj3DzimO9SqmKjMTaJfHxpn9zjkZv YWmLaMjDF+5QrFT7fvwgHYQRmG9Aqk0Zo4465eB2opjVHnL+HfmSKcAvHAc2QwP2tCzf RPIZRvvA3NUpSyqVL40HkFKHmpqrDGfz43cF/HWUtxgWT+x/K+IkTlkOLLH8qULjrC4h Btvsi0oJ178t3vKi4eGTocsT0ICFizlDNCoyjFLImxkn7nSLqp205vHFZ/znl7wOF4sV VAPw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bonedaddy.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i17si1007467ejr.440.2020.04.19.00.47.14; Sun, 19 Apr 2020 00:47:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bonedaddy.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725964AbgDSHpX (ORCPT + 99 others); Sun, 19 Apr 2020 03:45:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725903AbgDSHpX (ORCPT ); Sun, 19 Apr 2020 03:45:23 -0400 Received: from master.debian.org (master.debian.org [IPv6:2001:41b8:202:deb:216:36ff:fe40:4001]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 174C8C061A0C for ; Sun, 19 Apr 2020 00:45:23 -0700 (PDT) Received: from pabs by master.debian.org with local (Exim 4.92) (envelope-from ) id 1jQ4Q9-00040e-4Q; Sun, 19 Apr 2020 07:31:17 +0000 From: Paul Wise To: Alasdair Kergon , Mike Snitzer , dm-devel@redhat.com, linux-kernel@vger.kernel.org Cc: Paul Wise 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 Message-Id: <20200419073026.197967-3-pabs3@bonedaddy.net> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200419073026.197967-1-pabs3@bonedaddy.net> References: <20200419073026.197967-1-pabs3@bonedaddy.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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