Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3006493imm; Mon, 13 Aug 2018 04:31:20 -0700 (PDT) X-Google-Smtp-Source: AA+uWPx2mFuJXPUGKzGeMc6HAblpNOu7mtOpZ6qeWUZGq3nQBrgvlO5iHm3HSbflVYOuDDXuCVb7 X-Received: by 2002:a63:4857:: with SMTP id x23-v6mr17098809pgk.30.1534159880317; Mon, 13 Aug 2018 04:31:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534159880; cv=none; d=google.com; s=arc-20160816; b=zbCh8Qbfux0P7HLezj6CRb/ORyx0OJiUTk41sfPIEgGvpeC3jqSI4BNH/mr33NkH42 kQO+s0cyM8jVOvdfTt1W9T+ChM2peOPc32RnjyjyRyR2ltYg8p58CQT9HxwKiezcCaa3 esXXzskRRIBpAqdAISOzc6t3lEA20nVvhlfkRwN1BqhCq3AeUIgR/aL8q6Mz2btG7oMs ifrmeV2LUyn96GgHw/DAPK9V0OtKEq82kaBht06nOPEXAj/G16kLwnGNofUbkBdI8ypz yZaMea5fpJAAWDMNmMtFC6cSWq6Vt4Uj4BXTH0wgeXfkf/zasbF9VwJkhQLyPJAcISAz lIDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Q66ShazPsh5foJU+tjDu89BFIy9P68qdnDzjkBd6QEk=; b=CKUkejwvNeyP2JoAnoIzgg/a5XZf6wqGe7KPcjODj7+cGSvpyDFBgH6nfNesEutI9m DRYIty/6HRkL25fj8EHIEtJFfJvofyCXrJd/7QIKv2YY8oNwa+QAm80Q8lSZ0lmwi/fF ZJkV8Grjk8FPz+mUKmBFYljWl9HHk7oceFZ4LOPg4I5nTyN/xWEfDGY015AoxuZT3i/Y VToAL0BGwKkt1TUjzI0KJ7LGek0f61A1CaKsKP5hrarI7rhYRLslOYURKENlUspCb7Mc iaCgPQsc/2nNQSSaf/Ht5b7YJ1JyI/ROVaVltdu9aUOW0j8YMnaxMmPs0bzsl8dsBo5u cpRQ== 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 s12-v6si13415842plp.464.2018.08.13.04.31.05; Mon, 13 Aug 2018 04:31:20 -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 S1728840AbeHMOMH (ORCPT + 99 others); Mon, 13 Aug 2018 10:12:07 -0400 Received: from lithops.sigma-star.at ([195.201.40.130]:50998 "EHLO lithops.sigma-star.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728461AbeHMOMH (ORCPT ); Mon, 13 Aug 2018 10:12:07 -0400 Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id 323FC6088978; Mon, 13 Aug 2018 13:30:14 +0200 (CEST) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id vV0K9XRPpUNM; Mon, 13 Aug 2018 13:30:13 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id DE4936088980; Mon, 13 Aug 2018 13:30:13 +0200 (CEST) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id gC7G4ax4TNfU; Mon, 13 Aug 2018 13:30:13 +0200 (CEST) Received: from blindfold.localnet (unknown [82.150.214.1]) by lithops.sigma-star.at (Postfix) with ESMTPSA id A22556088978; Mon, 13 Aug 2018 13:30:13 +0200 (CEST) From: Richard Weinberger To: Sascha Hauer Cc: linux-mtd@lists.infradead.org, David Gstir , linux-kernel@vger.kernel.org, kernel@pengutronix.de Subject: Re: [PATCH 05/25] ubifs: implement ubifs_lpt_lookup using ubifs_pnode_lookup Date: Mon, 13 Aug 2018 13:30:13 +0200 Message-ID: <3522568.rp1UpMI3Wl@blindfold> In-Reply-To: <20180813081238.crujoer2qprhn27y@pengutronix.de> References: <20180704124137.13396-1-s.hauer@pengutronix.de> <8387142.nbJ7LYRgBX@blindfold> <20180813081238.crujoer2qprhn27y@pengutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am Montag, 13. August 2018, 10:12:38 CEST schrieb Sascha Hauer: > > Can you please add a helper function for that? These shift games are > > always confusing and not easy to spot. > > Do you have a suggestion for a helper function? lpt.c is full of rather > non obvious arithmetic operations and I couldn't find a helper function > that could be reused at least once in the code. > > I tried with: > > static int lnum_to_pnode_num(struct ubifs_info *c, int lnum) > { > return (lnum - c->main_first) >> UBIFS_LPT_FANOUT_SHIFT; > } > > But I am not sure this really improves things I had exactly such helpers in mind. The lpt code translates often LEB numbers in both direction. So, the helpers should have more than one user. Long story short, I don't force you to add such helper and such. Just thought while you are here you can try to make the code more readable. I think we both agree that lpt.c is not really review friendly. ;) Thanks, //richard