Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2772563imm; Sun, 12 Aug 2018 23:33:23 -0700 (PDT) X-Google-Smtp-Source: AA+uWPz/GLDJ0vuUY2tlQayjKGjJ/D5mAPvb7zmL0sLtceIK5dmQk0NRPV79CRJ3Qrm428jO9vGC X-Received: by 2002:a65:64c8:: with SMTP id t8-v6mr15743158pgv.110.1534142003334; Sun, 12 Aug 2018 23:33:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534142003; cv=none; d=google.com; s=arc-20160816; b=B78E8nbYv4KChdxy/j5x5CYmerzoiF937WZFzmc92+M1iZoZNtc2myHr29Pgj/cC9n up3Le+c7iIrtPuUiW/fBLr0tkwwHiWfjWuw6yz5lHJinB1PFYI3BYb5zzzUbo3AE2jlL QWdvmE78BAulUaC5POsPAPRYxkqSCK0XJwhFzt5kFLD7opeqjMYZqLXX882EVCBSESjy fjRqKmPBzUmxo+XaDnkhhv19J5q9Tnsxgbn2KZdnM4UawuM6KXHfDyr6CwnrHW3p0nIB 0viLYp30sJJytfjm8bYJ/LpDn8Bf95foSApRH/R1AyATXSHtx2HOW6rxNlpc0hvXXq4Q WSJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=q+/ChvElb8LzAVCD8vwIM6/8/UxFV/asYLSgxnFTKm8=; b=xQH2r3T8KnzQtg/unkOQyKvQT5QMUG8nNPkpIBYshUKoovOMWTQhLvmH4uyVy/9D1E R19mD9RCMC+c8KiAY0MgpdTUr+D3DcsQslguKpu41AirWi49PAj3LQSsD/Ys5kV++qTr V743qReujqnRmfuK2bS/XTxrd14H7/0kEjyGciGXQfTHpI7vK2OBUpTvMoUt61vGw43w rn2hMcEWVIBcjfxsxsTKSP9gpzJPWfGNBqmQsHVhGZ5i77mLHBW6BeeJFniHig2xR+1o fr0Afvn8lU0lUeyy/5A+XXgg02l/IKaCk9Y8qfwEKVBfbzvIQ11/YwXOohKDYPoBxdmp AVVg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q16-v6si17863921pfi.183.2018.08.12.23.33.08; Sun, 12 Aug 2018 23:33:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728374AbeHMJMa (ORCPT + 99 others); Mon, 13 Aug 2018 05:12:30 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:60599 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726345AbeHMJMa (ORCPT ); Mon, 13 Aug 2018 05:12:30 -0400 Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1fp6O0-0000Lx-EW; Mon, 13 Aug 2018 08:31:28 +0200 Received: from sha by ptx.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1fp6Nz-0004Rb-SN; Mon, 13 Aug 2018 08:31:27 +0200 Date: Mon, 13 Aug 2018 08:31:27 +0200 From: Sascha Hauer To: linux-mtd@lists.infradead.org Cc: Richard Weinberger , David Gstir , linux-kernel@vger.kernel.org, kernel@pengutronix.de Subject: Re: [PATCH 05/25] ubifs: implement ubifs_lpt_lookup using ubifs_pnode_lookup Message-ID: <20180813063127.kpxw6d5amna5wpas@pengutronix.de> References: <20180704124137.13396-1-s.hauer@pengutronix.de> <20180704124137.13396-6-s.hauer@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180704124137.13396-6-s.hauer@pengutronix.de> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-Uptime: 08:29:21 up 61 days, 15:38, 52 users, load average: 0.00, 0.05, 0.07 User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: sha@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 04, 2018 at 02:41:17PM +0200, Sascha Hauer wrote: > ubifs_lpt_lookup() starts by looking up the nth pnode in the LPT. We > already have this functionality in ubifs_pnode_lookup(). Use this > function rather than open coding its functionality. > > Signed-off-by: Sascha Hauer > --- > fs/ubifs/lpt.c | 20 ++------------------ > 1 file changed, 2 insertions(+), 18 deletions(-) > > diff --git a/fs/ubifs/lpt.c b/fs/ubifs/lpt.c > index 6cd6f23d4512..cde7b9484157 100644 > --- a/fs/ubifs/lpt.c > +++ b/fs/ubifs/lpt.c > @@ -1478,27 +1478,11 @@ struct ubifs_pnode *ubifs_pnode_lookup(struct ubifs_info *c, int i) > */ > struct ubifs_lprops *ubifs_lpt_lookup(struct ubifs_info *c, int lnum) > { > - int err, i, h, iip, shft; > - struct ubifs_nnode *nnode; > + int i, iip; > struct ubifs_pnode *pnode; > > - if (!c->nroot) { > - err = ubifs_read_nnode(c, NULL, 0); > - if (err) > - return ERR_PTR(err); > - } > - nnode = c->nroot; > i = lnum - c->main_first; > - shft = c->lpt_hght * UBIFS_LPT_FANOUT_SHIFT; > - for (h = 1; h < c->lpt_hght; h++) { > - iip = ((i >> shft) & (UBIFS_LPT_FANOUT - 1)); > - shft -= UBIFS_LPT_FANOUT_SHIFT; > - nnode = ubifs_get_nnode(c, nnode, iip); > - if (IS_ERR(nnode)) > - return ERR_CAST(nnode); > - } > - iip = ((i >> shft) & (UBIFS_LPT_FANOUT - 1)); > - pnode = ubifs_get_pnode(c, nnode, iip); > + pnode = ubifs_pnode_lookup(c, i); This should be ubifs_pnode_lookup(c, i >> UBIFS_LPT_FANOUT_SHIFT); Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |