From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F954C433ED for ; Wed, 28 Apr 2021 12:26:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DD58C6141E for ; Wed, 28 Apr 2021 12:26:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235932AbhD1M1d (ORCPT ); Wed, 28 Apr 2021 08:27:33 -0400 Received: from mx2.suse.de ([195.135.220.15]:39910 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235298AbhD1M1a (ORCPT ); Wed, 28 Apr 2021 08:27:30 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 7297BB156; Wed, 28 Apr 2021 12:26:44 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 3B4221E150F; Wed, 28 Apr 2021 14:26:44 +0200 (CEST) Date: Wed, 28 Apr 2021 14:26:44 +0200 From: Jan Kara To: Christophe JAILLET Cc: jack@suse.com, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH] quota: Use 'hlist_for_each_entry' to simplify code Message-ID: <20210428122644.GD25222@quack2.suse.cz> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 28-04-21 10:44:19, Christophe JAILLET wrote: > Use 'hlist_for_each_entry' instead of hand writing it. > This saves a few lines of code. > > Signed-off-by: Christophe JAILLET > --- > Compile tested only > --- > fs/quota/dquot.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) Thanks for the cleanup. It looks good. I'll queue it to my tree after the merge window closes (i.e., in about two weeks). Honza > > diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c > index 4f1373463766..22d904bde6ab 100644 > --- a/fs/quota/dquot.c > +++ b/fs/quota/dquot.c > @@ -288,14 +288,12 @@ static inline void remove_dquot_hash(struct dquot *dquot) > static struct dquot *find_dquot(unsigned int hashent, struct super_block *sb, > struct kqid qid) > { > - struct hlist_node *node; > struct dquot *dquot; > > - hlist_for_each (node, dquot_hash+hashent) { > - dquot = hlist_entry(node, struct dquot, dq_hash); > + hlist_for_each_entry(dquot, dquot_hash+hashent, dq_hash) > if (dquot->dq_sb == sb && qid_eq(dquot->dq_id, qid)) > return dquot; > - } > + > return NULL; > } > > -- > 2.30.2 > -- Jan Kara SUSE Labs, CR