Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7826963rdb; Thu, 4 Jan 2024 08:51:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IGgw0QVzrkbrE3xGJCbZAkBD+vu1i66KOgRQIF2t+7wrqwp6pWEBp9n++M4huIb1K5CKXpf X-Received: by 2002:a05:620a:294a:b0:781:b14d:29e5 with SMTP id n10-20020a05620a294a00b00781b14d29e5mr1011873qkp.89.1704387083590; Thu, 04 Jan 2024 08:51:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704387083; cv=none; d=google.com; s=arc-20160816; b=FBb2ziVibNEl/o/AkBFHRTVRx1LnEpmlsagJ3SdNf2axznROEE8n0fwx4TYCQL19zs sk1s4vPhQU65opEZZbmjbL0x+S3esY/RvjuZZGkCZ0RXLx4x5lchJjcEfcpSP1I6RRR8 uvGQs3JGiagr9U8QRpyF5yGPDsass8ENkoTK5bo7PoqzXPRJjOlv7T4ZfH1myA2vnfIw EuZSkBjCI97gvhuiPnQxWW3LjWiCmCVABB0S7LbXvJdfjDnxzwb/XY00uvAw1D3/qPJ8 AQP/nh2Z9hI9ZRrAgU7pNYMc65hbJmAFFOjYkLDDH4WH+nzLdzqIySn9m5tirGb8XzEB Nh7w== ARC-Message-Signature: i=1; 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=tEitJmK2gP22zhZl8G0ZM21fMnrzjgBm57i4+Z8o9ks=; fh=WnvTElNlEQk4UtgNVd1wjQOgsCAyArJ2eenrGoTFFF8=; b=yEDJSUOXO0fTyhssYT6GQf4JaBVkvzByLE6tBQUbjR71p8eA7YO10SwO4LpvWHdoBu 2GWOeWey7xFven0tPP8s7+EA0T92MBPP40FD9Bv6kXCyRvpxrVfzUfAddX4Ca0BUyppg xam2+MyGtUufpfj1PvcSfvt8bbPZlfEF1sRQNsTKo+tRFY501VhqrEoJhyFh+mTuvzg/ XSvd72NmKkkPdq7QbSkTqmlfH7uivIYVreVsvcsyIpFQi1O8YucUqQUO6I7R73YQD5R9 99pdCYzYREUW3zSQHxzgw1iQxfci/V1/6C1Ab/4EXs3Yy4QjB7AXUjrtEGaoFZu8sZPn Xakw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-16971-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16971-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id az11-20020a05620a170b00b007815f8c79b9si19933536qkb.387.2024.01.04.08.51.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 08:51:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-16971-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-16971-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16971-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 5B9681C222DC for ; Thu, 4 Jan 2024 16:51:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6D248249E8; Thu, 4 Jan 2024 16:50:48 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org 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: 8bit Make use of the newly added hlist_count_nodes(). Signed-off-by: Pierre Gondois --- 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_set *c) for (h = c->bucket_hash; h < c->bucket_hash + (1 << BUCKET_HASH_BITS); h++) { - unsigned int i = 0; - struct hlist_node *p; - - hlist_for_each(p, h) - i++; - - ret = max(ret, i); + ret = max(ret, hlist_count_nodes(h)); } mutex_unlock(&c->bucket_lock); -- 2.25.1