From patchwork Thu Oct 29 03:07:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Ruffell X-Patchwork-Id: 1389824 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CM9PF5Mdfz9sTR; Thu, 29 Oct 2020 14:08:17 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1kXyIP-0005Oj-5h; Thu, 29 Oct 2020 03:08:13 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kXyIK-0005Jv-9A for kernel-team@lists.ubuntu.com; Thu, 29 Oct 2020 03:08:08 +0000 Received: from mail-pl1-f197.google.com ([209.85.214.197]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kXyIJ-00035x-Lp for kernel-team@lists.ubuntu.com; Thu, 29 Oct 2020 03:08:07 +0000 Received: by mail-pl1-f197.google.com with SMTP id x9so1016483pll.2 for ; Wed, 28 Oct 2020 20:08:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PiwCfUg9BJjsLehLRkDaYnSmziadwINlfq45givc7cQ=; b=Fd7ro4bIPsoVLY8toEqN6Kh2FyDDFcOtWEafSJGiSASV2SsoyVPKy23JSIHl2vOhEB NBoevBLBfNEBclXAUFf/ZKLnvF+s9xiOZ9iA3WR2r2UYoNGO173c91razloC+FUZ2+Jk a0iGoVu+0gQDBW5u021Ui5T8pMni7vnPoGthcL44BfTAS0CeACUu2ZbW5V7RHRP3Wvgf RbBUzTOPHKk8UJ9bDzd+LJZH4Q5xhuVwN2UpHTL4iLWeGzohckQeSGpt7lnJsjnB/7tP xHO9IKlCpSSPF1IO5MHQayTDHqQwhvOesWTEm3uTKQ5rxxDx1iJ+vHMN2w3KlVQCPyix FzDQ== X-Gm-Message-State: AOAM532rRCGh+Q2MYgmFjM2aKWWctV/roIKb3X2ty+5UnhNYrHg71VCw zCuHAx9AscPLNZBgFlr7jNXM0RI0wgu73pwS6fp5RDZf9OSVTvtIBoHKqIx0H8za/9S1K9lrJfd MceP+FKDVCmOyquXshKDH3jib225KOfg69OmkgMGFGg== X-Received: by 2002:a17:902:101:b029:d6:5ca9:118f with SMTP id 1-20020a1709020101b02900d65ca9118fmr2054426plb.27.1603940884673; Wed, 28 Oct 2020 20:08:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXwXLG4WsyUdLcTjkO8Ky5NS4f6eulDbmAfafQRzZ8tmucY/zIaYwycINvg9Xx27xMGj299Q== X-Received: by 2002:a17:902:101:b029:d6:5ca9:118f with SMTP id 1-20020a1709020101b02900d65ca9118fmr2054413plb.27.1603940884421; Wed, 28 Oct 2020 20:08:04 -0700 (PDT) Received: from localhost.localdomain (222-152-178-139-fibre.sparkbb.co.nz. [222.152.178.139]) by smtp.gmail.com with ESMTPSA id r6sm966882pfg.85.2020.10.28.20.08.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Oct 2020 20:08:03 -0700 (PDT) From: Matthew Ruffell To: kernel-team@lists.ubuntu.com Subject: [SRU][F][G][PATCH 6/7] dm raid: fix discard limits for raid1 and raid10 Date: Thu, 29 Oct 2020 16:07:36 +1300 Message-Id: <20201029030737.21204-10-matthew.ruffell@canonical.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201029030737.21204-1-matthew.ruffell@canonical.com> References: <20201029030737.21204-1-matthew.ruffell@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Mike Snitzer BugLink: https://bugs.launchpad.net/bugs/1896578 Block core warned that discard_granularity was 0 for dm-raid with personality of raid1. Reason is that raid_io_hints() was incorrectly special-casing raid1 rather than raid0. But since commit 29efc390b9462 ("md/md0: optimize raid0 discard handling") even raid0 properly handles large discards. Fix raid_io_hints() by removing discard limits settings for raid1. Also, fix limits for raid10 by properly stacking underlying limits as done in blk_stack_limits(). Depends-on: 29efc390b9462 ("md/md0: optimize raid0 discard handling") Fixes: 61697a6abd24a ("dm: eliminate 'split_discard_bios' flag from DM target interface") Cc: stable@vger.kernel.org Reported-by: Zdenek Kabelac Reported-by: Mikulas Patocka Signed-off-by: Mike Snitzer (cherry-picked from commit e0910c8e4f87bb9f767e61a778b0d9271c4dc512) Signed-off-by: Matthew Ruffell --- drivers/md/dm-raid.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c index 10e8b2fe787b..793348ae1e8c 100644 --- a/drivers/md/dm-raid.c +++ b/drivers/md/dm-raid.c @@ -3744,12 +3744,14 @@ static void raid_io_hints(struct dm_target *ti, struct queue_limits *limits) blk_limits_io_opt(limits, chunk_size_bytes * mddev_data_stripes(rs)); /* - * RAID1 and RAID10 personalities require bio splitting, - * RAID0/4/5/6 don't and process large discard bios properly. + * RAID10 personality requires bio splitting, + * RAID0/1/4/5/6 don't and process large discard bios properly. */ - if (rs_is_raid1(rs) || rs_is_raid10(rs)) { - limits->discard_granularity = chunk_size_bytes; - limits->max_discard_sectors = rs->md.chunk_sectors; + if (rs_is_raid10(rs)) { + limits->discard_granularity = max(chunk_size_bytes, + limits->discard_granularity); + limits->max_discard_sectors = min_not_zero(rs->md.chunk_sectors, + limits->max_discard_sectors); } }