Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp397499ybg; Sun, 26 Jul 2020 08:05:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJysHF0aBxCM3vrgOWh0sgjySKNh2tHsKftYSG/QKIWgQFMGR/0Bg+crEotP0kzNsxdBnkJh X-Received: by 2002:a17:906:82d4:: with SMTP id a20mr16558589ejy.165.1595775922236; Sun, 26 Jul 2020 08:05:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595775922; cv=none; d=google.com; s=arc-20160816; b=SacEguOPtVOVd3vCKAzFs0L5Pp7PTv1XE5OYkk48NAMpBKuIV6YHN24Bmxpg5G6VB/ AxadGpsMQwlisYasfAwdcXYZ1SGcJntKGvAql/UnZMM5gVur06sw1kDTR4HC8IaS08Kg HeBt7b/blmhg4inbS61YZG+OwNO3YwHSqjQeAAP2Non9nA63+4s9+umVYQ6SZmWdU7+2 nKxaDHh//YwJ2Z2Yrc/xxoYQmXIRU8Ye+v/je7343/zp7JLU70t3dlGsyUupVyNEi+lw pO0hQPk2YqYIp9RpKzVthoaJnTG1wQEf+z9lm7RvS/9flgoKKhfGOGbkbh1WaG+m1DOp Oz0A== 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=SaXRWgUk0EPlgByrA3oTDbO63EhWXEwEPeGYOtVvfx1MtWCjT0JDwaPT7U1mGVCZcr Hm/T6PmodVqxdLY+uGUHWgD5+vsBebGxC9jT8YYH9JbBb1CP0CI/OuTNyeKiKsVmuEd9 7KyZDUB+/8fqgbsoEfyTSiezN7YKiTH9VQoAPB3Mi7HwhQfVWMx42GyLZ+jtkOtaE6fZ bXJBFM/zAnBOMMEbhoP9gLlpPbELY4F3t0UYVWwrwP6p1sgYfcNFsaOiJgSHNlzbklOR mGe89AGSAYJM8LWLFuGuxA0jY6EKEmmfSVMD7EFv33vHBW8pXnSRa6jX18mT80hRC+6o 0RVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b="igVxkl/U"; 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 c11si4407426edy.498.2020.07.26.08.05.00; Sun, 26 Jul 2020 08:05:22 -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="igVxkl/U"; 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 S1727085AbgGZPEF (ORCPT + 99 others); Sun, 26 Jul 2020 11:04:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726916AbgGZPDz (ORCPT ); Sun, 26 Jul 2020 11:03:55 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13AA9C0619D2; Sun, 26 Jul 2020 08:03:55 -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=igVxkl/Ux/GOu1Z8BG7hLFti1c 862gNPJOlPrhy0S87Y8T0XA/3jvUohGzZAMDZ9s3o+A2QZ7qxUevaW7lkeDSCNGhJhZ5idt6kVloh OeQp+0gU8TJy5hg+KQv8o0FuFYsm4kBrmZQBGRwkDWT4trwkkD8r8RYJBiUbcaulngHq+q7e0oD+l 1C3BoZmmR3kJFWyIat72Ve635CTWm4pFvMs5rpSF54+zVb4S/UD6162aDkPikNcRmofvZTl/Zd9L3 s8VQe7qCiynbWA+mEBmhBg1hk3zD9MqQP/S2Mil4E0qZC48FlM8g6g0PJge3AVGJkTQ71FIlullXl BQjDXXnw==; Received: from [2001:4bb8:18c:2acc:2375:88ff:9f84:118d] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jziBk-0005gU-6f; Sun, 26 Jul 2020 15:03:44 +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: Sun, 26 Jul 2020 17:03:24 +0200 Message-Id: <20200726150333.305527-6-hch@lst.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200726150333.305527-1-hch@lst.de> References: <20200726150333.305527-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