aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/alloc.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ocfs2/alloc.h')
-rw-r--r--fs/ocfs2/alloc.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/fs/ocfs2/alloc.h b/fs/ocfs2/alloc.h
index df0e778a2b68..3f4348923b73 100644
--- a/fs/ocfs2/alloc.h
+++ b/fs/ocfs2/alloc.h
@@ -115,6 +115,14 @@ int ocfs2_add_clusters_in_btree(handle_t *handle,
115 struct ocfs2_alloc_context *meta_ac, 115 struct ocfs2_alloc_context *meta_ac,
116 enum ocfs2_alloc_restarted *reason_ret); 116 enum ocfs2_alloc_restarted *reason_ret);
117struct ocfs2_cached_dealloc_ctxt; 117struct ocfs2_cached_dealloc_ctxt;
118struct ocfs2_path;
119int ocfs2_split_extent(handle_t *handle,
120 struct ocfs2_extent_tree *et,
121 struct ocfs2_path *path,
122 int split_index,
123 struct ocfs2_extent_rec *split_rec,
124 struct ocfs2_alloc_context *meta_ac,
125 struct ocfs2_cached_dealloc_ctxt *dealloc);
118int ocfs2_mark_extent_written(struct inode *inode, 126int ocfs2_mark_extent_written(struct inode *inode,
119 struct ocfs2_extent_tree *et, 127 struct ocfs2_extent_tree *et,
120 handle_t *handle, u32 cpos, u32 len, u32 phys, 128 handle_t *handle, u32 cpos, u32 len, u32 phys,
@@ -254,4 +262,45 @@ static inline int ocfs2_is_empty_extent(struct ocfs2_extent_rec *rec)
254 return !rec->e_leaf_clusters; 262 return !rec->e_leaf_clusters;
255} 263}
256 264
265/*
266 * Structures which describe a path through a btree, and functions to
267 * manipulate them.
268 *
269 * The idea here is to be as generic as possible with the tree
270 * manipulation code.
271 */
272struct ocfs2_path_item {
273 struct buffer_head *bh;
274 struct ocfs2_extent_list *el;
275};
276
277#define OCFS2_MAX_PATH_DEPTH 5
278
279struct ocfs2_path {
280 int p_tree_depth;
281 ocfs2_journal_access_func p_root_access;
282 struct ocfs2_path_item p_node[OCFS2_MAX_PATH_DEPTH];
283};
284
285#define path_root_bh(_path) ((_path)->p_node[0].bh)
286#define path_root_el(_path) ((_path)->p_node[0].el)
287#define path_root_access(_path)((_path)->p_root_access)
288#define path_leaf_bh(_path) ((_path)->p_node[(_path)->p_tree_depth].bh)
289#define path_leaf_el(_path) ((_path)->p_node[(_path)->p_tree_depth].el)
290#define path_num_items(_path) ((_path)->p_tree_depth + 1)
291
292void ocfs2_reinit_path(struct ocfs2_path *path, int keep_root);
293void ocfs2_free_path(struct ocfs2_path *path);
294int ocfs2_find_path(struct ocfs2_caching_info *ci,
295 struct ocfs2_path *path,
296 u32 cpos);
297struct ocfs2_path *ocfs2_new_path_from_path(struct ocfs2_path *path);
298struct ocfs2_path *ocfs2_new_path_from_et(struct ocfs2_extent_tree *et);
299int ocfs2_path_bh_journal_access(handle_t *handle,
300 struct ocfs2_caching_info *ci,
301 struct ocfs2_path *path,
302 int idx);
303int ocfs2_journal_access_path(struct ocfs2_caching_info *ci,
304 handle_t *handle,
305 struct ocfs2_path *path);
257#endif /* OCFS2_ALLOC_H */ 306#endif /* OCFS2_ALLOC_H */