]>
Commit | Line | Data |
---|---|---|
2cb7cef9 BS |
1 | From: Joel Becker <joel.becker@oracle.com> |
2 | Subject: ocfs2: Determine an extent tree's max_leaf_clusters in an et_op. | |
3 | Patch-mainline: 2.6.28? | |
4 | References: FATE302067 | |
5 | ||
6 | Provide an optional extent_tree_operation to specify the | |
7 | max_leaf_clusters of an ocfs2_extent_tree. If not provided, the value | |
8 | is 0 (unlimited). | |
9 | ||
10 | Signed-off-by: Joel Becker <joel.becker@oracle.com> | |
11 | Acked-by: Mark Fasheh <mark.fasheh@suse.com> | |
12 | --- | |
13 | fs/ocfs2/alloc.c | 18 +++++++++++++++--- | |
14 | 1 files changed, 15 insertions(+), 3 deletions(-) | |
15 | ||
16 | diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c | |
17 | index 0b900f6..7c0721d 100644 | |
18 | --- a/fs/ocfs2/alloc.c | |
19 | +++ b/fs/ocfs2/alloc.c | |
20 | @@ -76,6 +76,8 @@ struct ocfs2_extent_tree_operations { | |
21 | /* These are internal to ocfs2_extent_tree and don't have | |
22 | * accessor functions */ | |
23 | void (*eo_fill_root_el)(struct ocfs2_extent_tree *et); | |
24 | + void (*eo_fill_max_leaf_clusters)(struct inode *inode, | |
25 | + struct ocfs2_extent_tree *et); | |
26 | }; | |
27 | ||
28 | struct ocfs2_extent_tree { | |
29 | @@ -205,6 +207,14 @@ static void ocfs2_xattr_tree_fill_root_el(struct ocfs2_extent_tree *et) | |
30 | et->et_root_el = &xb->xb_attrs.xb_root.xt_list; | |
31 | } | |
32 | ||
33 | +static void ocfs2_xattr_tree_fill_max_leaf_clusters(struct inode *inode, | |
34 | + struct ocfs2_extent_tree *et) | |
35 | +{ | |
36 | + et->et_max_leaf_clusters = | |
37 | + ocfs2_clusters_for_bytes(inode->i_sb, | |
38 | + OCFS2_MAX_XATTR_TREE_LEAF_SIZE); | |
39 | +} | |
40 | + | |
41 | static void ocfs2_xattr_tree_set_last_eb_blk(struct ocfs2_extent_tree *et, | |
42 | u64 blkno) | |
43 | { | |
44 | @@ -243,6 +253,7 @@ static struct ocfs2_extent_tree_operations ocfs2_xattr_tree_et_ops = { | |
45 | .eo_update_clusters = ocfs2_xattr_tree_update_clusters, | |
46 | .eo_sanity_check = ocfs2_xattr_tree_sanity_check, | |
47 | .eo_fill_root_el = ocfs2_xattr_tree_fill_root_el, | |
48 | + .eo_fill_max_leaf_clusters = ocfs2_xattr_tree_fill_max_leaf_clusters, | |
49 | }; | |
50 | ||
51 | static void ocfs2_get_extent_tree(struct ocfs2_extent_tree *et, | |
52 | @@ -254,7 +265,6 @@ static void ocfs2_get_extent_tree(struct ocfs2_extent_tree *et, | |
53 | et->et_type = et_type; | |
54 | get_bh(bh); | |
55 | et->et_root_bh = bh; | |
56 | - et->et_max_leaf_clusters = 0; | |
57 | if (!obj) | |
58 | obj = (void *)bh->b_data; | |
59 | et->et_object = obj; | |
60 | @@ -265,11 +275,13 @@ static void ocfs2_get_extent_tree(struct ocfs2_extent_tree *et, | |
61 | et->et_ops = &ocfs2_xattr_et_ops; | |
62 | } else if (et_type == OCFS2_XATTR_TREE_EXTENT) { | |
63 | et->et_ops = &ocfs2_xattr_tree_et_ops; | |
64 | - et->et_max_leaf_clusters = ocfs2_clusters_for_bytes(inode->i_sb, | |
65 | - OCFS2_MAX_XATTR_TREE_LEAF_SIZE); | |
66 | } | |
67 | ||
68 | et->et_ops->eo_fill_root_el(et); | |
69 | + if (!et->et_ops->eo_fill_max_leaf_clusters) | |
70 | + et->et_max_leaf_clusters = 0; | |
71 | + else | |
72 | + et->et_ops->eo_fill_max_leaf_clusters(inode, et); | |
73 | } | |
74 | ||
75 | static void ocfs2_put_extent_tree(struct ocfs2_extent_tree *et) | |
76 | -- | |
77 | 1.5.4.5 | |
78 |