aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/super.c
diff options
context:
space:
mode:
authorT Makphaibulchoke <tmac@hp.com>2014-03-18 19:24:49 -0400
committerTheodore Ts'o <tytso@mit.edu>2014-03-18 19:24:49 -0400
commit9c191f701ce9f9bc604e88a5dc69cd943daa5d3b (patch)
tree2e7a0ffa25f89e6dab1719deeb6a710405517afc /fs/ext4/super.c
parent1f3e55fe02d12213f87869768aa2b0bad3ba9a7d (diff)
ext4: each filesystem creates and uses its own mb_cache
This patch adds new interfaces to create and destory cache, ext4_xattr_create_cache() and ext4_xattr_destroy_cache(), and remove the cache creation and destory calls from ex4_init_xattr() and ext4_exitxattr() in fs/ext4/xattr.c. fs/ext4/super.c has been changed so that when a filesystem is mounted a cache is allocated and attched to its ext4_sb_info structure. fs/mbcache.c has been changed so that only one slab allocator is allocated and used by all mbcache structures. Signed-off-by: T. Makphaibulchoke <tmac@hp.com>
Diffstat (limited to 'fs/ext4/super.c')
-rw-r--r--fs/ext4/super.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 89baee42f353..5a51af7d0335 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -59,6 +59,7 @@ static struct kset *ext4_kset;
59static struct ext4_lazy_init *ext4_li_info; 59static struct ext4_lazy_init *ext4_li_info;
60static struct mutex ext4_li_mtx; 60static struct mutex ext4_li_mtx;
61static struct ext4_features *ext4_feat; 61static struct ext4_features *ext4_feat;
62static int ext4_mballoc_ready;
62 63
63static int ext4_load_journal(struct super_block *, struct ext4_super_block *, 64static int ext4_load_journal(struct super_block *, struct ext4_super_block *,
64 unsigned long journal_devnum); 65 unsigned long journal_devnum);
@@ -845,6 +846,10 @@ static void ext4_put_super(struct super_block *sb)
845 invalidate_bdev(sbi->journal_bdev); 846 invalidate_bdev(sbi->journal_bdev);
846 ext4_blkdev_remove(sbi); 847 ext4_blkdev_remove(sbi);
847 } 848 }
849 if (sbi->s_mb_cache) {
850 ext4_xattr_destroy_cache(sbi->s_mb_cache);
851 sbi->s_mb_cache = NULL;
852 }
848 if (sbi->s_mmp_tsk) 853 if (sbi->s_mmp_tsk)
849 kthread_stop(sbi->s_mmp_tsk); 854 kthread_stop(sbi->s_mmp_tsk);
850 sb->s_fs_info = NULL; 855 sb->s_fs_info = NULL;
@@ -4010,6 +4015,14 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
4010 percpu_counter_set(&sbi->s_dirtyclusters_counter, 0); 4015 percpu_counter_set(&sbi->s_dirtyclusters_counter, 0);
4011 4016
4012no_journal: 4017no_journal:
4018 if (ext4_mballoc_ready) {
4019 sbi->s_mb_cache = ext4_xattr_create_cache(sb->s_id);
4020 if (!sbi->s_mb_cache) {
4021 ext4_msg(sb, KERN_ERR, "Failed to create an mb_cache");
4022 goto failed_mount_wq;
4023 }
4024 }
4025
4013 /* 4026 /*
4014 * Get the # of file system overhead blocks from the 4027 * Get the # of file system overhead blocks from the
4015 * superblock if present. 4028 * superblock if present.
@@ -5519,11 +5532,9 @@ static int __init ext4_init_fs(void)
5519 5532
5520 err = ext4_init_mballoc(); 5533 err = ext4_init_mballoc();
5521 if (err) 5534 if (err)
5522 goto out3;
5523
5524 err = ext4_init_xattr();
5525 if (err)
5526 goto out2; 5535 goto out2;
5536 else
5537 ext4_mballoc_ready = 1;
5527 err = init_inodecache(); 5538 err = init_inodecache();
5528 if (err) 5539 if (err)
5529 goto out1; 5540 goto out1;
@@ -5539,10 +5550,9 @@ out:
5539 unregister_as_ext3(); 5550 unregister_as_ext3();
5540 destroy_inodecache(); 5551 destroy_inodecache();
5541out1: 5552out1:
5542 ext4_exit_xattr(); 5553 ext4_mballoc_ready = 0;
5543out2:
5544 ext4_exit_mballoc(); 5554 ext4_exit_mballoc();
5545out3: 5555out2:
5546 ext4_exit_feat_adverts(); 5556 ext4_exit_feat_adverts();
5547out4: 5557out4:
5548 if (ext4_proc_root) 5558 if (ext4_proc_root)
@@ -5565,7 +5575,6 @@ static void __exit ext4_exit_fs(void)
5565 unregister_as_ext3(); 5575 unregister_as_ext3();
5566 unregister_filesystem(&ext4_fs_type); 5576 unregister_filesystem(&ext4_fs_type);
5567 destroy_inodecache(); 5577 destroy_inodecache();
5568 ext4_exit_xattr();
5569 ext4_exit_mballoc(); 5578 ext4_exit_mballoc();
5570 ext4_exit_feat_adverts(); 5579 ext4_exit_feat_adverts();
5571 remove_proc_entry("fs/ext4", NULL); 5580 remove_proc_entry("fs/ext4", NULL);