Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp249318lqs; Tue, 5 Mar 2024 00:15:21 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWRhWSTG2ZyRZhJkYpdH2qpJcZX2oX8OenxqpAopqE5te6LLKlvz9H9TU9vqJgCuflVYe1hLlFMGEGAs+fvGUb/dRo80Ikt3QSQUJ7Wkw== X-Google-Smtp-Source: AGHT+IHmchr8gHnFxl08qj4TIDEJne9cLqG/LaWLVGnbffTQ1n3yU9Syb9BQwPk31aWdYCbIkTdH X-Received: by 2002:a17:906:a2d9:b0:a45:ab98:aec with SMTP id by25-20020a170906a2d900b00a45ab980aecmr619812ejb.10.1709626520804; Tue, 05 Mar 2024 00:15:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709626520; cv=pass; d=google.com; s=arc-20160816; b=L9bGpVa5GgOhYjYT/NxAji64qX6lDpgGEwST89wBLO/ghrnhsjMWPVjecGDO5OiRyv QSULMMrf6jrTN5Wnp9D30WzmQccLnqDUDkJg2FUAJXKcoWLYYW4EBHflqsPHWMMUuOJf +BSF82RQInDt78EeKNxE9c7SCmsdVs7JTRlOnoaopQp6buWqgRMWv8U0XZKbC/Pc0tRp 1thN35te97d8AD1NDEuDztqBLQyfkJs8PymAcUrY+5OuMbog6uBsqxRbqIlW5rTJcwvs fO50SryFYzb+H9Yos5oUVEiGAOacH/6eOGOEHQzSlF+vmZVJ9kS08UU28RoDVgzbT1Ed u7tw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:user-agent:date:message-id:from :references:cc:to:subject; bh=2c70CiJBD/Hah0trH/w/2+Zepk+l7iBXRRu1RMHllOU=; fh=GooHMZhaNfcvK1kyfvrMLMbQTk7uzg1+XJWJoHbBX04=; b=jvD2dMEqdZG0jPswmt3tWlZjxwmosLjZjuHUWQCLGj4m8EmgnKnzAdV12O4Jty2wLK 3M3lezXtQzu8svD14b5WwNqJ0wYquwXpune5MjlP36kzmQnau5YnRYU9cd958dxMl5oV ZvnpSlYafUbcbzxPqcjXnguDHVQsCJWtSI1MrjZJ9f3in+kogJpeSXY57E/zPvm/BcVJ 0jCdsdd7KfzOG5hCGpu53IPpgxC0mSio1z6hcLJ/wehS14lwj7izSNOnE9LteAiCMwL6 o8nVjM7SPIRVnF6l4RnCjvtVfs6TcPyzKd53gjB1UzOzAWfPN/ArfM1zu1da3lopgqBE Wq0A==; 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-91880-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91880-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id h20-20020a170906111400b00a450430a014si2431822eja.197.2024.03.05.00.15.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 00:15:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-91880-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-91880-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91880-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 5EBB61F2216A for ; Tue, 5 Mar 2024 08:15:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C0DA47FBB1; Tue, 5 Mar 2024 08:13:38 +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 A71197F46A; Tue, 5 Mar 2024 08:13:35 +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=1709626418; cv=none; b=V1SRk22hdPmrI63w+AbrYTAS7xEP5angUiBic6pVPXpiJG9nzVi7eH92I+t1/PoSA7zHJQWlFpSQVR42Hh0Iv0c56xl+f9JiWsaDjb7GUjRbl5muOiOS5jeF7RuVeCsoCW6CS8u5LZ7tZWnn0J3ryH8/DeeOFPXvvYERHBR5RVI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709626418; c=relaxed/simple; bh=iYtQ7w6OR03PpXoCi1pmT13C/mStvkKFlUXkTHPzHiE=; h=Subject:To:Cc:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=aRQ7t0+B4xDLy5kkeApdxaMurU+a7cdoKp/ZMw6kLWA+n0DIgSLUydJHNBlYZ3YrsBj+XeE5QPI0DObw5NVQmz0vtpDkJNzrygOlA0E5bspJ4IHYwcscgqytFLJU+gFm9RYbUZeqYjvdPI5ACsff0hvyF/2UKGQZanCI1VjApAg= 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 4TppGr6dpkz4f3m7Y; Tue, 5 Mar 2024 16:13:24 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 675171A016E; Tue, 5 Mar 2024 16:13:32 +0800 (CST) Received: from [10.174.176.73] (unknown [10.174.176.73]) by APP1 (Coremail) with SMTP id cCh0CgDHlxAq1OZlzJIBGA--.18003S3; Tue, 05 Mar 2024 16:13:32 +0800 (CST) Subject: Re: [PATCH md-6.8 v2 2/9] md: export helpers to stop sync_thread To: Paul Menzel , Yu Kuai Cc: xni@redhat.com, zkabelac@redhat.com, agk@redhat.com, snitzer@kernel.org, mpatocka@redhat.com, dm-devel@lists.linux.dev, song@kernel.org, heinzm@redhat.com, jbrassow@redhat.com, neilb@suse.de, linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, yi.zhang@huawei.com, yangerkun@huawei.com, "yukuai (C)" References: <20240305072306.2562024-1-yukuai1@huaweicloud.com> <20240305072306.2562024-3-yukuai1@huaweicloud.com> From: Yu Kuai Message-ID: <9950cb96-ac8b-d7dd-56a0-133709f51b5f@huaweicloud.com> Date: Tue, 5 Mar 2024 16:13:30 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-CM-TRANSID:cCh0CgDHlxAq1OZlzJIBGA--.18003S3 X-Coremail-Antispam: 1UD129KBjvJXoWxCr45Jw1xGryfJw1rCF1UAwb_yoW5Kr4Dpr WvqF95ArWayrZ3Zr17Xa4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ear Kuai, > > > Thank you for your patch. > > Am 05.03.24 um 08:22 schrieb Yu Kuai: >> From: Yu Kuai >> >> The new heleprs will be used in dm-raid in later patches to fix > > hel*pe*rs > >> regressions and prevent calling md_reap_sync_thread() directly. > > Please list the new functions. > > 1.  md_idle_sync_thread(struct mddev *mddev); > 2.  md_frozen_sync_thread(struct mddev *mddev); > 3.  md_unfrozen_sync_thread(struct mddev *mddev); > > I do not like the naming so much. `md_reap_sync_thread()` has the verb > in imperative mood. At least myself, I would not know what the functions > do exactly without looking at the implementation. > Thanks for the suggestions, I'm not that good at naming :( Usually I'll send a new version with updated naming, however, we must merge this set ASAP now, perhaps can we live with this for now? Thanks, Kuai > > Kind regards, > > Paul > > >> Signed-off-by: Yu Kuai >> Signed-off-by: Xiao Ni >> Acked-by: Mike Snitzer >> --- >>   drivers/md/md.c | 29 +++++++++++++++++++++++++++++ >>   drivers/md/md.h |  3 +++ >>   2 files changed, 32 insertions(+) >> >> diff --git a/drivers/md/md.c b/drivers/md/md.c >> index 23f31fd1d024..22e7512a5b1e 100644 >> --- a/drivers/md/md.c >> +++ b/drivers/md/md.c >> @@ -4919,6 +4919,35 @@ static void stop_sync_thread(struct mddev >> *mddev, bool locked, bool check_seq) >>           mddev_lock_nointr(mddev); >>   } >> +void md_idle_sync_thread(struct mddev *mddev) >> +{ >> +    lockdep_assert_held(&mddev->reconfig_mutex); >> + >> +    clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); >> +    stop_sync_thread(mddev, true, true); >> +} >> +EXPORT_SYMBOL_GPL(md_idle_sync_thread); >> + >> +void md_frozen_sync_thread(struct mddev *mddev) >> +{ >> +    lockdep_assert_held(&mddev->reconfig_mutex); >> + >> +    set_bit(MD_RECOVERY_FROZEN, &mddev->recovery); >> +    stop_sync_thread(mddev, true, false); >> +} >> +EXPORT_SYMBOL_GPL(md_frozen_sync_thread); >> + >> +void md_unfrozen_sync_thread(struct mddev *mddev) >> +{ >> +    lockdep_assert_held(&mddev->reconfig_mutex); >> + >> +    clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); >> +    set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); >> +    md_wakeup_thread(mddev->thread); >> +    sysfs_notify_dirent_safe(mddev->sysfs_action); >> +} >> +EXPORT_SYMBOL_GPL(md_unfrozen_sync_thread); >> + >>   static void idle_sync_thread(struct mddev *mddev) >>   { >>       mutex_lock(&mddev->sync_mutex); >> diff --git a/drivers/md/md.h b/drivers/md/md.h >> index 8d881cc59799..437ab70ce79b 100644 >> --- a/drivers/md/md.h >> +++ b/drivers/md/md.h >> @@ -781,6 +781,9 @@ extern void md_rdev_clear(struct md_rdev *rdev); >>   extern void md_handle_request(struct mddev *mddev, struct bio *bio); >>   extern int mddev_suspend(struct mddev *mddev, bool interruptible); >>   extern void mddev_resume(struct mddev *mddev); >> +extern void md_idle_sync_thread(struct mddev *mddev); >> +extern void md_frozen_sync_thread(struct mddev *mddev); >> +extern void md_unfrozen_sync_thread(struct mddev *mddev); >>   extern void md_reload_sb(struct mddev *mddev, int raid_disk); >>   extern void md_update_sb(struct mddev *mddev, int force); > . >