nilfs2: remove redundant pointer checks in bmap lookup functions
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Tue, 13 Jul 2010 14:33:51 +0000 (23:33 +0900)
committerRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Fri, 23 Jul 2010 01:02:14 +0000 (10:02 +0900)
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>
fs/nilfs2/btree.c
fs/nilfs2/direct.c

index 0543bf9f80baae1296c201403957da86e8d1d490..18bb965c66b578e99703df14f239f23cb2ba76d5 100644 (file)
@@ -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);
 
index 318613010106bd554ebfbfb2d9f9f5bfc8803f7a..324d80c57518ad09a83cab70ee1ca6abfae4d644 100644 (file)
@@ -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;
 }