From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B607FC433F5 for ; Mon, 4 Oct 2021 15:40:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8F59C61354 for ; Mon, 4 Oct 2021 15:40:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235783AbhJDPmV (ORCPT ); Mon, 4 Oct 2021 11:42:21 -0400 Received: from out10.migadu.com ([46.105.121.227]:63456 "EHLO out10.migadu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235764AbhJDPmP (ORCPT ); Mon, 4 Oct 2021 11:42:15 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1633361702; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7papMqmjr8u6SvnZamtJ4D2gvME3QDCh7jHlGigiDVM=; b=hL9L0wWyAFnPEfm7tK11jFlF7A9awbrYSuRoMnoRDdeTwRnaVSoF0fRZxtJXuaMFgdJlHr JINbwgjUKyxVIExCaQQ7hoBW5ApMt3j5/Huo3wJmYbeK5Qkyjre7YP51g+H5mftrzYOgWE 0jdZTRwnOwyngnu740X9CAwzOpy2bg0= From: Guoqing Jiang To: song@kernel.org Cc: linux-raid@vger.kernel.org Subject: [PATCH 2/6] md/bitmap: don't set max_write_behind if there is no write mostly device Date: Mon, 4 Oct 2021 23:34:49 +0800 Message-Id: <20211004153453.14051-3-guoqing.jiang@linux.dev> In-Reply-To: <20211004153453.14051-1-guoqing.jiang@linux.dev> References: <20211004153453.14051-1-guoqing.jiang@linux.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: guoqing.jiang@linux.dev Precedence: bulk List-ID: X-Mailing-List: linux-raid@vger.kernel.org We shouldn't set it since write behind IO should only happen to write mostly device. Signed-off-by: Guoqing Jiang --- drivers/md/md-bitmap.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c index e29c6298ef5c..0346281b1555 100644 --- a/drivers/md/md-bitmap.c +++ b/drivers/md/md-bitmap.c @@ -2469,11 +2469,28 @@ backlog_store(struct mddev *mddev, const char *buf, size_t len) { unsigned long backlog; unsigned long old_mwb = mddev->bitmap_info.max_write_behind; + struct md_rdev *rdev; + bool has_write_mostly = false; int rv = kstrtoul(buf, 10, &backlog); if (rv) return rv; if (backlog > COUNTER_MAX) return -EINVAL; + + /* + * Without write mostly device, it doesn't make sense to set + * backlog for max_write_behind. + */ + rdev_for_each(rdev, mddev) + if (test_bit(WriteMostly, &rdev->flags)) { + has_write_mostly = true; + break; + } + if (!has_write_mostly) { + pr_warn_ratelimited("md: No write mostly device available\n"); + return -EINVAL; + } + mddev->bitmap_info.max_write_behind = backlog; if (!backlog && mddev->serial_info_pool) { /* serial_info_pool is not needed if backlog is zero */ -- 2.31.1