Skip to content

Commit dc935be

Browse files
committed
nilfs2: unify bmap set_target_v operations
This unifies two similar functions nilfs_btree_set_target_v and nilfs_direct_set_target_v into one, nilfs_bmap_set_target_v. Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
1 parent e7c274f commit dc935be

3 files changed

Lines changed: 10 additions & 17 deletions

File tree

‎fs/nilfs2/bmap.h‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,13 @@ static inline void nilfs_bmap_abort_end_ptr(struct nilfs_bmap *bmap,
219219
nilfs_dat_abort_end(dat, &req->bpr_req);
220220
}
221221

222+
static inline void nilfs_bmap_set_target_v(struct nilfs_bmap *bmap, __u64 key,
223+
__u64 ptr)
224+
{
225+
bmap->b_last_allocated_key = key;
226+
bmap->b_last_allocated_ptr = ptr;
227+
}
228+
222229
__u64 nilfs_bmap_data_get_key(const struct nilfs_bmap *,
223230
const struct buffer_head *);
224231

‎fs/nilfs2/btree.c‎

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -917,13 +917,6 @@ static __u64 nilfs_btree_find_target_v(const struct nilfs_bmap *btree,
917917
return nilfs_bmap_find_target_in_group(btree);
918918
}
919919

920-
static void nilfs_btree_set_target_v(struct nilfs_bmap *btree, __u64 key,
921-
__u64 ptr)
922-
{
923-
btree->b_last_allocated_key = key;
924-
btree->b_last_allocated_ptr = ptr;
925-
}
926-
927920
static int nilfs_btree_prepare_insert(struct nilfs_bmap *btree,
928921
struct nilfs_btree_path *path,
929922
int *levelp, __u64 key, __u64 ptr,
@@ -1084,7 +1077,7 @@ static void nilfs_btree_commit_insert(struct nilfs_bmap *btree,
10841077
set_buffer_nilfs_volatile((struct buffer_head *)((unsigned long)ptr));
10851078
ptr = path[NILFS_BTREE_LEVEL_DATA].bp_newreq.bpr_ptr;
10861079
if (NILFS_BMAP_USE_VBN(btree)) {
1087-
nilfs_btree_set_target_v(btree, key, ptr);
1080+
nilfs_bmap_set_target_v(btree, key, ptr);
10881081
dat = nilfs_bmap_get_dat(btree);
10891082
}
10901083

@@ -1662,7 +1655,7 @@ nilfs_btree_commit_convert_and_insert(struct nilfs_bmap *btree,
16621655
}
16631656

16641657
if (NILFS_BMAP_USE_VBN(btree))
1665-
nilfs_btree_set_target_v(btree, key, dreq->bpr_ptr);
1658+
nilfs_bmap_set_target_v(btree, key, dreq->bpr_ptr);
16661659
}
16671660

16681661
/**

‎fs/nilfs2/direct.c‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,6 @@ nilfs_direct_find_target_v(const struct nilfs_bmap *direct, __u64 key)
116116
return nilfs_bmap_find_target_in_group(direct);
117117
}
118118

119-
static void nilfs_direct_set_target_v(struct nilfs_bmap *direct,
120-
__u64 key, __u64 ptr)
121-
{
122-
direct->b_last_allocated_key = key;
123-
direct->b_last_allocated_ptr = ptr;
124-
}
125-
126119
static int nilfs_direct_insert(struct nilfs_bmap *bmap, __u64 key, __u64 ptr)
127120
{
128121
union nilfs_bmap_ptr_req req;
@@ -152,7 +145,7 @@ static int nilfs_direct_insert(struct nilfs_bmap *bmap, __u64 key, __u64 ptr)
152145
nilfs_bmap_set_dirty(bmap);
153146

154147
if (NILFS_BMAP_USE_VBN(bmap))
155-
nilfs_direct_set_target_v(bmap, key, req.bpr_ptr);
148+
nilfs_bmap_set_target_v(bmap, key, req.bpr_ptr);
156149

157150
nilfs_bmap_add_blocks(bmap, 1);
158151
}

0 commit comments

Comments
 (0)