Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp8142187rdb; Thu, 4 Jan 2024 22:54:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IEDwvmtk6BtMTgGa5AVOV3gHupW8q3gtanGZSI1aiy6EnCJChyTxTMzXSWIv6GtCd548k/J X-Received: by 2002:a17:906:348f:b0:a27:2d57:a9a with SMTP id g15-20020a170906348f00b00a272d570a9amr811273ejb.61.1704437660236; Thu, 04 Jan 2024 22:54:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704437660; cv=none; d=google.com; s=arc-20160816; b=iOKjHYmQV7xl13KisySgPAamK/uyeEZztSdeWjbLkNqpZa5dTcrerJnd1UqwsYXED6 LoogGOZlmvUy+T1WTJBP5QLZfnM/drPjg8bQ/VeSh1NrJ+R2Ndh+riedEQhEHb5Aqcla 2avKYu8fPalZ790/JKlA+s5UZa0f2IKozP2lMiYxmSBq8bpd9mLFpOkvXFcoErN9sd4W qT2AMb42RS3dDS9s3ZKRPS5RD0TiHJQhgb14XxobiuJL5UZFeIiMwAFAUT4o8tJc42pS 9rGAg1rgr8JL6Ut13SUKWTkOCM9e69ovj/KgmjqpaPEnwns0jEQg73mJC0ZFVxzk/9bw JoTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature:dkim-signature :dkim-signature; bh=GNR4qmyfrPzmJTZgxJg9wWBaUMtfuQeh/96F2dVyF20=; fh=8YBp579ejSiwySftl98Wi/dMgJaYxR0QXUU2LxAGmvg=; b=wY6KefOYZDfLUP8YU1E4r8BJ+M8YHg6ZJxBmwuEc3G29cAsXD894mwqFw4uQmEjO4H m40ZsWcFgP6xiSCjCNI7XSAlhNGy1DopF8GL9DHltOEJ4sD4Iz5dPa5T1sVzQ3ITF/om 2FLSGG5WjkMCtCsTmBfuN7xtf2FC3N/0uSrYKGVRlrXZt8KNRoI2ZsVtihL0jH6OGfrr /C6cUFjqwrxdi7xE+oIvFGWbwq4+7Quc4Chl7wC0/nFYJ3aROSm4eNKZlbKO/lPQf+lS lWekfXf7Dqi2IoJPVyqSMZsSY8NnEM6bTrsznduoqgVinaeDzeibrOdfZWxRm2mfKYf+ sV3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="TXBYAHQ/"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="TXBYAHQ/"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-kernel+bounces-17523-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17523-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id op5-20020a170906bce500b00a28e544e02dsi369844ejb.1016.2024.01.04.22.54.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 22:54:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-17523-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; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="TXBYAHQ/"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="TXBYAHQ/"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-kernel+bounces-17523-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17523-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de 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 0197B1F23678 for ; Fri, 5 Jan 2024 06:54:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3EB778C1C; Fri, 5 Jan 2024 06:54:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="TXBYAHQ/"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="/g2k3isD"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="TXBYAHQ/"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="/g2k3isD" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C2C921DDCA; Fri, 5 Jan 2024 06:54:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 9E359220D0; Fri, 5 Jan 2024 06:54:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1704437648; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=GNR4qmyfrPzmJTZgxJg9wWBaUMtfuQeh/96F2dVyF20=; b=TXBYAHQ/FY5Id6/SUcdltey2rb9Tg8llrOwL8T72wml6mVRzgU5ZVuYRp9YRGeTVhhVfTa ZQeV8Ib8dUj91PhPxD8hLbAAlcFhUAA64R+rCZUqFJVkNw2ST0s8vOwfc/0u3XNp+dqerX OY0hwHeY6qoZ+veBoI6//Gw+ya0Ffe0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1704437648; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=GNR4qmyfrPzmJTZgxJg9wWBaUMtfuQeh/96F2dVyF20=; b=/g2k3isDsX1Kzaf9TzZMfr2ZRoFFrGxnEdcoXh7ECd/gXSrwqVYU5Wxp/VJruaHeZ6fe+f zdxDKyE2cnZXEsBQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1704437648; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=GNR4qmyfrPzmJTZgxJg9wWBaUMtfuQeh/96F2dVyF20=; b=TXBYAHQ/FY5Id6/SUcdltey2rb9Tg8llrOwL8T72wml6mVRzgU5ZVuYRp9YRGeTVhhVfTa ZQeV8Ib8dUj91PhPxD8hLbAAlcFhUAA64R+rCZUqFJVkNw2ST0s8vOwfc/0u3XNp+dqerX OY0hwHeY6qoZ+veBoI6//Gw+ya0Ffe0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1704437648; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=GNR4qmyfrPzmJTZgxJg9wWBaUMtfuQeh/96F2dVyF20=; b=/g2k3isDsX1Kzaf9TzZMfr2ZRoFFrGxnEdcoXh7ECd/gXSrwqVYU5Wxp/VJruaHeZ6fe+f zdxDKyE2cnZXEsBQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 542A0137E8; Fri, 5 Jan 2024 06:54:02 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id BZFAAYqnl2UQJgAAD6G6ig (envelope-from ); Fri, 05 Jan 2024 06:54:02 +0000 Date: Fri, 5 Jan 2024 14:53:55 +0800 From: Coly Li To: Pierre Gondois Cc: linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Arve =?utf-8?B?SGrDuG5uZXbDpWc=?= , Todd Kjos , Martijn Coenen , Joel Fernandes , Christian Brauner , Carlos Llamas , Suren Baghdasaryan , Kent Overstreet , Marco Elver , Kees Cook , Jani Nikula , Lucas De Marchi , Ingo Molnar , Andy Shevchenko , linux-bcache@vger.kernel.org Subject: Re: [PATCH v2 1/3] list: Add hlist_count_nodes() Message-ID: <65qcwqfaicc2wrhf5mjrj24j3kep7yv7ezvv22ctrbwyoag43h@tu26mhauwc2u> References: <20240104164937.424320-1-pierre.gondois@arm.com> <20240104164937.424320-2-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-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20240104164937.424320-2-pierre.gondois@arm.com> X-Spam-Level: Authentication-Results: smtp-out1.suse.de; none X-Spamd-Result: default: False [0.70 / 50.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_RATELIMIT(0.00)[to_ip_from(RLrmm7d381faskkr1sa8sqxo77)]; RCVD_COUNT_THREE(0.00)[3]; NEURAL_HAM_SHORT(-0.20)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; BAYES_HAM(-0.00)[32.60%]; ARC_NA(0.00)[]; URIBL_BLOCKED(0.00)[arm.com:email,suse.de:email]; FROM_HAS_DN(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; NEURAL_HAM_LONG(-1.00)[-1.000]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_TWELVE(0.00)[18]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; MID_RHS_NOT_FQDN(0.50)[]; FREEMAIL_CC(0.00)[vger.kernel.org,linuxfoundation.org,android.com,joelfernandes.org,kernel.org,google.com,gmail.com,chromium.org,intel.com,linux.intel.com]; RCVD_TLS_ALL(0.00)[]; SUSPICIOUS_RECIPS(1.50)[] X-Spam-Level: X-Spam-Flag: NO X-Spam-Score: 0.70 On Thu, Jan 04, 2024 at 05:49:33PM +0100, Pierre Gondois wrote: > Add a function to count nodes in a hlist. hlist_count_nodes() > is similar to list_count_nodes(). > > Signed-off-by: Pierre Gondois Acked-by: Coly Li Thanks. > --- > include/linux/list.h | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > diff --git a/include/linux/list.h b/include/linux/list.h > index 1837caedf723..0f1b1d4a2e2e 100644 > --- a/include/linux/list.h > +++ b/include/linux/list.h > @@ -1175,4 +1175,19 @@ static inline void hlist_move_list(struct hlist_head *old, > pos && ({ n = pos->member.next; 1; }); \ > pos = hlist_entry_safe(n, typeof(*pos), member)) > > +/** > + * hlist_count_nodes - count nodes in the hlist > + * @head: the head for your hlist. > + */ > +static inline size_t hlist_count_nodes(struct hlist_head *head) > +{ > + struct hlist_node *pos; > + size_t count = 0; > + > + hlist_for_each(pos, head) > + count++; > + > + return count; > +} > + > #endif > -- > 2.25.1 > > -- Coly Li