diff options
author | Tao Ma <tao.ma@oracle.com> | 2008-08-18 05:38:44 -0400 |
---|---|---|
committer | Mark Fasheh <mfasheh@suse.com> | 2008-10-13 16:57:58 -0400 |
commit | e7d4cb6bc19658646357eeff134645cd9bc3479f (patch) | |
tree | 4e24321e5c28fb90dffa1f396972fddb3c458e58 /fs/ocfs2/alloc.h | |
parent | 811f933df1e55615fd0bb4818f31e3868a8e6e23 (diff) |
ocfs2: Abstract ocfs2_extent_tree in b-tree operations.
In the old extent tree operation, we take the hypothesis that we
are using the ocfs2_extent_list in ocfs2_dinode as the tree root.
As xattr will also use ocfs2_extent_list to store large value
for a xattr entry, we refactor the tree operation so that xattr
can use it directly.
The refactoring includes 4 steps:
1. Abstract set/get of last_eb_blk and update_clusters since they may
be stored in different location for dinode and xattr.
2. Add a new structure named ocfs2_extent_tree to indicate the
extent tree the operation will work on.
3. Remove all the use of fe_bh and di, use root_bh and root_el in
extent tree instead. So now all the fe_bh is replaced with
et->root_bh, el with root_el accordingly.
4. Make ocfs2_lock_allocators generic. Now it is limited to be only used
in file extend allocation. But the whole function is useful when we want
to store large EAs.
Note: This patch doesn't touch ocfs2_commit_truncate() since it is not used
for anything other than truncate inode data btrees.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs/ocfs2/alloc.h')
-rw-r--r-- | fs/ocfs2/alloc.h | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/fs/ocfs2/alloc.h b/fs/ocfs2/alloc.h index a0e334f10cd1..473c8bcc62fb 100644 --- a/fs/ocfs2/alloc.h +++ b/fs/ocfs2/alloc.h | |||
@@ -26,28 +26,37 @@ | |||
26 | #ifndef OCFS2_ALLOC_H | 26 | #ifndef OCFS2_ALLOC_H |
27 | #define OCFS2_ALLOC_H | 27 | #define OCFS2_ALLOC_H |
28 | 28 | ||
29 | enum ocfs2_extent_tree_type { | ||
30 | OCFS2_DINODE_EXTENT = 0, | ||
31 | }; | ||
32 | |||
29 | struct ocfs2_alloc_context; | 33 | struct ocfs2_alloc_context; |
30 | int ocfs2_insert_extent(struct ocfs2_super *osb, | 34 | int ocfs2_insert_extent(struct ocfs2_super *osb, |
31 | handle_t *handle, | 35 | handle_t *handle, |
32 | struct inode *inode, | 36 | struct inode *inode, |
33 | struct buffer_head *fe_bh, | 37 | struct buffer_head *root_bh, |
34 | u32 cpos, | 38 | u32 cpos, |
35 | u64 start_blk, | 39 | u64 start_blk, |
36 | u32 new_clusters, | 40 | u32 new_clusters, |
37 | u8 flags, | 41 | u8 flags, |
38 | struct ocfs2_alloc_context *meta_ac); | 42 | struct ocfs2_alloc_context *meta_ac, |
43 | enum ocfs2_extent_tree_type et_type); | ||
39 | struct ocfs2_cached_dealloc_ctxt; | 44 | struct ocfs2_cached_dealloc_ctxt; |
40 | int ocfs2_mark_extent_written(struct inode *inode, struct buffer_head *di_bh, | 45 | int ocfs2_mark_extent_written(struct inode *inode, struct buffer_head *root_bh, |
41 | handle_t *handle, u32 cpos, u32 len, u32 phys, | 46 | handle_t *handle, u32 cpos, u32 len, u32 phys, |
42 | struct ocfs2_alloc_context *meta_ac, | 47 | struct ocfs2_alloc_context *meta_ac, |
43 | struct ocfs2_cached_dealloc_ctxt *dealloc); | 48 | struct ocfs2_cached_dealloc_ctxt *dealloc, |
44 | int ocfs2_remove_extent(struct inode *inode, struct buffer_head *di_bh, | 49 | enum ocfs2_extent_tree_type et_type); |
50 | int ocfs2_remove_extent(struct inode *inode, struct buffer_head *root_bh, | ||
45 | u32 cpos, u32 len, handle_t *handle, | 51 | u32 cpos, u32 len, handle_t *handle, |
46 | struct ocfs2_alloc_context *meta_ac, | 52 | struct ocfs2_alloc_context *meta_ac, |
47 | struct ocfs2_cached_dealloc_ctxt *dealloc); | 53 | struct ocfs2_cached_dealloc_ctxt *dealloc, |
54 | enum ocfs2_extent_tree_type et_type); | ||
48 | int ocfs2_num_free_extents(struct ocfs2_super *osb, | 55 | int ocfs2_num_free_extents(struct ocfs2_super *osb, |
49 | struct inode *inode, | 56 | struct inode *inode, |
50 | struct buffer_head *bh); | 57 | struct buffer_head *root_bh, |
58 | enum ocfs2_extent_tree_type et_type); | ||
59 | |||
51 | /* | 60 | /* |
52 | * how many new metadata chunks would an allocation need at maximum? | 61 | * how many new metadata chunks would an allocation need at maximum? |
53 | * | 62 | * |