From patchwork Fri Mar 1 09:56:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Kuai X-Patchwork-Id: 208741 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2097:b0:108:e6aa:91d0 with SMTP id gs23csp975009dyb; Fri, 1 Mar 2024 02:06:40 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUF/N56NBHZM1t4tqGHgrTeo6dq5dyQPgmPq9VXj6ZmWQslqXt5S1rCtVG60Sve2w4phYcAaZPPmhs2At84oduXXIlWYA== X-Google-Smtp-Source: AGHT+IGHHJIYE3srdobOiCvdAhr2u1Eg3td6Rf2y7DZfbnjSYGMS1gyxEtYR0tuaHUlsJGTbsBmz X-Received: by 2002:a0c:e843:0:b0:690:593e:8c89 with SMTP id l3-20020a0ce843000000b00690593e8c89mr693110qvo.3.1709287600356; Fri, 01 Mar 2024 02:06:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709287600; cv=pass; d=google.com; s=arc-20160816; b=aKPHtYSn0CvQcpYmktTV3igEa4kxKSg3IroqM8009yOvkq31Aqn2j60UMdNzzLXcp1 Nslbtjv8rxXt1nkqv+xVlip1Ta/GIYkB0XffSgXL58//vafLlo0gAFx5hSLK768hwGNE tH+j7NjYvCIi4MyPXCVF7pyW/UmG5m8nLAKCSKNQ3G4d4NWMMDE7O16C+hyhvj/TOlcA mBIg5nRa2e3WO3/ymK0il2OOg6mXu0TAQ4E3D/Hr4qGhpgc+sVnpSWYCxqtE0arwt50l KF5suFLsTWWGkMQtpQvIIAIr62Cit30iexLvMt1EsrlxfzuDN712QzjysSPohXY0lqBe by+w== 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=XSVW9sYbSd5CQd6oRQLalARVAvedep43VRwrwdraJbM=; fh=D0tHjPHp+NwWiP9dALgrUrDY+JdDylAJlTP6wFQuWjg=; b=fQYvpF2GfWn0fM/Uu2+9H9GRpXzTRNVghE28SyOo4FgLKRmVZrrw6QmjPDUtyyILuR I42Fm98vqOz791Yc9mISjYWFMK2sGxpAQxTJfP+LppstlvG62dzcXfopYhXcHL/f8QFp pQtRqB0Y9T42o9e3yoi9oxPfCUQCNk2vRNKojSvE2rq+k8BJXnvfnLWxnO+KqKMoHlAy QYLNRgT3ZiJGVn/1ZAOiXEiD9nVGcgAi28qdBlRnDzRzww60PqyJS9s2Ql62pEj9e6m5 Ny/K3OyxVsK/y4d2+QCb/Ko07opXPxd1jrCosz5ftarqk7KZMX+NS5jrMhiE5K+mzJDN Pqag==; 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-88228-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88228-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id jn8-20020ad45de8000000b0068f8d41359dsi3185258qvb.267.2024.03.01.02.06.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 02:06:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88228-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-88228-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88228-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 295A51C212B6 for ; Fri, 1 Mar 2024 10:06:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B1EE06F068; Fri, 1 Mar 2024 10:03:13 +0000 (UTC) Received: from dggsgout11.his.huawei.com (unknown [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 0086D6BB57; Fri, 1 Mar 2024 10:03:07 +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=1709287391; cv=none; b=Y49F6BaoefBeT6xYZkP0Xd+GayN34FbCychnhsbXK41UZD5DP4ENoVOXbg10CGLMGmMHZdHROnng7mjQ1f2CrvPiQ655Y5kvMhGt0jGAMrDhE4/szpNZcRVSRHHbtbppSAKQ1wQjPOhqLnKiT6HZmLdNC7CfDc2I3s8F+MGVjt0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709287391; c=relaxed/simple; bh=24WD8tgwVtddCKq7F8lxRkz6GTenNtBeLM7ja6eExBk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=YY+0S9T/zqkyX4BPOXKu8yXUa/kIS3f5M4mFVMaZAgcdXw/NumVGhKTx4N/NQY9vIgM9c2xeMfA6rDsSBgnx/zmgzY+SrfF3Sh6t/5Nq0QUsdh9xP5XEvLIbseuxMSx9e2GWJl7fB0Tn3buAfMZgDliTfsF64cAfDHS1hh5Sjbg= 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.163.235]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4TmNv54ZtPz4f3nbq; Fri, 1 Mar 2024 18:02:57 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 08ED91A0838; Fri, 1 Mar 2024 18:03:05 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP1 (Coremail) with SMTP id cCh0CgCXaBHTp+FlqmBuFg--.36874S7; Fri, 01 Mar 2024 18:03:04 +0800 (CST) From: Yu Kuai To: zkabelac@redhat.com, xni@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, neilb@suse.de, jbrassow@redhat.com Cc: linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, yukuai1@huaweicloud.com, yi.zhang@huawei.com, yangerkun@huawei.com Subject: [PATCH -next 3/9] md: export helper md_is_rdwr() Date: Fri, 1 Mar 2024 17:56:51 +0800 Message-Id: <20240301095657.662111-4-yukuai1@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240301095657.662111-1-yukuai1@huaweicloud.com> References: <20240301095657.662111-1-yukuai1@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CM-TRANSID: cCh0CgCXaBHTp+FlqmBuFg--.36874S7 X-Coremail-Antispam: 1UD129KBjvJXoW7Kr47Kr4xtrykGw13uF4fGrg_yoW8XFWrpa ySgFy3ArWjvF43X3yUJayDua45Z3WfKrWjkry3u395Xa43Xr4UCF1rGFWqgrWDWFyfAF1a ga15JF18u3WvkwUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUP014x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_JrWl82xGYIkIc2 x26xkF7I0E14v26ryj6s0DM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2z4x0 Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j6F4UJw A2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oVCq3wAS 0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2 IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0 Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwACI402YVCY1x02628vn2kIc2 xKxwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v2 6r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_GFv_WrylIxkGc2 Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_ Cr0_Gr1UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8Jw CI42IY6I8E87Iv6xkF7I0E14v26r4UJVWxJrUvcSsGvfC2KfnxnUUI43ZEXa7VUbJ73DUU UUU== X-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792317954856894966 X-GMAIL-MSGID: 1792317954856894966 From: Yu Kuai There are no functional changes for now, prepare to fix a deadlock for dm-raid456. Signed-off-by: Yu Kuai --- drivers/md/md.c | 12 ------------ drivers/md/md.h | 12 ++++++++++++ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index 5f6496cf43f5..2fe8b937998b 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -99,18 +99,6 @@ static void mddev_detach(struct mddev *mddev); static void export_rdev(struct md_rdev *rdev, struct mddev *mddev); static void md_wakeup_thread_directly(struct md_thread __rcu *thread); -enum md_ro_state { - MD_RDWR, - MD_RDONLY, - MD_AUTO_READ, - MD_MAX_STATE -}; - -static bool md_is_rdwr(struct mddev *mddev) -{ - return (mddev->ro == MD_RDWR); -} - /* * Default number of read corrections we'll attempt on an rdev * before ejecting it from the array. We divide the read error diff --git a/drivers/md/md.h b/drivers/md/md.h index a6d33f10b107..09368517cc6c 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h @@ -558,6 +558,18 @@ enum recovery_flags { MD_RESYNCING_REMOTE, /* remote node is running resync thread */ }; +enum md_ro_state { + MD_RDWR, + MD_RDONLY, + MD_AUTO_READ, + MD_MAX_STATE +}; + +static inline bool md_is_rdwr(struct mddev *mddev) +{ + return (mddev->ro == MD_RDWR); +} + static inline int __must_check mddev_lock(struct mddev *mddev) { return mutex_lock_interruptible(&mddev->reconfig_mutex);