diff options
author | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2010-07-10 09:21:54 -0400 |
---|---|---|
committer | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2010-07-22 21:02:14 -0400 |
commit | dc935be2a094087bc561d80f8cf9e66bbc1f7b18 (patch) | |
tree | ab7af5a2a40633f74a949916de7797c3d8f345b7 | |
parent | e7c274f8083793f8f861def63c02a0839b34d26d (diff) |
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>
-rw-r--r-- | fs/nilfs2/bmap.h | 7 | ||||
-rw-r--r-- | fs/nilfs2/btree.c | 11 | ||||
-rw-r--r-- | fs/nilfs2/direct.c | 9 |
3 files changed, 10 insertions, 17 deletions
diff --git a/fs/nilfs2/bmap.h b/fs/nilfs2/bmap.h index 379fda4c668..fae83cf9c00 100644 --- a/fs/nilfs2/bmap.h +++ b/fs/nilfs2/bmap.h | |||
@@ -219,6 +219,13 @@ static inline void nilfs_bmap_abort_end_ptr(struct nilfs_bmap *bmap, | |||
219 | nilfs_dat_abort_end(dat, &req->bpr_req); | 219 | nilfs_dat_abort_end(dat, &req->bpr_req); |
220 | } | 220 | } |
221 | 221 | ||
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 | |||
222 | __u64 nilfs_bmap_data_get_key(const struct nilfs_bmap *, | 229 | __u64 nilfs_bmap_data_get_key(const struct nilfs_bmap *, |
223 | const struct buffer_head *); | 230 | const struct buffer_head *); |
224 | 231 | ||
diff --git a/fs/nilfs2/btree.c b/fs/nilfs2/btree.c index 81e871645b5..0543bf9f80b 100644 --- a/fs/nilfs2/btree.c +++ b/fs/nilfs2/btree.c | |||
@@ -917,13 +917,6 @@ static __u64 nilfs_btree_find_target_v(const struct nilfs_bmap *btree, | |||
917 | return nilfs_bmap_find_target_in_group(btree); | 917 | return nilfs_bmap_find_target_in_group(btree); |
918 | } | 918 | } |
919 | 919 | ||
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 | |||
927 | static int nilfs_btree_prepare_insert(struct nilfs_bmap *btree, | 920 | static int nilfs_btree_prepare_insert(struct nilfs_bmap *btree, |
928 | struct nilfs_btree_path *path, | 921 | struct nilfs_btree_path *path, |
929 | int *levelp, __u64 key, __u64 ptr, | 922 | int *levelp, __u64 key, __u64 ptr, |
@@ -1084,7 +1077,7 @@ static void nilfs_btree_commit_insert(struct nilfs_bmap *btree, | |||
1084 | set_buffer_nilfs_volatile((struct buffer_head *)((unsigned long)ptr)); | 1077 | set_buffer_nilfs_volatile((struct buffer_head *)((unsigned long)ptr)); |
1085 | ptr = path[NILFS_BTREE_LEVEL_DATA].bp_newreq.bpr_ptr; | 1078 | ptr = path[NILFS_BTREE_LEVEL_DATA].bp_newreq.bpr_ptr; |
1086 | if (NILFS_BMAP_USE_VBN(btree)) { | 1079 | if (NILFS_BMAP_USE_VBN(btree)) { |
1087 | nilfs_btree_set_target_v(btree, key, ptr); | 1080 | nilfs_bmap_set_target_v(btree, key, ptr); |
1088 | dat = nilfs_bmap_get_dat(btree); | 1081 | dat = nilfs_bmap_get_dat(btree); |
1089 | } | 1082 | } |
1090 | 1083 | ||
@@ -1662,7 +1655,7 @@ nilfs_btree_commit_convert_and_insert(struct nilfs_bmap *btree, | |||
1662 | } | 1655 | } |
1663 | 1656 | ||
1664 | if (NILFS_BMAP_USE_VBN(btree)) | 1657 | 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); |
1666 | } | 1659 | } |
1667 | 1660 | ||
1668 | /** | 1661 | /** |
diff --git a/fs/nilfs2/direct.c b/fs/nilfs2/direct.c index cfc7218914d..31861301010 100644 --- a/fs/nilfs2/direct.c +++ b/fs/nilfs2/direct.c | |||
@@ -116,13 +116,6 @@ nilfs_direct_find_target_v(const struct nilfs_bmap *direct, __u64 key) | |||
116 | return nilfs_bmap_find_target_in_group(direct); | 116 | return nilfs_bmap_find_target_in_group(direct); |
117 | } | 117 | } |
118 | 118 | ||
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 | |||
126 | static int nilfs_direct_insert(struct nilfs_bmap *bmap, __u64 key, __u64 ptr) | 119 | static int nilfs_direct_insert(struct nilfs_bmap *bmap, __u64 key, __u64 ptr) |
127 | { | 120 | { |
128 | union nilfs_bmap_ptr_req req; | 121 | union nilfs_bmap_ptr_req req; |
@@ -152,7 +145,7 @@ static int nilfs_direct_insert(struct nilfs_bmap *bmap, __u64 key, __u64 ptr) | |||
152 | nilfs_bmap_set_dirty(bmap); | 145 | nilfs_bmap_set_dirty(bmap); |
153 | 146 | ||
154 | if (NILFS_BMAP_USE_VBN(bmap)) | 147 | 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); |
156 | 149 | ||
157 | nilfs_bmap_add_blocks(bmap, 1); | 150 | nilfs_bmap_add_blocks(bmap, 1); |
158 | } | 151 | } |