xfs: rationalize xfs_inobt_lookup*

Currenly we have a xfs_inobt_lookup* variant for each comparism direction,
and all these get all three fields of the inobt records passed, while the
common case is just looking for the inode number and we have only marginally
more callers than xfs_inobt_lookup* variants.

So opencode a direct call to xfs_btree_lookup for the single case where we
need all fields, and replace xfs_inobt_lookup* with a xfs_inobt_looku that
just takes the inode number and the direction for all other callers.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Alex Elder <aelder@sgi.com>
Signed-off-by: Felix Blyakher <felixb@sgi.com>
This commit is contained in:
Christoph Hellwig
2009-08-31 20:58:21 -03:00
committed by Felix Blyakher
parent 4254b0bbb1
commit 2187550525
3 changed files with 32 additions and 71 deletions

View File

@ -444,7 +444,8 @@ xfs_bulkstat(
/*
* Lookup the inode chunk that this inode lives in.
*/
error = xfs_inobt_lookup_le(cur, agino, 0, 0, &tmp);
error = xfs_inobt_lookup(cur, agino, XFS_LOOKUP_LE,
&tmp);
if (!error && /* no I/O error */
tmp && /* lookup succeeded */
/* got the record, should always work */
@ -492,7 +493,7 @@ xfs_bulkstat(
/*
* Start of ag. Lookup the first inode chunk.
*/
error = xfs_inobt_lookup_ge(cur, 0, 0, 0, &tmp);
error = xfs_inobt_lookup(cur, 0, XFS_LOOKUP_GE, &tmp);
icount = 0;
}
/*
@ -511,8 +512,8 @@ xfs_bulkstat(
if (XFS_AGINO_TO_AGBNO(mp, agino) >=
be32_to_cpu(agi->agi_length))
break;
error = xfs_inobt_lookup_ge(cur, agino, 0, 0,
&tmp);
error = xfs_inobt_lookup(cur, agino,
XFS_LOOKUP_GE, &tmp);
cond_resched();
}
/*
@ -858,7 +859,8 @@ xfs_inumbers(
continue;
}
cur = xfs_inobt_init_cursor(mp, NULL, agbp, agno);
error = xfs_inobt_lookup_ge(cur, agino, 0, 0, &tmp);
error = xfs_inobt_lookup(cur, agino, XFS_LOOKUP_GE,
&tmp);
if (error) {
xfs_btree_del_cursor(cur, XFS_BTREE_ERROR);
cur = NULL;