diff options
author | Theodore Ts'o <tytso@mit.edu> | 2008-09-23 09:18:24 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2008-09-23 09:18:24 -0400 |
commit | 9f6200bbfc962d8f926278cf5d5ddb90a228c322 (patch) | |
tree | 86cf42e4f1fff753a38c64d49971efd04bfdd5f9 /fs/ext4/mballoc.c | |
parent | f702ba0fd7d50b5f5f5aea5317875a10d40b869f (diff) |
ext4: move /proc setup and teardown out of mballoc.c
...and into the core setup/teardown code in fs/ext4/super.c so that
other parts of ext4 can define tuning parameters.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/mballoc.c')
-rw-r--r-- | fs/ext4/mballoc.c | 76 |
1 files changed, 22 insertions, 54 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 14ebd572bea8..842d4017006e 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -2170,9 +2170,10 @@ static void ext4_mb_history_release(struct super_block *sb) | |||
2170 | { | 2170 | { |
2171 | struct ext4_sb_info *sbi = EXT4_SB(sb); | 2171 | struct ext4_sb_info *sbi = EXT4_SB(sb); |
2172 | 2172 | ||
2173 | remove_proc_entry("mb_groups", sbi->s_mb_proc); | 2173 | if (sbi->s_proc != NULL) { |
2174 | remove_proc_entry("mb_history", sbi->s_mb_proc); | 2174 | remove_proc_entry("mb_groups", sbi->s_proc); |
2175 | 2175 | remove_proc_entry("mb_history", sbi->s_proc); | |
2176 | } | ||
2176 | kfree(sbi->s_mb_history); | 2177 | kfree(sbi->s_mb_history); |
2177 | } | 2178 | } |
2178 | 2179 | ||
@@ -2181,10 +2182,10 @@ static void ext4_mb_history_init(struct super_block *sb) | |||
2181 | struct ext4_sb_info *sbi = EXT4_SB(sb); | 2182 | struct ext4_sb_info *sbi = EXT4_SB(sb); |
2182 | int i; | 2183 | int i; |
2183 | 2184 | ||
2184 | if (sbi->s_mb_proc != NULL) { | 2185 | if (sbi->s_proc != NULL) { |
2185 | proc_create_data("mb_history", S_IRUGO, sbi->s_mb_proc, | 2186 | proc_create_data("mb_history", S_IRUGO, sbi->s_proc, |
2186 | &ext4_mb_seq_history_fops, sb); | 2187 | &ext4_mb_seq_history_fops, sb); |
2187 | proc_create_data("mb_groups", S_IRUGO, sbi->s_mb_proc, | 2188 | proc_create_data("mb_groups", S_IRUGO, sbi->s_proc, |
2188 | &ext4_mb_seq_groups_fops, sb); | 2189 | &ext4_mb_seq_groups_fops, sb); |
2189 | } | 2190 | } |
2190 | 2191 | ||
@@ -2720,8 +2721,6 @@ ext4_mb_free_committed_blocks(struct super_block *sb) | |||
2720 | #define EXT4_MB_STREAM_REQ "stream_req" | 2721 | #define EXT4_MB_STREAM_REQ "stream_req" |
2721 | #define EXT4_MB_GROUP_PREALLOC "group_prealloc" | 2722 | #define EXT4_MB_GROUP_PREALLOC "group_prealloc" |
2722 | 2723 | ||
2723 | |||
2724 | |||
2725 | #define MB_PROC_FOPS(name) \ | 2724 | #define MB_PROC_FOPS(name) \ |
2726 | static int ext4_mb_##name##_proc_show(struct seq_file *m, void *v) \ | 2725 | static int ext4_mb_##name##_proc_show(struct seq_file *m, void *v) \ |
2727 | { \ | 2726 | { \ |
@@ -2771,7 +2770,7 @@ MB_PROC_FOPS(group_prealloc); | |||
2771 | 2770 | ||
2772 | #define MB_PROC_HANDLER(name, var) \ | 2771 | #define MB_PROC_HANDLER(name, var) \ |
2773 | do { \ | 2772 | do { \ |
2774 | proc = proc_create_data(name, mode, sbi->s_mb_proc, \ | 2773 | proc = proc_create_data(name, mode, sbi->s_proc, \ |
2775 | &ext4_mb_##var##_proc_fops, sbi); \ | 2774 | &ext4_mb_##var##_proc_fops, sbi); \ |
2776 | if (proc == NULL) { \ | 2775 | if (proc == NULL) { \ |
2777 | printk(KERN_ERR "EXT4-fs: can't to create %s\n", name); \ | 2776 | printk(KERN_ERR "EXT4-fs: can't to create %s\n", name); \ |
@@ -2784,20 +2783,9 @@ static int ext4_mb_init_per_dev_proc(struct super_block *sb) | |||
2784 | mode_t mode = S_IFREG | S_IRUGO | S_IWUSR; | 2783 | mode_t mode = S_IFREG | S_IRUGO | S_IWUSR; |
2785 | struct ext4_sb_info *sbi = EXT4_SB(sb); | 2784 | struct ext4_sb_info *sbi = EXT4_SB(sb); |
2786 | struct proc_dir_entry *proc; | 2785 | struct proc_dir_entry *proc; |
2787 | char devname[BDEVNAME_SIZE], *p; | ||
2788 | 2786 | ||
2789 | if (proc_root_ext4 == NULL) { | 2787 | if (sbi->s_proc == NULL) |
2790 | sbi->s_mb_proc = NULL; | ||
2791 | return -EINVAL; | 2788 | return -EINVAL; |
2792 | } | ||
2793 | bdevname(sb->s_bdev, devname); | ||
2794 | p = devname; | ||
2795 | while ((p = strchr(p, '/'))) | ||
2796 | *p = '!'; | ||
2797 | |||
2798 | sbi->s_mb_proc = proc_mkdir(devname, proc_root_ext4); | ||
2799 | if (!sbi->s_mb_proc) | ||
2800 | goto err_create_dir; | ||
2801 | 2789 | ||
2802 | MB_PROC_HANDLER(EXT4_MB_STATS_NAME, stats); | 2790 | MB_PROC_HANDLER(EXT4_MB_STATS_NAME, stats); |
2803 | MB_PROC_HANDLER(EXT4_MB_MAX_TO_SCAN_NAME, max_to_scan); | 2791 | MB_PROC_HANDLER(EXT4_MB_MAX_TO_SCAN_NAME, max_to_scan); |
@@ -2805,43 +2793,31 @@ static int ext4_mb_init_per_dev_proc(struct super_block *sb) | |||
2805 | MB_PROC_HANDLER(EXT4_MB_ORDER2_REQ, order2_reqs); | 2793 | MB_PROC_HANDLER(EXT4_MB_ORDER2_REQ, order2_reqs); |
2806 | MB_PROC_HANDLER(EXT4_MB_STREAM_REQ, stream_request); | 2794 | MB_PROC_HANDLER(EXT4_MB_STREAM_REQ, stream_request); |
2807 | MB_PROC_HANDLER(EXT4_MB_GROUP_PREALLOC, group_prealloc); | 2795 | MB_PROC_HANDLER(EXT4_MB_GROUP_PREALLOC, group_prealloc); |
2808 | |||
2809 | return 0; | 2796 | return 0; |
2810 | 2797 | ||
2811 | err_out: | 2798 | err_out: |
2812 | remove_proc_entry(EXT4_MB_GROUP_PREALLOC, sbi->s_mb_proc); | 2799 | remove_proc_entry(EXT4_MB_GROUP_PREALLOC, sbi->s_proc); |
2813 | remove_proc_entry(EXT4_MB_STREAM_REQ, sbi->s_mb_proc); | 2800 | remove_proc_entry(EXT4_MB_STREAM_REQ, sbi->s_proc); |
2814 | remove_proc_entry(EXT4_MB_ORDER2_REQ, sbi->s_mb_proc); | 2801 | remove_proc_entry(EXT4_MB_ORDER2_REQ, sbi->s_proc); |
2815 | remove_proc_entry(EXT4_MB_MIN_TO_SCAN_NAME, sbi->s_mb_proc); | 2802 | remove_proc_entry(EXT4_MB_MIN_TO_SCAN_NAME, sbi->s_proc); |
2816 | remove_proc_entry(EXT4_MB_MAX_TO_SCAN_NAME, sbi->s_mb_proc); | 2803 | remove_proc_entry(EXT4_MB_MAX_TO_SCAN_NAME, sbi->s_proc); |
2817 | remove_proc_entry(EXT4_MB_STATS_NAME, sbi->s_mb_proc); | 2804 | remove_proc_entry(EXT4_MB_STATS_NAME, sbi->s_proc); |
2818 | remove_proc_entry(devname, proc_root_ext4); | ||
2819 | sbi->s_mb_proc = NULL; | ||
2820 | err_create_dir: | ||
2821 | printk(KERN_ERR "EXT4-fs: Unable to create %s\n", devname); | ||
2822 | |||
2823 | return -ENOMEM; | 2805 | return -ENOMEM; |
2824 | } | 2806 | } |
2825 | 2807 | ||
2826 | static int ext4_mb_destroy_per_dev_proc(struct super_block *sb) | 2808 | static int ext4_mb_destroy_per_dev_proc(struct super_block *sb) |
2827 | { | 2809 | { |
2828 | struct ext4_sb_info *sbi = EXT4_SB(sb); | 2810 | struct ext4_sb_info *sbi = EXT4_SB(sb); |
2829 | char devname[BDEVNAME_SIZE], *p; | ||
2830 | 2811 | ||
2831 | if (sbi->s_mb_proc == NULL) | 2812 | if (sbi->s_proc == NULL) |
2832 | return -EINVAL; | 2813 | return -EINVAL; |
2833 | 2814 | ||
2834 | bdevname(sb->s_bdev, devname); | 2815 | remove_proc_entry(EXT4_MB_GROUP_PREALLOC, sbi->s_proc); |
2835 | p = devname; | 2816 | remove_proc_entry(EXT4_MB_STREAM_REQ, sbi->s_proc); |
2836 | while ((p = strchr(p, '/'))) | 2817 | remove_proc_entry(EXT4_MB_ORDER2_REQ, sbi->s_proc); |
2837 | *p = '!'; | 2818 | remove_proc_entry(EXT4_MB_MIN_TO_SCAN_NAME, sbi->s_proc); |
2838 | remove_proc_entry(EXT4_MB_GROUP_PREALLOC, sbi->s_mb_proc); | 2819 | remove_proc_entry(EXT4_MB_MAX_TO_SCAN_NAME, sbi->s_proc); |
2839 | remove_proc_entry(EXT4_MB_STREAM_REQ, sbi->s_mb_proc); | 2820 | remove_proc_entry(EXT4_MB_STATS_NAME, sbi->s_proc); |
2840 | remove_proc_entry(EXT4_MB_ORDER2_REQ, sbi->s_mb_proc); | ||
2841 | remove_proc_entry(EXT4_MB_MIN_TO_SCAN_NAME, sbi->s_mb_proc); | ||
2842 | remove_proc_entry(EXT4_MB_MAX_TO_SCAN_NAME, sbi->s_mb_proc); | ||
2843 | remove_proc_entry(EXT4_MB_STATS_NAME, sbi->s_mb_proc); | ||
2844 | remove_proc_entry(devname, proc_root_ext4); | ||
2845 | 2821 | ||
2846 | return 0; | 2822 | return 0; |
2847 | } | 2823 | } |
@@ -2863,11 +2839,6 @@ int __init init_ext4_mballoc(void) | |||
2863 | kmem_cache_destroy(ext4_pspace_cachep); | 2839 | kmem_cache_destroy(ext4_pspace_cachep); |
2864 | return -ENOMEM; | 2840 | return -ENOMEM; |
2865 | } | 2841 | } |
2866 | #ifdef CONFIG_PROC_FS | ||
2867 | proc_root_ext4 = proc_mkdir("fs/ext4", NULL); | ||
2868 | if (proc_root_ext4 == NULL) | ||
2869 | printk(KERN_ERR "EXT4-fs: Unable to create fs/ext4\n"); | ||
2870 | #endif | ||
2871 | return 0; | 2842 | return 0; |
2872 | } | 2843 | } |
2873 | 2844 | ||
@@ -2876,9 +2847,6 @@ void exit_ext4_mballoc(void) | |||
2876 | /* XXX: synchronize_rcu(); */ | 2847 | /* XXX: synchronize_rcu(); */ |
2877 | kmem_cache_destroy(ext4_pspace_cachep); | 2848 | kmem_cache_destroy(ext4_pspace_cachep); |
2878 | kmem_cache_destroy(ext4_ac_cachep); | 2849 | kmem_cache_destroy(ext4_ac_cachep); |
2879 | #ifdef CONFIG_PROC_FS | ||
2880 | remove_proc_entry("fs/ext4", NULL); | ||
2881 | #endif | ||
2882 | } | 2850 | } |
2883 | 2851 | ||
2884 | 2852 | ||