[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3522568.rp1UpMI3Wl@blindfold>
Date: Mon, 13 Aug 2018 13:30:13 +0200
From: Richard Weinberger <richard@....at>
To: Sascha Hauer <s.hauer@...gutronix.de>
Cc: linux-mtd@...ts.infradead.org, David Gstir <david@...ma-star.at>,
linux-kernel@...r.kernel.org, kernel@...gutronix.de
Subject: Re: [PATCH 05/25] ubifs: implement ubifs_lpt_lookup using ubifs_pnode_lookup
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
Powered by blists - more mailing lists