Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1964968ybh; Fri, 24 Jul 2020 00:34:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwoGJ3uVBb1YCxzBAafcyHbrn3KzoK0yE/q5n3wUkK2PqeckOZaCYMOnjVNcbcHGSIECetP X-Received: by 2002:a17:906:ce43:: with SMTP id se3mr7794239ejb.543.1595576056353; Fri, 24 Jul 2020 00:34:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595576056; cv=none; d=google.com; s=arc-20160816; b=RkJ3Sf5woDeWng+GJCXH354HUcDBPBq4icJ0Yracpa9m+u34Z1gZ+FLxfLBLsxdzf5 6xq3bSFAwxR3h+63ljVpyymDEyjTiHiVg9uZo1GY+kpmrensTivK9xq1tc5Itv9htvaq XmYAlduHNzedhThppYlseRJiT5m974sDcOI0mMNYIxaWV2aD76lU0J00bpOmWwKxWvA1 gZ4kZIUrX0++dz/tVV3TF68U/p68oIStSIqs6wLvhZVoDG37gtk3GvMUNWFdS60QGxPL ppfxCWBwvWlV2eqq3DNHvxLnp4vatPtOUg/rhAQr6XE1VPJ9KX6fLZL10b2or0tu/Spr 0a9w== 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 :dkim-signature; bh=va/h+wWyCoJg1xNOoHbk7lvmV/IMHTiU8wUk5cwnCTg=; b=t/74EidKllo2sE/a7t/deE55zUrhNio7N/G7xVXU8PCSSMmYO7BC4e5cnwi7DNicwG 1KG9d2aLWsUD3ongou94NMw5o0P3+skiaQilhFqZBEtAIC6W//w0L1PHmVWUN5LfGjvw U0qXCaBtLiUMlI6t8gFHP+9iamY9PCAs03KGWZOjyxb5wWuSHN8WyjkJQOUkLEYCbCSP 4t+4h5/VPg/cgmwl5xtKua5v8GaPrQfov1O3V/787JsCScwiL0i2tvk+DRkAWLcArw+6 6wqbxyoEqZIHLAO/Nh5avhIeLhXkdnbb4b9qviYUyczcJmgWlAg44/w7AJz7vNsuD/yb nDeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=kaEsNsF0; 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 k14si53376edk.14.2020.07.24.00.33.53; Fri, 24 Jul 2020 00:34:16 -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=fail header.i=@infradead.org header.s=casper.20170209 header.b=kaEsNsF0; 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 S1726990AbgGXHdj (ORCPT + 99 others); Fri, 24 Jul 2020 03:33:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726963AbgGXHdg (ORCPT ); Fri, 24 Jul 2020 03:33:36 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4957EC0619D3; Fri, 24 Jul 2020 00:33:36 -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=va/h+wWyCoJg1xNOoHbk7lvmV/IMHTiU8wUk5cwnCTg=; b=kaEsNsF0KJCjckjlyqne/UaMSf XpXecFAc7NIrEdzlARVPS9ITlg04syCTNGC4u9FUYlXZowEvaTXGt6o9C2B8DnlvDfbQuVK4H9ve3 nC60QOllN2Kaap1YN+MJKZgG+53GM+8SmQ0nTUTOzb5zy2HjRmRKDz0jjIu5S4X4rqQglc4BPVegH 3ou5D7VpV4b2KQUftpWrGyL/sKRND+seG2ZbrnYmGB8ErpoUW89WledOv4OlEe2bLLWIu8MvdWANr Z0UE7OB4g1ynjiHLVMTDVN8mlvcFqdukMtWdD7lU9pgb1V6gYBKHG2R0jbAixZeBhOYYI/xlWqdOt jit9CMHA==; Received: from [2001:4bb8:18c:2acc:8dfe:be3c:592c:efc5] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jysCu-0006CQ-4J; Fri, 24 Jul 2020 07:33:28 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Song Liu , Hans de Goede , Richard Weinberger , Minchan Kim , linux-mtd@lists.infradead.org, dm-devel@redhat.com, linux-block@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 Subject: [PATCH 05/14] md: update the optimal I/O size on reshape Date: Fri, 24 Jul 2020 09:33:04 +0200 Message-Id: <20200724073313.138789-6-hch@lst.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200724073313.138789-1-hch@lst.de> References: <20200724073313.138789-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 Sender: linux-kernel-owner@vger.kernel.org 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 --- 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 b1d0c9d4ef7757..9f88ff9bdee437 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -3695,10 +3695,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; @@ -3734,18 +3744,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) { @@ -4719,6 +4724,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 d7780b1dd0c528..68e41ce3ca75cc 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -7123,6 +7123,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; @@ -7412,8 +7418,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 @@ -8006,6 +8011,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.27.0