diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2018-09-07 15:36:27 +0300 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2018-10-23 14:48:21 +0300 |
commit | e635cf8c3bbd7b9bd3e282156c6cc4f818b72ee9 (patch) | |
tree | fbb160a3565fd646297943f514b0837f22a4c53d /fs/ubifs | |
parent | 0e26b6e2551e21df72c140e46819523e1b686009 (diff) | |
download | linux-e635cf8c3bbd7b9bd3e282156c6cc4f818b72ee9.tar.xz |
ubifs: Implement ubifs_lpt_lookup using ubifs_pnode_lookup
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 <s.hauer@pengutronix.de>
Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'fs/ubifs')
-rw-r--r-- | fs/ubifs/lpt.c | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/fs/ubifs/lpt.c b/fs/ubifs/lpt.c index ed0c67fe7500..5f57af224b8f 100644 --- a/fs/ubifs/lpt.c +++ b/fs/ubifs/lpt.c @@ -1480,27 +1480,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 >> UBIFS_LPT_FANOUT_SHIFT); if (IS_ERR(pnode)) return ERR_CAST(pnode); iip = (i & (UBIFS_LPT_FANOUT - 1)); |