[PATCH 28/39] ocfs2: Determine an extent tree's max_leaf_clusters in an et_op.

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Mark Fasheh
Date: Wednesday, September 24, 2008 - 3:01 pm

From: Joel Becker <joel.becker@oracle.com>

Provide an optional extent_tree_operation to specify the
max_leaf_clusters of an ocfs2_extent_tree.  If not provided, the value
is 0 (unlimited).

Signed-off-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
---
 fs/ocfs2/alloc.c |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index 0b900f6..7c0721d 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -76,6 +76,8 @@ struct ocfs2_extent_tree_operations {
 	/* These are internal to ocfs2_extent_tree and don't have
 	 * accessor functions */
 	void (*eo_fill_root_el)(struct ocfs2_extent_tree *et);
+	void (*eo_fill_max_leaf_clusters)(struct inode *inode,
+					  struct ocfs2_extent_tree *et);
 };
 
 struct ocfs2_extent_tree {
@@ -205,6 +207,14 @@ static void ocfs2_xattr_tree_fill_root_el(struct ocfs2_extent_tree *et)
 	et->et_root_el = &xb->xb_attrs.xb_root.xt_list;
 }
 
+static void ocfs2_xattr_tree_fill_max_leaf_clusters(struct inode *inode,
+						    struct ocfs2_extent_tree *et)
+{
+	et->et_max_leaf_clusters =
+		ocfs2_clusters_for_bytes(inode->i_sb,
+					 OCFS2_MAX_XATTR_TREE_LEAF_SIZE);
+}
+
 static void ocfs2_xattr_tree_set_last_eb_blk(struct ocfs2_extent_tree *et,
 					     u64 blkno)
 {
@@ -243,6 +253,7 @@ static struct ocfs2_extent_tree_operations ocfs2_xattr_tree_et_ops = {
 	.eo_update_clusters	= ocfs2_xattr_tree_update_clusters,
 	.eo_sanity_check	= ocfs2_xattr_tree_sanity_check,
 	.eo_fill_root_el	= ocfs2_xattr_tree_fill_root_el,
+	.eo_fill_max_leaf_clusters = ocfs2_xattr_tree_fill_max_leaf_clusters,
 };
 
 static void ocfs2_get_extent_tree(struct ocfs2_extent_tree *et,
@@ -254,7 +265,6 @@ static void ocfs2_get_extent_tree(struct ocfs2_extent_tree *et,
 	et->et_type = et_type;
 	get_bh(bh);
 	et->et_root_bh = bh;
-	et->et_max_leaf_clusters = 0;
 	if (!obj)
 		obj = (void *)bh->b_data;
 	et->et_object = obj;
@@ -265,11 +275,13 @@ static void ocfs2_get_extent_tree(struct ocfs2_extent_tree *et,
 		et->et_ops = &ocfs2_xattr_et_ops;
 	} else if (et_type == OCFS2_XATTR_TREE_EXTENT) {
 		et->et_ops = &ocfs2_xattr_tree_et_ops;
-		et->et_max_leaf_clusters = ocfs2_clusters_for_bytes(inode->i_sb,
-						OCFS2_MAX_XATTR_TREE_LEAF_SIZE);
 	}
 
 	et->et_ops->eo_fill_root_el(et);
+	if (!et->et_ops->eo_fill_max_leaf_clusters)
+		et->et_max_leaf_clusters = 0;
+	else
+		et->et_ops->eo_fill_max_leaf_clusters(inode, et);
 }
 
 static void ocfs2_put_extent_tree(struct ocfs2_extent_tree *et)
-- 
1.5.4.5

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/39] Ocfs2 updates for 2.6.28, Mark Fasheh, (Wed Sep 24, 3:00 pm)
[PATCH 01/39] ocfs2: POSIX file locks support, Mark Fasheh, (Wed Sep 24, 3:00 pm)
[PATCH 02/39] ocfs2: Track local alloc bits internally, Mark Fasheh, (Wed Sep 24, 3:00 pm)
[PATCH 13/39] ocfs2: Add extended attribute support, Mark Fasheh, (Wed Sep 24, 3:00 pm)
[PATCH 14/39] ocfs2: Add xattr index tree operations, Mark Fasheh, (Wed Sep 24, 3:00 pm)
[PATCH 18/39] ocfs2: Enable xattr set in index btree, Mark Fasheh, (Wed Sep 24, 3:00 pm)
[PATCH 21/39] ocfs2: fix printk format warnings, Mark Fasheh, (Wed Sep 24, 3:01 pm)
[PATCH 28/39] ocfs2: Determine an extent tree's max_leaf_c ..., Mark Fasheh, (Wed Sep 24, 3:01 pm)
[PATCH 36/39] ocfs2: Limit inode allocation to 32bits., Mark Fasheh, (Wed Sep 24, 3:01 pm)
[PATCH 37/39] ocfs2: Add the 'inode64' mount option., Mark Fasheh, (Wed Sep 24, 3:01 pm)
[PATCH 38/39] ocfs2: Switch over to JBD2., Mark Fasheh, (Wed Sep 24, 3:01 pm)
Re: [PATCH 0/39] Ocfs2 updates for 2.6.28, Tao Ma, (Sat Sep 27, 10:16 pm)
Re: [PATCH 01/39] ocfs2: POSIX file locks support, Andrew Morton, (Wed Oct 1, 11:11 pm)
Re: [PATCH 13/39] ocfs2: Add extended attribute support, Andrew Morton, (Wed Oct 1, 11:12 pm)
Re: [PATCH 01/39] ocfs2: POSIX file locks support, Mark Fasheh, (Tue Oct 7, 1:09 pm)