diff options
Diffstat (limited to 'fs/nilfs2/bmap.h')
-rw-r--r-- | fs/nilfs2/bmap.h | 69 |
1 files changed, 25 insertions, 44 deletions
diff --git a/fs/nilfs2/bmap.h b/fs/nilfs2/bmap.h index b2890cdcef12..a4f64e54424c 100644 --- a/fs/nilfs2/bmap.h +++ b/fs/nilfs2/bmap.h | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/buffer_head.h> | 28 | #include <linux/buffer_head.h> |
29 | #include <linux/nilfs2_fs.h> | 29 | #include <linux/nilfs2_fs.h> |
30 | #include "alloc.h" | 30 | #include "alloc.h" |
31 | #include "dat.h" | ||
31 | 32 | ||
32 | #define NILFS_BMAP_INVALID_PTR 0 | 33 | #define NILFS_BMAP_INVALID_PTR 0 |
33 | 34 | ||
@@ -164,86 +165,66 @@ void nilfs_bmap_commit_gcdat(struct nilfs_bmap *, struct nilfs_bmap *); | |||
164 | * Internal use only | 165 | * Internal use only |
165 | */ | 166 | */ |
166 | struct inode *nilfs_bmap_get_dat(const struct nilfs_bmap *); | 167 | struct inode *nilfs_bmap_get_dat(const struct nilfs_bmap *); |
167 | int nilfs_bmap_prepare_alloc_v(struct nilfs_bmap *, | ||
168 | union nilfs_bmap_ptr_req *); | ||
169 | void nilfs_bmap_commit_alloc_v(struct nilfs_bmap *, | ||
170 | union nilfs_bmap_ptr_req *); | ||
171 | void nilfs_bmap_abort_alloc_v(struct nilfs_bmap *, | ||
172 | union nilfs_bmap_ptr_req *); | ||
173 | 168 | ||
174 | static inline int nilfs_bmap_prepare_alloc_ptr(struct nilfs_bmap *bmap, | 169 | static inline int nilfs_bmap_prepare_alloc_ptr(struct nilfs_bmap *bmap, |
175 | union nilfs_bmap_ptr_req *req) | 170 | union nilfs_bmap_ptr_req *req, |
171 | struct inode *dat) | ||
176 | { | 172 | { |
177 | if (NILFS_BMAP_USE_VBN(bmap)) | 173 | if (dat) |
178 | return nilfs_bmap_prepare_alloc_v(bmap, req); | 174 | return nilfs_dat_prepare_alloc(dat, &req->bpr_req); |
179 | /* ignore target ptr */ | 175 | /* ignore target ptr */ |
180 | req->bpr_ptr = bmap->b_last_allocated_ptr++; | 176 | req->bpr_ptr = bmap->b_last_allocated_ptr++; |
181 | return 0; | 177 | return 0; |
182 | } | 178 | } |
183 | 179 | ||
184 | static inline void nilfs_bmap_commit_alloc_ptr(struct nilfs_bmap *bmap, | 180 | static inline void nilfs_bmap_commit_alloc_ptr(struct nilfs_bmap *bmap, |
185 | union nilfs_bmap_ptr_req *req) | 181 | union nilfs_bmap_ptr_req *req, |
182 | struct inode *dat) | ||
186 | { | 183 | { |
187 | if (NILFS_BMAP_USE_VBN(bmap)) | 184 | if (dat) |
188 | nilfs_bmap_commit_alloc_v(bmap, req); | 185 | nilfs_dat_commit_alloc(dat, &req->bpr_req); |
189 | } | 186 | } |
190 | 187 | ||
191 | static inline void nilfs_bmap_abort_alloc_ptr(struct nilfs_bmap *bmap, | 188 | static inline void nilfs_bmap_abort_alloc_ptr(struct nilfs_bmap *bmap, |
192 | union nilfs_bmap_ptr_req *req) | 189 | union nilfs_bmap_ptr_req *req, |
190 | struct inode *dat) | ||
193 | { | 191 | { |
194 | if (NILFS_BMAP_USE_VBN(bmap)) | 192 | if (dat) |
195 | nilfs_bmap_abort_alloc_v(bmap, req); | 193 | nilfs_dat_abort_alloc(dat, &req->bpr_req); |
196 | else | 194 | else |
197 | bmap->b_last_allocated_ptr--; | 195 | bmap->b_last_allocated_ptr--; |
198 | } | 196 | } |
199 | 197 | ||
200 | int nilfs_bmap_prepare_end_v(struct nilfs_bmap *, union nilfs_bmap_ptr_req *); | ||
201 | void nilfs_bmap_commit_end_v(struct nilfs_bmap *, union nilfs_bmap_ptr_req *); | ||
202 | void nilfs_bmap_abort_end_v(struct nilfs_bmap *, union nilfs_bmap_ptr_req *); | ||
203 | |||
204 | static inline int nilfs_bmap_prepare_end_ptr(struct nilfs_bmap *bmap, | 198 | static inline int nilfs_bmap_prepare_end_ptr(struct nilfs_bmap *bmap, |
205 | union nilfs_bmap_ptr_req *req) | 199 | union nilfs_bmap_ptr_req *req, |
200 | struct inode *dat) | ||
206 | { | 201 | { |
207 | return NILFS_BMAP_USE_VBN(bmap) ? | 202 | return dat ? nilfs_dat_prepare_end(dat, &req->bpr_req) : 0; |
208 | nilfs_bmap_prepare_end_v(bmap, req) : 0; | ||
209 | } | 203 | } |
210 | 204 | ||
211 | static inline void nilfs_bmap_commit_end_ptr(struct nilfs_bmap *bmap, | 205 | static inline void nilfs_bmap_commit_end_ptr(struct nilfs_bmap *bmap, |
212 | union nilfs_bmap_ptr_req *req) | 206 | union nilfs_bmap_ptr_req *req, |
207 | struct inode *dat) | ||
213 | { | 208 | { |
214 | if (NILFS_BMAP_USE_VBN(bmap)) | 209 | if (dat) |
215 | nilfs_bmap_commit_end_v(bmap, req); | 210 | nilfs_dat_commit_end(dat, &req->bpr_req, |
211 | bmap->b_ptr_type == NILFS_BMAP_PTR_VS); | ||
216 | } | 212 | } |
217 | 213 | ||
218 | static inline void nilfs_bmap_abort_end_ptr(struct nilfs_bmap *bmap, | 214 | static inline void nilfs_bmap_abort_end_ptr(struct nilfs_bmap *bmap, |
219 | union nilfs_bmap_ptr_req *req) | 215 | union nilfs_bmap_ptr_req *req, |
216 | struct inode *dat) | ||
220 | { | 217 | { |
221 | if (NILFS_BMAP_USE_VBN(bmap)) | 218 | if (dat) |
222 | nilfs_bmap_abort_end_v(bmap, req); | 219 | nilfs_dat_abort_end(dat, &req->bpr_req); |
223 | } | 220 | } |
224 | 221 | ||
225 | int nilfs_bmap_start_v(struct nilfs_bmap *, union nilfs_bmap_ptr_req *, | ||
226 | sector_t); | ||
227 | int nilfs_bmap_move_v(const struct nilfs_bmap *, __u64, sector_t); | ||
228 | int nilfs_bmap_mark_dirty(const struct nilfs_bmap *, __u64); | ||
229 | |||
230 | |||
231 | __u64 nilfs_bmap_data_get_key(const struct nilfs_bmap *, | 222 | __u64 nilfs_bmap_data_get_key(const struct nilfs_bmap *, |
232 | const struct buffer_head *); | 223 | const struct buffer_head *); |
233 | 224 | ||
234 | __u64 nilfs_bmap_find_target_seq(const struct nilfs_bmap *, __u64); | 225 | __u64 nilfs_bmap_find_target_seq(const struct nilfs_bmap *, __u64); |
235 | __u64 nilfs_bmap_find_target_in_group(const struct nilfs_bmap *); | 226 | __u64 nilfs_bmap_find_target_in_group(const struct nilfs_bmap *); |
236 | 227 | ||
237 | int nilfs_bmap_prepare_update_v(struct nilfs_bmap *, | ||
238 | union nilfs_bmap_ptr_req *, | ||
239 | union nilfs_bmap_ptr_req *); | ||
240 | void nilfs_bmap_commit_update_v(struct nilfs_bmap *, | ||
241 | union nilfs_bmap_ptr_req *, | ||
242 | union nilfs_bmap_ptr_req *); | ||
243 | void nilfs_bmap_abort_update_v(struct nilfs_bmap *, | ||
244 | union nilfs_bmap_ptr_req *, | ||
245 | union nilfs_bmap_ptr_req *); | ||
246 | |||
247 | void nilfs_bmap_add_blocks(const struct nilfs_bmap *, int); | 228 | void nilfs_bmap_add_blocks(const struct nilfs_bmap *, int); |
248 | void nilfs_bmap_sub_blocks(const struct nilfs_bmap *, int); | 229 | void nilfs_bmap_sub_blocks(const struct nilfs_bmap *, int); |
249 | 230 | ||