Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp1137811lqs; Wed, 6 Mar 2024 07:22:27 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVAGTa67GK5a0FxQB0B6s5+xebWhdxdFU4yBVaEBmKu43UV91Z9MMdCt7N1z/zwIt8kPafCe435So5nkRzD29b0pZ2QxjvFm5lVpwdDoA== X-Google-Smtp-Source: AGHT+IGQPYVQVRa4/HshYg8wDdI/+LJricf5Xt1/40jUWSuV9pIVnhdm7ZXaVzTdJkSDgEcQ6ahd X-Received: by 2002:a17:906:394c:b0:a44:e3d:68a8 with SMTP id g12-20020a170906394c00b00a440e3d68a8mr11270550eje.45.1709738547431; Wed, 06 Mar 2024 07:22:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709738547; cv=pass; d=google.com; s=arc-20160816; b=nr5+sneii8qhxG3bgoyC0fofzvv3eGv4nvBWl6IhCQ3c0tB6cV60Wc4edS1bmrHtFA rNcXk9X5mLpKFE85s9VwcBuXphOh1ujWskKc3fhM0Krqyz8tUCjTlYaaQPFOIINT5Ldf MMQSvGsOa3toIN2gFPkTnqD2+VELSSobfkvFCRvZ7Ex4494A/OHv1wOCgzueZ9g+Bcgy gnI47X5pdOyBWFk9gQHo+0rOOV4/5Rc/FE7l0MlUFW7+WCE/b/tNE9YrCSZS2jOeKsjG HT+uMyLls4F9oTt+ULZePXJ1rGHsg9IHFnIwdrlxPj9Bbr41W7arTxA9bSVkX6YZcHau Kvmg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=uEOv1ZYZzrGhQIpAhLkVeWRgZjGaVcmD270s1MR1C1U=; fh=NmLblq95k7jyS/5YCWaw79iVQLR8dJ4VmdBS3lcjykc=; b=StIBwwgM8F29T+C5SiIyUM9MhiwX+xcKCre9n1x6IOch5F0cw51LauiAbOqgXbxYEI SexRlc7ohmk/Ivbz1s3iNszIxzJF3QGJQJ+HzU5PTqL9C3lydhe/VfU7GRDVq0c+6ojk RCIe6h2QpACGXIR3zhwLUbqLwWHq3HEIyxW2TznKhA2Wfg5yj9+uteFzut6scXY9E82F LKLXDnTXnsC35RkFdiPaA213FIFoq8Lf3ezpHdjcBuftp3RKdHiEdnxTkFssBAm2NDCw GfKLXV466oZjAdBfywDIkqbFaALhSNsuphDJkrRPwlMLsxHpWl2CWY1dZZpM1cE29AT/ FfVQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=molgen.mpg.de); spf=pass (google.com: domain of linux-kernel+bounces-94135-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-94135-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 j23-20020a170906255700b00a44a08854ecsi4756436ejb.80.2024.03.06.07.22.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 07:22:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-94135-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=molgen.mpg.de); spf=pass (google.com: domain of linux-kernel+bounces-94135-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-94135-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 2557E1F2C102 for ; Wed, 6 Mar 2024 15:12:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B454C135A7F; Wed, 6 Mar 2024 15:11:06 +0000 (UTC) Received: from mx3.molgen.mpg.de (mx3.molgen.mpg.de [141.14.17.11]) (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 72941134CF7; Wed, 6 Mar 2024 15:11:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=141.14.17.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709737866; cv=none; b=Qo9sNH2mDkt7pkbLLDfHzij7wBAerhI50FcNSjJ5JS25PRqzeFmZ24tfjFfg4b27ugGhK7HNl+lkfmBcfn48iUXYzUMWNKsmdceq9b0cfRPAiw4SuO6XJBkH/4CSpJsiCEWQ15GF5dsUMiiwcWTvBWxq0Xpy5w+AqEHyY7k1cXg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709737866; c=relaxed/simple; bh=JYpMEoOzZQs3yAFQY3yegUBgCw5BXctmdMIzmY4XVNU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=aUg014CLiH4Wbpu3O6+I0fz4aj9thTpibQt/p+o2FKnZ44uK5oXWehmO9ojqTqO8YAiI4mHEgAp/b58zpfXOgTXN0si+8wg8loF0+CPkF5zSne3QedjI/xvj5mc6oOT9QOFrVMxuPxoJOo4nDyt/gD7LRu4CAoYLyQtuzrAeEko= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=molgen.mpg.de; spf=pass smtp.mailfrom=molgen.mpg.de; arc=none smtp.client-ip=141.14.17.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=molgen.mpg.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=molgen.mpg.de Received: from [192.168.0.224] (ip5f5aedd4.dynamic.kabel-deutschland.de [95.90.237.212]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: pmenzel) by mx.molgen.mpg.de (Postfix) with ESMTPSA id 96BB861E5FE01; Wed, 6 Mar 2024 16:10:05 +0100 (CET) Message-ID: Date: Wed, 6 Mar 2024 16:10:04 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH md-6.8 v2 2/9] md: export helpers to stop sync_thread Content-Language: en-US To: 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, yukuai3@huawei.com References: <20240305072306.2562024-1-yukuai1@huaweicloud.com> <20240305072306.2562024-3-yukuai1@huaweicloud.com> <9950cb96-ac8b-d7dd-56a0-133709f51b5f@huaweicloud.com> From: Paul Menzel In-Reply-To: <9950cb96-ac8b-d7dd-56a0-133709f51b5f@huaweicloud.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Dear Kuai, Am 05.03.24 um 09:13 schrieb Yu Kuai: > 在 2024/03/05 16:08, Paul Menzel 写道: >> 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? Fine by me. Maybe when applying the typo can be fixed, and the naming than later. 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);