diff options
author | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2009-11-13 02:49:09 -0500 |
---|---|---|
committer | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2009-11-19 20:05:50 -0500 |
commit | 1376e931b75f954057b1547ba25fcba594cef804 (patch) | |
tree | b8e75d8dddb705c661542b534b4a74f9e1e87aa4 /fs/nilfs2 | |
parent | 75f65edfcc4a19d14fc8ab860846fad070c8db49 (diff) |
nilfs2: eliminate nilfs_btnode_get function
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>
Diffstat (limited to 'fs/nilfs2')
-rw-r--r-- | fs/nilfs2/btnode.c | 21 | ||||
-rw-r--r-- | fs/nilfs2/btnode.h | 2 | ||||
-rw-r--r-- | fs/nilfs2/btree.c | 13 |
3 files changed, 12 insertions, 24 deletions
diff --git a/fs/nilfs2/btnode.c b/fs/nilfs2/btnode.c index 59658f08d289..471e269536ae 100644 --- a/fs/nilfs2/btnode.c +++ b/fs/nilfs2/btnode.c | |||
@@ -147,27 +147,6 @@ out_locked: | |||
147 | return err; | 147 | return err; |
148 | } | 148 | } |
149 | 149 | ||
150 | int nilfs_btnode_get(struct address_space *btnc, __u64 blocknr, | ||
151 | sector_t pblocknr, struct buffer_head **pbh) | ||
152 | { | ||
153 | struct buffer_head *bh; | ||
154 | int err; | ||
155 | |||
156 | err = nilfs_btnode_submit_block(btnc, blocknr, pblocknr, pbh); | ||
157 | if (err == -EEXIST) /* internal code (cache hit) */ | ||
158 | return 0; | ||
159 | if (unlikely(err)) | ||
160 | return err; | ||
161 | |||
162 | bh = *pbh; | ||
163 | wait_on_buffer(bh); | ||
164 | if (!buffer_uptodate(bh)) { | ||
165 | brelse(bh); | ||
166 | return -EIO; | ||
167 | } | ||
168 | return 0; | ||
169 | } | ||
170 | |||
171 | /** | 150 | /** |
172 | * nilfs_btnode_delete - delete B-tree node buffer | 151 | * nilfs_btnode_delete - delete B-tree node buffer |
173 | * @bh: buffer to be deleted | 152 | * @bh: buffer to be deleted |
diff --git a/fs/nilfs2/btnode.h b/fs/nilfs2/btnode.h index 3d5cf08a47f7..07da83f07712 100644 --- a/fs/nilfs2/btnode.h +++ b/fs/nilfs2/btnode.h | |||
@@ -44,8 +44,6 @@ struct buffer_head *nilfs_btnode_create_block(struct address_space *btnc, | |||
44 | __u64 blocknr); | 44 | __u64 blocknr); |
45 | int nilfs_btnode_submit_block(struct address_space *, __u64, sector_t, | 45 | int nilfs_btnode_submit_block(struct address_space *, __u64, sector_t, |
46 | struct buffer_head **); | 46 | struct buffer_head **); |
47 | int nilfs_btnode_get(struct address_space *, __u64, sector_t, | ||
48 | struct buffer_head **); | ||
49 | void nilfs_btnode_delete(struct buffer_head *); | 47 | void nilfs_btnode_delete(struct buffer_head *); |
50 | int nilfs_btnode_prepare_change_key(struct address_space *, | 48 | int nilfs_btnode_prepare_change_key(struct address_space *, |
51 | struct nilfs_btnode_chkey_ctxt *); | 49 | struct nilfs_btnode_chkey_ctxt *); |
diff --git a/fs/nilfs2/btree.c b/fs/nilfs2/btree.c index 7b0cc4fe9f0d..139b113e8338 100644 --- a/fs/nilfs2/btree.c +++ b/fs/nilfs2/btree.c | |||
@@ -114,7 +114,18 @@ static int nilfs_btree_get_block(const struct nilfs_btree *btree, __u64 ptr, | |||
114 | { | 114 | { |
115 | struct address_space *btnc = | 115 | struct address_space *btnc = |
116 | &NILFS_BMAP_I((struct nilfs_bmap *)btree)->i_btnode_cache; | 116 | &NILFS_BMAP_I((struct nilfs_bmap *)btree)->i_btnode_cache; |
117 | return nilfs_btnode_get(btnc, ptr, 0, bhp, 0); | 117 | int err; |
118 | |||
119 | err = nilfs_btnode_submit_block(btnc, ptr, 0, bhp); | ||
120 | if (err) | ||
121 | return err == -EEXIST ? 0 : err; | ||
122 | |||
123 | wait_on_buffer(*bhp); | ||
124 | if (!buffer_uptodate(*bhp)) { | ||
125 | brelse(*bhp); | ||
126 | return -EIO; | ||
127 | } | ||
128 | return 0; | ||
118 | } | 129 | } |
119 | 130 | ||
120 | static int nilfs_btree_get_new_block(const struct nilfs_btree *btree, | 131 | static int nilfs_btree_get_new_block(const struct nilfs_btree *btree, |