Skip to content

Commit 45f4910

Browse files
committed
nilfs2: use nilfs_btnode_create_block function
This displaces nilfs_btnode_get() use to create new btree node block with nilfs_btnode_create_block. Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
1 parent d501d73 commit 45f4910

2 files changed

Lines changed: 15 additions & 11 deletions

File tree

‎fs/nilfs2/btnode.c‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -270,12 +270,13 @@ int nilfs_btnode_prepare_change_key(struct address_space *btnc,
270270
unlock_page(obh->b_page);
271271
}
272272

273-
err = nilfs_btnode_get(btnc, newkey, 0, &nbh, 1);
274-
if (likely(!err)) {
275-
BUG_ON(nbh == obh);
276-
ctxt->newbh = nbh;
277-
}
278-
return err;
273+
nbh = nilfs_btnode_create_block(btnc, newkey);
274+
if (!nbh)
275+
return -ENOMEM;
276+
277+
BUG_ON(nbh == obh);
278+
ctxt->newbh = nbh;
279+
return 0;
279280

280281
failed_unlock:
281282
unlock_page(obh->b_page);

‎fs/nilfs2/btree.c‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,15 @@ static int nilfs_btree_get_new_block(const struct nilfs_btree *btree,
122122
{
123123
struct address_space *btnc =
124124
&NILFS_BMAP_I((struct nilfs_bmap *)btree)->i_btnode_cache;
125-
int ret;
125+
struct buffer_head *bh;
126126

127-
ret = nilfs_btnode_get(btnc, ptr, 0, bhp, 1);
128-
if (!ret)
129-
set_buffer_nilfs_volatile(*bhp);
130-
return ret;
127+
bh = nilfs_btnode_create_block(btnc, ptr);
128+
if (!bh)
129+
return -ENOMEM;
130+
131+
set_buffer_nilfs_volatile(bh);
132+
*bhp = bh;
133+
return 0;
131134
}
132135

133136
static inline int

0 commit comments

Comments
 (0)