summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_super.c
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2021-09-23 14:10:59 -0700
committerDarrick J. Wong <djwong@kernel.org>2021-10-22 16:40:56 -0700
commitcf94cb4944fb956a8d48ef228cb76b8c37182580 (patch)
treecb7eed8e397fff94fe4edc37f735fd622253f67f /fs/xfs/xfs_super.c
parent3396bc20567d6592ae2cb684e3abd8b70667d851 (diff)
xfs: check absolute maximum nlevels for each btree type
Add code for all five btree types so that we can compute the absolute maximum possible btree height for each btree type, and then check that none of them exceed XFS_BTREE_CUR_ZONE_MAXLEVELS. The code to do the actual checking is a little excessive, but it sets us up for per-type cursor zones in the next patch. xfs_btree_absolute_maxlevels exists to enable xfs_db functionality. Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Diffstat (limited to 'fs/xfs/xfs_super.c')
-rw-r--r--fs/xfs/xfs_super.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index af8c5d06cc82..0b1c1960e6ce 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -38,6 +38,12 @@
#include "xfs_pwork.h"
#include "xfs_ag.h"
#include "xfs_swapext_item.h"
+#include "xfs_btree.h"
+#include "xfs_alloc_btree.h"
+#include "xfs_ialloc_btree.h"
+#include "xfs_bmap_btree.h"
+#include "xfs_rmap_btree.h"
+#include "xfs_refcount_btree.h"
#include <linux/magic.h>
#include <linux/fs_context.h>
@@ -2007,8 +2013,34 @@ static struct file_system_type xfs_fs_type = {
MODULE_ALIAS_FS("xfs");
STATIC int __init
+xfs_init_btree_caches(void)
+{
+ int error;
+
+ error = xfs_allocbt_create_cursor_cache();
+ if (error)
+ return error;
+ error = xfs_inobt_create_cursor_cache();
+ if (error)
+ return error;
+ error = xfs_bmbt_create_cursor_cache();
+ if (error)
+ return error;
+ error = xfs_rmapbt_create_cursor_cache();
+ if (error)
+ return error;
+ error = xfs_refcountbt_create_cursor_cache();
+ if (error)
+ return error;
+
+ return 0;
+}
+
+STATIC int __init
xfs_init_zones(void)
{
+ int error;
+
xfs_log_ticket_zone = kmem_cache_create("xfs_log_ticket",
sizeof(struct xlog_ticket),
0, 0, NULL);
@@ -2021,6 +2053,10 @@ xfs_init_zones(void)
if (!xfs_bmap_free_item_zone)
goto out_destroy_log_ticket_zone;
+ error = xfs_init_btree_caches();
+ if (error)
+ goto out_destroy_bmap_free_item_zone;
+
xfs_btree_cur_zone = kmem_cache_create("xfs_btree_cur",
xfs_btree_cur_sizeof(XFS_BTREE_CUR_ZONE_MAXLEVELS),
0, 0, NULL);