diff options
author | Josef Bacik <josef@toxicpanda.com> | 2022-09-09 17:53:18 -0400 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2022-09-26 12:28:02 +0200 |
commit | a62a3bd9546b91a46bbb74f4b4a49815b64875b1 (patch) | |
tree | 8d45705feb579493ce86b1e386e88e3690b6ef88 /fs/btrfs/extent_io.c | |
parent | cdca85b092fbf4ce6f209b174ac3e7ef2b80bebf (diff) | |
download | linux-a62a3bd9546b91a46bbb74f4b4a49815b64875b1.tar.gz linux-a62a3bd9546b91a46bbb74f4b4a49815b64875b1.tar.bz2 linux-a62a3bd9546b91a46bbb74f4b4a49815b64875b1.zip |
btrfs: separate out the extent state and extent buffer init code
In order to help separate the extent buffer from the extent io tree code
we need to break up the init functions.
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/extent_io.c')
-rw-r--r-- | fs/btrfs/extent_io.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index f4481c2212dd..8b2c6f36d8ca 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -230,7 +230,7 @@ static void submit_write_bio(struct extent_page_data *epd, int ret) } } -int __init extent_io_init(void) +int __init extent_state_init_cachep(void) { extent_state_cache = kmem_cache_create("btrfs_extent_state", sizeof(struct extent_state), 0, @@ -238,18 +238,27 @@ int __init extent_io_init(void) if (!extent_state_cache) return -ENOMEM; + return 0; +} + +int __init extent_buffer_init_cachep(void) +{ extent_buffer_cache = kmem_cache_create("btrfs_extent_buffer", sizeof(struct extent_buffer), 0, SLAB_MEM_SPREAD, NULL); - if (!extent_buffer_cache) { - kmem_cache_destroy(extent_state_cache); + if (!extent_buffer_cache) return -ENOMEM; - } return 0; } -void __cold extent_io_exit(void) +void __cold extent_state_free_cachep(void) +{ + btrfs_extent_state_leak_debug_check(); + kmem_cache_destroy(extent_state_cache); +} + +void __cold extent_buffer_free_cachep(void) { /* * Make sure all delayed rcu free are flushed before we @@ -257,8 +266,6 @@ void __cold extent_io_exit(void) */ rcu_barrier(); kmem_cache_destroy(extent_buffer_cache); - btrfs_extent_state_leak_debug_check(); - kmem_cache_destroy(extent_state_cache); } /* |