nilfs2: eliminate nilfs_btnode_get function
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Fri, 13 Nov 2009 07:49:09 +0000 (16:49 +0900)
committerRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Fri, 20 Nov 2009 01:05:50 +0000 (10:05 +0900)
This removes the obsolete nilfs_btnode_get() function and makes
nilfs_btree_get_block() directly call nilfs_btnode_submit_block().

This expansion will provide better opportunity for code optimization.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
fs/nilfs2/btnode.c
fs/nilfs2/btnode.h
fs/nilfs2/btree.c

index 59658f0..471e269 100644 (file)
@@ -147,27 +147,6 @@ out_locked:
        return err;
 }
 
-int nilfs_btnode_get(struct address_space *btnc, __u64 blocknr,
-                    sector_t pblocknr, struct buffer_head **pbh)
-{
-       struct buffer_head *bh;
-       int err;
-
-       err = nilfs_btnode_submit_block(btnc, blocknr, pblocknr, pbh);
-       if (err == -EEXIST) /* internal code (cache hit) */
-               return 0;
-       if (unlikely(err))
-               return err;
-
-       bh = *pbh;
-       wait_on_buffer(bh);
-       if (!buffer_uptodate(bh)) {
-               brelse(bh);
-               return -EIO;
-       }
-       return 0;
-}
-
 /**
  * nilfs_btnode_delete - delete B-tree node buffer
  * @bh: buffer to be deleted
index 3d5cf08..07da83f 100644 (file)
@@ -44,8 +44,6 @@ struct buffer_head *nilfs_btnode_create_block(struct address_space *btnc,
                                              __u64 blocknr);
 int nilfs_btnode_submit_block(struct address_space *, __u64, sector_t,
                              struct buffer_head **);
-int nilfs_btnode_get(struct address_space *, __u64, sector_t,
-                    struct buffer_head **);
 void nilfs_btnode_delete(struct buffer_head *);
 int nilfs_btnode_prepare_change_key(struct address_space *,
                                    struct nilfs_btnode_chkey_ctxt *);
index 7b0cc4f..139b113 100644 (file)
@@ -114,7 +114,18 @@ static int nilfs_btree_get_block(const struct nilfs_btree *btree, __u64 ptr,
 {
        struct address_space *btnc =
                &NILFS_BMAP_I((struct nilfs_bmap *)btree)->i_btnode_cache;
-       return nilfs_btnode_get(btnc, ptr, 0, bhp, 0);
+       int err;
+
+       err = nilfs_btnode_submit_block(btnc, ptr, 0, bhp);
+       if (err)
+               return err == -EEXIST ? 0 : err;
+
+       wait_on_buffer(*bhp);
+       if (!buffer_uptodate(*bhp)) {
+               brelse(*bhp);
+               return -EIO;
+       }
+       return 0;
 }
 
 static int nilfs_btree_get_new_block(const struct nilfs_btree *btree,