Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp94656pxk; Wed, 23 Sep 2020 23:56:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyEMbJBp1IA1wuxytdTWZu02Wpc87ZHrGy8hB55QNPiyTMs9ioC9EB7VkTHH0VEqx2abuWO X-Received: by 2002:a17:906:118d:: with SMTP id n13mr3096894eja.162.1600930585363; Wed, 23 Sep 2020 23:56:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600930585; cv=none; d=google.com; s=arc-20160816; b=R8at48YkW7gMefBos1EouNGhPWrT5KpWhin9mVDXbrbMU0maQ1S2XofgOBYfYuV56e ECVQxlTIHO4+rQnUoYCOgGwsYc4AVMlFPAl685RZqfAOz0lbqRAt52fBXfNBgYSHH76y R8SymI/0xBJwq98rx1tGCqU5c0YIiyZjdw8kehuyuKmy/F9HayH5vletmk2tKTN+1qBw 2Ugc7rnbR1h0fdqDaMruiXJQ1twjN1pg1eL6Wzp5SZsJdqacMoARctPI0vRMFu+9nQqp SsLssliaoojoYnSyhTzkudPyIMcGHDm7i8LMR6c8v0vF8dBvNPm2ko8MXxJFlVyaNsIL zUTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=H8hk1GyqLuto/InuvfMfeFX2w3KpymgO3wY2UL3PIN8=; b=G/DIm2Rg/ipJtB77tvCEJm0KfC6UvPLY83PVuYjkbTJeSEqZpKdeP4STofsu5FJXcW qxfNLSG4w3icga6xIqP8ScEu0ZNFRnmxlkILOLsMkP+DLokPMLG0REHY4e61oiKiXKDg CbtiHOu2aDz1G5HbG+F4Cs+TMETYGZ8mH3Ow3qOhRA8BhlLbI0JgfAHrPwqWd53y25we 0qSbHOr152UwmgUhgU2a1w8ItzjXUfpnE6bMsgGfzHgcs4pmvuIlIhveV/AyvKZOoJqh 5GEK9DtPSf1WeGPndzYaZPd2+xcBhMHzrI39EFCD1FLAWk470ywFT23tPJ/liVbXtxTF cFBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=L6xmSY3v; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r25si1447394ejx.180.2020.09.23.23.56.02; Wed, 23 Sep 2020 23:56:25 -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; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=L6xmSY3v; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727329AbgIXGwZ (ORCPT + 99 others); Thu, 24 Sep 2020 02:52:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727234AbgIXGwD (ORCPT ); Thu, 24 Sep 2020 02:52:03 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF63AC0613D6; Wed, 23 Sep 2020 23:52:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=H8hk1GyqLuto/InuvfMfeFX2w3KpymgO3wY2UL3PIN8=; b=L6xmSY3vp6Lcglln6PGBprLB3R RjAxhsIpEdTFOG/XBsDo8f6bcBuKSZvVFyCxJ3c01dTixt5ELTxLP0k/iDi9vEZipLUcvf1kT/n86 5GpCKlSkjDhfT9gH2vjsiqaTOdX4c0R2Upj77gvJIPPi9RB2QUgaAMhss9sZkkOthWvdY+seYHhLB OR/VLpxTSS0TPEN5pDTQ7yIB4oDagi/Hz48Y/WsrPtYDCtu0IClRhNEDtxZae90fKWS9yrInJoPk6 TYq76s7Ix5T4TWbCNDOdntJtWhlgHHRhI9CCCdV74iYU012+0MpfGD+99BcL5LMaj2HLmHQwa3Zgt xfVjo8lg==; Received: from p4fdb0c34.dip0.t-ipconnect.de ([79.219.12.52] helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kLL6c-0001AX-62; Thu, 24 Sep 2020 06:51:50 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Song Liu , Hans de Goede , Coly Li , Richard Weinberger , Minchan Kim , Johannes Thumshirn , Justin Sanders , linux-mtd@lists.infradead.org, dm-devel@redhat.com, linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, linux-kernel@vger.kernel.org, drbd-dev@lists.linbit.com, linux-raid@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, cgroups@vger.kernel.org, Johannes Thumshirn Subject: [PATCH 06/13] md: update the optimal I/O size on reshape Date: Thu, 24 Sep 2020 08:51:33 +0200 Message-Id: <20200924065140.726436-7-hch@lst.de> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200924065140.726436-1-hch@lst.de> References: <20200924065140.726436-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The raid5 and raid10 drivers currently update the read-ahead size, but not the optimal I/O size on reshape. To prepare for deriving the read-ahead size from the optimal I/O size make sure it is updated as well. Signed-off-by: Christoph Hellwig Acked-by: Song Liu Reviewed-by: Johannes Thumshirn --- drivers/md/raid10.c | 22 ++++++++++++++-------- drivers/md/raid5.c | 10 ++++++++-- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index e8fa327339171c..9956a04ac13bd6 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -3703,10 +3703,20 @@ static struct r10conf *setup_conf(struct mddev *mddev) return ERR_PTR(err); } +static void raid10_set_io_opt(struct r10conf *conf) +{ + int raid_disks = conf->geo.raid_disks; + + if (!(conf->geo.raid_disks % conf->geo.near_copies)) + raid_disks /= conf->geo.near_copies; + blk_queue_io_opt(conf->mddev->queue, (conf->mddev->chunk_sectors << 9) * + raid_disks); +} + static int raid10_run(struct mddev *mddev) { struct r10conf *conf; - int i, disk_idx, chunk_size; + int i, disk_idx; struct raid10_info *disk; struct md_rdev *rdev; sector_t size; @@ -3742,18 +3752,13 @@ static int raid10_run(struct mddev *mddev) mddev->thread = conf->thread; conf->thread = NULL; - chunk_size = mddev->chunk_sectors << 9; if (mddev->queue) { blk_queue_max_discard_sectors(mddev->queue, mddev->chunk_sectors); blk_queue_max_write_same_sectors(mddev->queue, 0); blk_queue_max_write_zeroes_sectors(mddev->queue, 0); - blk_queue_io_min(mddev->queue, chunk_size); - if (conf->geo.raid_disks % conf->geo.near_copies) - blk_queue_io_opt(mddev->queue, chunk_size * conf->geo.raid_disks); - else - blk_queue_io_opt(mddev->queue, chunk_size * - (conf->geo.raid_disks / conf->geo.near_copies)); + blk_queue_io_min(mddev->queue, mddev->chunk_sectors << 9); + raid10_set_io_opt(conf); } rdev_for_each(rdev, mddev) { @@ -4727,6 +4732,7 @@ static void end_reshape(struct r10conf *conf) stripe /= conf->geo.near_copies; if (conf->mddev->queue->backing_dev_info->ra_pages < 2 * stripe) conf->mddev->queue->backing_dev_info->ra_pages = 2 * stripe; + raid10_set_io_opt(conf); } conf->fullsync = 0; } diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 225380efd1e24f..9a7d1250894ef1 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -7232,6 +7232,12 @@ static int only_parity(int raid_disk, int algo, int raid_disks, int max_degraded return 0; } +static void raid5_set_io_opt(struct r5conf *conf) +{ + blk_queue_io_opt(conf->mddev->queue, (conf->chunk_sectors << 9) * + (conf->raid_disks - conf->max_degraded)); +} + static int raid5_run(struct mddev *mddev) { struct r5conf *conf; @@ -7521,8 +7527,7 @@ static int raid5_run(struct mddev *mddev) chunk_size = mddev->chunk_sectors << 9; blk_queue_io_min(mddev->queue, chunk_size); - blk_queue_io_opt(mddev->queue, chunk_size * - (conf->raid_disks - conf->max_degraded)); + raid5_set_io_opt(conf); mddev->queue->limits.raid_partial_stripes_expensive = 1; /* * We can only discard a whole stripe. It doesn't make sense to @@ -8115,6 +8120,7 @@ static void end_reshape(struct r5conf *conf) / PAGE_SIZE); if (conf->mddev->queue->backing_dev_info->ra_pages < 2 * stripe) conf->mddev->queue->backing_dev_info->ra_pages = 2 * stripe; + raid5_set_io_opt(conf); } } } -- 2.28.0