Skip to content

Commit

Permalink
nilfs2: remove redundant pointer checks in bmap lookup functions
Browse files Browse the repository at this point in the history
nilfs_bmap_lookup and its variants are supposed to take a valid
pointer argument to return a block address, thus pointer checks in
nilfs_btree_lookup and nilfs_direct_lookup are needless.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
  • Loading branch information
Ryusuke Konishi committed Jul 23, 2010
1 parent 05d0e94 commit 364ec2d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
6 changes: 1 addition & 5 deletions fs/nilfs2/btree.c
Original file line number Diff line number Diff line change
Expand Up @@ -555,17 +555,13 @@ static int nilfs_btree_lookup(const struct nilfs_bmap *btree,
__u64 key, int level, __u64 *ptrp)
{
struct nilfs_btree_path *path;
__u64 ptr;
int ret;

path = nilfs_btree_alloc_path();
if (path == NULL)
return -ENOMEM;

ret = nilfs_btree_do_lookup(btree, path, key, &ptr, level);

if (ptrp != NULL)
*ptrp = ptr;
ret = nilfs_btree_do_lookup(btree, path, key, ptrp, level);

nilfs_btree_free_path(path);

Expand Down
3 changes: 1 addition & 2 deletions fs/nilfs2/direct.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ static int nilfs_direct_lookup(const struct nilfs_bmap *direct,
if (ptr == NILFS_BMAP_INVALID_PTR)
return -ENOENT;

if (ptrp != NULL)
*ptrp = ptr;
*ptrp = ptr;
return 0;
}

Expand Down

0 comments on commit 364ec2d

Please sign in to comment.