Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp232145lqs; Mon, 4 Mar 2024 23:30:05 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXspgq/MyLQ0EMskOt0eieK87QrM1PzKolgerpxjT6rNdvmOO3YjVDYL+DluhJnKmRzFDr+fzK66tkFJGAFuUSHHh3vLFsJjG8oSFZV8A== X-Google-Smtp-Source: AGHT+IHujMWws4zGjV7loJZXOFdLGjRYZWv5YDqbkhi5C5bdE3J0skQgxL13VfS2T9hY0w+VWgLK X-Received: by 2002:a05:6402:1d21:b0:566:981d:aef5 with SMTP id dh1-20020a0564021d2100b00566981daef5mr7087986edb.24.1709623805167; Mon, 04 Mar 2024 23:30:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709623805; cv=pass; d=google.com; s=arc-20160816; b=kJwhw79uyA7nPrT/QZF6SFiDDXSPowQfLb8hgzCfyNHMTxBm1n/x7OiWPNnZtSkRgk ruHaDn4LCBRmk70waUTC17kyGtHApC5V3BKpZO1PLGqeJymgp08jdc671omx4Sxda/LJ qp0psjMnnYvdbVrGpwrrPRAiH6Wk3PkvRKVIJWLfaKclljjHRgBhRIhj1ipvjm6rBMwP SxPRbBFgbpDcKxq7NaTa8XIoNF7zJZAqD0+vrCEW6+ZLlmi8XngCMl/xTPO9mDRb7lIG FxoJb1U2iyjLofCU/kmXXOyFsUrIlP//amNIiD9Ws9G+rTOw8mYLxEl+0CoPZVVyvSDt yi0A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=KjGcznNSW2D83Jr9178G1Vxz1QQ1B0W4qK7UxstiEq8=; fh=YoyvrhSFX/gomruhs8E5v3LJBIcHojMCK8eMDUDpafQ=; b=xd5vWueuS7Z4r1UmQ8gNW6yXheCX6563453oNArb/C8+I6KTaWBt1ktixY0x71pfEF y3OE0RwXFkmq2FsQCCr5WFmmZClXwwfGsfoMMgO2lbSTXXWhCYyzDEH0fUPei2uFO175 qRrPy4uFVhKtL+0LjUz3ye213h+2gvoKoCS+H+cbei2xZgA7bfYGw4eUNffRzAf7jX3O 25qV9arqYZhftjr0KVV8KrgSmr5OhLf3mavMnwGsVCFawOHGvW3VgQjKLuOWDvrE4FnJ FKK2zuesPU0CSd57LKNQI73AL1w48KgMEDN4rvnfrpwKK/QjpHhmravF7dAFH2ZKsPli NHMw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-91799-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91799-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id k11-20020aa7d8cb000000b005677a468cefsi851710eds.458.2024.03.04.23.30.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 23:30:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-91799-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-91799-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91799-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E20CD1F23061 for ; Tue, 5 Mar 2024 07:30:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B3D6B7EF1B; Tue, 5 Mar 2024 07:29:33 +0000 (UTC) Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5290F7E564; Tue, 5 Mar 2024 07:29:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709623773; cv=none; b=qg9nrvCDfCW4s5q3LefPnoTJxHmyv4UZDuXRgrYl2mcqtSWVbUh6CJsafGzvvfnPMnklUzn2lv18bmGxUDJozXInxOdK+bQ/JrcQrf1eWfyy3eNAAnigIWiEzTCjDlqyyNqNNHoo/SXfKf8wQDEnNMNCUeJFMv/1yh05gEmGZ38= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709623773; c=relaxed/simple; bh=xLrCo0TM2lW9vZ7sDJbrPgQEy+ULwHr3T5cie4P5Ah4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=R/FVw/7fGDqgPFyi+IEh4F3smOyQagOEqWPmLJFzt0D8Vwq4ivPyIUmir8Zh3KpswpiMZBmfE6HiFQd28M7LCwT1NNQGosUu7PEu70zEwFgSvv+e+WEH8m/PMEjDwk1TtQU020P33Rkgiq/vRlCju8+3KX5pruIk21uFyt3ZQVE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.93.142]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4TpnJ45HDwz4f3k68; Tue, 5 Mar 2024 15:29:24 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 3BE5C1A016E; Tue, 5 Mar 2024 15:29:28 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP1 (Coremail) with SMTP id cCh0CgBHGBHRyeZlGnf+Fw--.17927S8; Tue, 05 Mar 2024 15:29:28 +0800 (CST) From: Yu Kuai To: xni@redhat.com, zkabelac@redhat.com, agk@redhat.com, snitzer@kernel.org, mpatocka@redhat.com, dm-devel@lists.linux.dev, song@kernel.org, yukuai3@huawei.com, heinzm@redhat.com, jbrassow@redhat.com, neilb@suse.de Cc: linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, yukuai1@huaweicloud.com, yi.zhang@huawei.com, yangerkun@huawei.com Subject: [PATCH md-6.8 v2 4/9] md: add a new helper reshape_interrupted() Date: Tue, 5 Mar 2024 15:23:01 +0800 Message-Id: <20240305072306.2562024-5-yukuai1@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240305072306.2562024-1-yukuai1@huaweicloud.com> References: <20240305072306.2562024-1-yukuai1@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:cCh0CgBHGBHRyeZlGnf+Fw--.17927S8 X-Coremail-Antispam: 1UD129KBjvJXoWrZw15Zr18uFW8Xr48Ar1fWFg_yoW8JF48pa yxGFZ8Zr4UAF9xGanrtF1kZa45uwn5KryDGFyfuan8AF13Xr129ryrWr1UArykGFySqa1a qa1rtFyUCr1xWw7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUPF14x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_JF0E3s1l82xGYI kIc2x26xkF7I0E14v26ryj6s0DM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2 z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j6F 4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oVCq 3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7 IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4U M4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwACI402YVCY1x02628vn2 kIc2xKxwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E 14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_GFv_WrylIx kGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAF wI0_Cr0_Gr1UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJV W8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjfUOBTY UUUUU X-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ From: Yu Kuai The helper will be used for dm-raid456 later to detect the case that reshape can't make progress. Signed-off-by: Yu Kuai Signed-off-by: Xiao Ni Acked-by: Mike Snitzer --- drivers/md/md.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/md/md.h b/drivers/md/md.h index 684cc866402a..7f955115d78d 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h @@ -570,6 +570,25 @@ static inline bool md_is_rdwr(struct mddev *mddev) return (mddev->ro == MD_RDWR); } +static inline bool reshape_interrupted(struct mddev *mddev) +{ + /* reshape never start */ + if (mddev->reshape_position == MaxSector) + return false; + + /* interrupted */ + if (!test_bit(MD_RECOVERY_RUNNING, &mddev->recovery)) + return true; + + /* running reshape will be interrupted soon. */ + if (test_bit(MD_RECOVERY_WAIT, &mddev->recovery) || + test_bit(MD_RECOVERY_INTR, &mddev->recovery) || + test_bit(MD_RECOVERY_FROZEN, &mddev->recovery)) + return true; + + return false; +} + static inline int __must_check mddev_lock(struct mddev *mddev) { return mutex_lock_interruptible(&mddev->reconfig_mutex); -- 2.39.2