summaryrefslogtreecommitdiff
path: root/fs/btrfs/transaction.c
diff options
context:
space:
mode:
authorJosef Bacik <josef@toxicpanda.com>2022-09-14 11:06:37 -0400
committerDavid Sterba <dsterba@suse.com>2022-12-05 18:00:37 +0100
commit956504a331a613814279b04f9b0d663c7c2bb9bc (patch)
tree9b55ec7c35796aadb5fc214d8fcad1f1ed28ce0b /fs/btrfs/transaction.c
parentf60acad355cf14ccccf420e6ea0ddd6de87cb210 (diff)
btrfs: move trans_handle_cachep out of ctree.h
This is local to the transaction code, remove it from ctree.h and inode.c, create new helpers in the transaction to handle the init work and move the cachep locally to transaction.c. Reviewed-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/transaction.c')
-rw-r--r--fs/btrfs/transaction.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index d1f1da6820fb..ae7d4aca771d 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -24,6 +24,8 @@
#include "space-info.h"
#include "zoned.h"
+static struct kmem_cache *btrfs_trans_handle_cachep;
+
#define BTRFS_ROOT_TRANS_TAG 0
/*
@@ -2600,3 +2602,18 @@ void btrfs_apply_pending_changes(struct btrfs_fs_info *fs_info)
btrfs_warn(fs_info,
"unknown pending changes left 0x%lx, ignoring", prev);
}
+
+int __init btrfs_transaction_init(void)
+{
+ btrfs_trans_handle_cachep = kmem_cache_create("btrfs_trans_handle",
+ sizeof(struct btrfs_trans_handle), 0,
+ SLAB_TEMPORARY | SLAB_MEM_SPREAD, NULL);
+ if (!btrfs_trans_handle_cachep)
+ return -ENOMEM;
+ return 0;
+}
+
+void __cold btrfs_transaction_exit(void)
+{
+ kmem_cache_destroy(btrfs_trans_handle_cachep);
+}