From nobody Fri Dec 26 15:33:16 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BEA8B25569; Thu, 4 Jan 2024 16:50:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 12DDE1007; Thu, 4 Jan 2024 08:51:32 -0800 (PST) Received: from e126645.arm.com (unknown [10.57.76.27]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 412BC3F64C; Thu, 4 Jan 2024 08:50:42 -0800 (PST) From: Pierre Gondois To: linux-kernel@vger.kernel.org Cc: Pierre Gondois , Greg Kroah-Hartman , =?UTF-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= , Todd Kjos , Martijn Coenen , Joel Fernandes , Christian Brauner , Carlos Llamas , Suren Baghdasaryan , Coly Li , Kent Overstreet , Marco Elver , Kees Cook , Lucas De Marchi , Ingo Molnar , Andy Shevchenko , linux-bcache@vger.kernel.org Subject: [PATCH v2 3/3] bcache: Use of hlist_count_nodes() Date: Thu, 4 Jan 2024 17:49:35 +0100 Message-Id: <20240104164937.424320-4-pierre.gondois@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240104164937.424320-1-pierre.gondois@arm.com> References: <20240104164937.424320-1-pierre.gondois@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Make use of the newly added hlist_count_nodes(). Signed-off-by: Pierre Gondois Acked-by: Coly Li --- drivers/md/bcache/sysfs.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c index a438efb66069..6956beb55326 100644 --- a/drivers/md/bcache/sysfs.c +++ b/drivers/md/bcache/sysfs.c @@ -702,13 +702,7 @@ static unsigned int bch_cache_max_chain(struct cache_s= et *c) for (h =3D c->bucket_hash; h < c->bucket_hash + (1 << BUCKET_HASH_BITS); h++) { - unsigned int i =3D 0; - struct hlist_node *p; - - hlist_for_each(p, h) - i++; - - ret =3D max(ret, i); + ret =3D max(ret, hlist_count_nodes(h)); } =20 mutex_unlock(&c->bucket_lock); --=20 2.25.1