Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp329358lqp; Tue, 11 Jun 2024 06:04:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWXrr7TavHHjGjW5G4gDEUTkOzOfH0qJG7kgxu9mn5aB3mOsToODCJkSOznFr8VtGCVuZS2EOu8b7btQ68vNzRuWzcuGvx+JZlEeD03iQ== X-Google-Smtp-Source: AGHT+IFzHW48OteDIHfmcXkO7IvKjdrnCRcZq+0F7iIlJEb2Z5O7YXps+v6NRcl+UCMhu9T/gJMn X-Received: by 2002:a17:90a:5b14:b0:2bd:744a:1131 with SMTP id 98e67ed59e1d1-2c2bcc65362mr11911466a91.30.1718111097180; Tue, 11 Jun 2024 06:04:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718111097; cv=pass; d=google.com; s=arc-20160816; b=0/TzkawSZecnG/QoTMksggxuNJg1esxs8zKVPKT2QzOS8hyo8xrL+pwC0IOmqm8ASb 3n8AimXrt28o3dWX6WDXL7K+13plWmQuNqXVHLZBIYFKU+e5kRZstgyqGreWAevtfZxq p9PX9fOk273P03T7xbSMgv0mkaMBb6wSEeUxbO+HSlTlzdH6zNbkvnbz5ylatAt1zaKr cfTfBw03cUNaPzsQcZ8Ycthy4DZitKYtr21SKqL2WQpeUl3rFrtu956cVNKin0SrMkS+ KXqA4iWKT89xp9ioJBEaYtI55YEywBhU686fnJCgkeOoDJPcWZyZ1kao+3gbaa4aGFI5 uTUg== 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 :subject:cc:to:from:date:dkim-signature; bh=sDTg+rMTl+NA+uSp1v5RF/D2npGsrEhWECmY2861LwY=; fh=I13TBw1lBuryJ0/+PI1+7VsbUx+LNgwhpTHWE6aWRC8=; b=bq1OkYweQaEwPfK3e/BhYEnjqMhqfmcCDpep0MqEgiQt/FVrfxj8tV3+IfsFoxESS6 //HY3NZxx98/1g72SoJHx0Tzt5Chb+O1rw3/HHF50zAnZyold5w0e0PGj8B6m1H6PU3c 0qlUm4ubyzrlsJBDajXRaZLXz6qX8GNZqOGH2LH7peed1e3Ewmiqto2km0Dl3/z+KTTn XV0T9+hjakn5INZdC65qJmNdZerbPezCvfS6U2r5khsjm7j/EnIfPnA0ORkpbnJa6bIL ttQKwpjqvXav0V/Dl4BOrsKmSApfqWQCo6+NFfIKXQ0kNCj0d+9sqtbO/v/G/FmiHwJv mVSg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nXPvm9Jb; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-209481-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209481-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2c28066ea56si11172383a91.62.2024.06.11.06.04.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 06:04:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-209481-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nXPvm9Jb; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-209481-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209481-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 75FC0B2A921 for ; Tue, 11 Jun 2024 08:31:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 252FB174EFF; Tue, 11 Jun 2024 08:31:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="nXPvm9Jb" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.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 F205B47772; Tue, 11 Jun 2024 08:31:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718094696; cv=none; b=DJEpQNOwQP1AocvkWbLSrhdYEh5tX0mYPtD66IsUj5PAHxZ0LpdHkUWGaZZX3vmtHI4PcbtQYPWPaeGkGcCZ2t0OFlqixQELxsK5lMMYCipd8AE1uFar1uQ+ZBIETnooPFA+nDeGijl7NdDFvKTfomciMp57EltyOZVN9VNnjag= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718094696; c=relaxed/simple; bh=wpXcbORh+1wj0dP3PDcCLU455xdM3PvTHmev7n0Dpi4=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=J+vfJ35ebCPEtg8HEOLawSSLtAO8toJc0UrvKNnIVw6MmJStH7wM8TR1KvTN32EHtGZiHqmRg4wThP4Np9bZkMTSWHbQJeHWQLnBDZxPVgD8G1i2JLYzrZC0egdT3Fv3a5J5abqxpIYAIhHMf58XO6KvmuMx40WDS07yTAEwGZY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=nXPvm9Jb; arc=none smtp.client-ip=198.175.65.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1718094696; x=1749630696; h=date:from:to:cc:subject:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=wpXcbORh+1wj0dP3PDcCLU455xdM3PvTHmev7n0Dpi4=; b=nXPvm9JbkXrJKwBhp0lFnZ1Vv5zIp6SPMxLF7SvpbBdeVlE43V/D7X46 mQkWqaQqgh6mI0IPzZWA5svJmC7GTOMN2heIWyCjVKSo7e9xOpR24bcgn jkaJmuFFvHeYcovBhN8F1nLo8SZ+o9f5djU68fU+6Vau/5E0qN/FfSJpK pkHhsaclGC2Qzs0DwY16GA6UG/0c70RYEtCB1H8U3BFz710NmeUxw5WfB 0Xl/Puic9TCtEje9x8YG2gjBGcZ2ciOnoYpJrVqa3dm1EvwoJgJ8Ll7sN p9cGV93rhvowb01+CBZy4/S8Kgrl6Nt6JLGUkjIlVXN3LlUSfWaqzCzpt A==; X-CSE-ConnectionGUID: q68OvUamQv+ARa9bwIoX9A== X-CSE-MsgGUID: IVHbXrDYR62GKa/qTnTmGw== X-IronPort-AV: E=McAfee;i="6600,9927,11099"; a="25369291" X-IronPort-AV: E=Sophos;i="6.08,229,1712646000"; d="scan'208";a="25369291" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jun 2024 01:31:35 -0700 X-CSE-ConnectionGUID: 21/u/m45QGalCO9X+iVVNA== X-CSE-MsgGUID: d/bcU8KTS0il3nu5lHAZpA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,229,1712646000"; d="scan'208";a="39426247" Received: from mtkaczyk-mobl.ger.corp.intel.com (HELO localhost) ([10.246.38.248]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jun 2024 01:31:31 -0700 Date: Tue, 11 Jun 2024 10:31:26 +0200 From: Mariusz Tkaczyk To: Yu Kuai Cc: , , , , , , , , , , , Subject: Re: [PATCH 02/12] md: add a new enum type sync_action Message-ID: <20240611103126.00003ee0@linux.intel.com> In-Reply-To: <20240603125815.2199072-3-yukuai3@huawei.com> References: <20240603125815.2199072-1-yukuai3@huawei.com> <20240603125815.2199072-3-yukuai3@huawei.com> X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Mon, 3 Jun 2024 20:58:05 +0800 Yu Kuai wrote: > In order to make code related to sync_thread cleaner in following > patches, also add detail comment about each sync action. And also > prepare to remove the related recovery_flags in the fulture. > > Signed-off-by: Yu Kuai > --- > drivers/md/md.h | 57 ++++++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 56 insertions(+), 1 deletion(-) > > diff --git a/drivers/md/md.h b/drivers/md/md.h > index 170412a65b63..6b9d9246f260 100644 > --- a/drivers/md/md.h > +++ b/drivers/md/md.h > @@ -34,6 +34,61 @@ > */ > #define MD_FAILFAST (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT) > > +/* Status of sync thread. */ > +enum sync_action { > + /* > + * Represent by MD_RECOVERY_SYNC, start when: > + * 1) after assemble, sync data from first rdev to other copies, this > + * must be done first before other sync actions and will only execute > + * once; > + * 2) resize the array(notice that this is not reshape), sync data > for > + * the new range; > + */ > + ACTION_RESYNC, > + /* > + * Represent by MD_RECOVERY_RECOVER, start when: > + * 1) for new replacement, sync data based on the replace rdev or > + * available copies from other rdev; > + * 2) for new member disk while the array is degraded, sync data from > + * other rdev; > + * 3) reassemble after power failure or re-add a hot removed rdev, > sync > + * data from first rdev to other copies based on bitmap; > + */ > + ACTION_RECOVER, > + /* > + * Represent by MD_RECOVERY_SYNC | MD_RECOVERY_REQUESTED | > + * MD_RECOVERY_CHECK, start when user echo "check" to sysfs api > + * sync_action, used to check if data copies from differenct rdev are > + * the same. The number of mismatch sectors will be exported to user > + * by sysfs api mismatch_cnt; > + */ > + ACTION_CHECK, > + /* > + * Represent by MD_RECOVERY_SYNC | MD_RECOVERY_REQUESTED, start when > + * user echo "repair" to sysfs api sync_action, usually paired with > + * ACTION_CHECK, used to force syncing data once user found that > there > + * are inconsistent data, > + */ > + ACTION_REPAIR, > + /* > + * Represent by MD_RECOVERY_RESHAPE, start when new member disk is > added > + * to the conf, notice that this is different from spares or > + * replacement; > + */ > + ACTION_RESHAPE, > + /* > + * Represent by MD_RECOVERY_FROZEN, can be set by sysfs api > sync_action > + * or internal usage like setting the array read-only, will forbid > above > + * actions. > + */ > + ACTION_FROZEN, > + /* > + * All above actions don't match. > + */ > + ACTION_IDLE, > + NR_SYNC_ACTIONS, > +}; I like if counter is keep in same style as rest enum values, like ACTION_COUNT. Anyway LGTM. Mariusz