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/super.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/super.c')
-rw-r--r-- | fs/ext4/super.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index fb5766e2bffe..7feeec6f7c39 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/namei.h> | 34 | #include <linux/namei.h> |
35 | #include <linux/quotaops.h> | 35 | #include <linux/quotaops.h> |
36 | #include <linux/seq_file.h> | 36 | #include <linux/seq_file.h> |
37 | #include <linux/proc_fs.h> | ||
37 | #include <linux/log2.h> | 38 | #include <linux/log2.h> |
38 | #include <linux/crc16.h> | 39 | #include <linux/crc16.h> |
39 | #include <asm/uaccess.h> | 40 | #include <asm/uaccess.h> |
@@ -45,6 +46,8 @@ | |||
45 | #include "namei.h" | 46 | #include "namei.h" |
46 | #include "group.h" | 47 | #include "group.h" |
47 | 48 | ||
49 | struct proc_dir_entry *ext4_proc_root; | ||
50 | |||
48 | static int ext4_load_journal(struct super_block *, struct ext4_super_block *, | 51 | static int ext4_load_journal(struct super_block *, struct ext4_super_block *, |
49 | unsigned long journal_devnum); | 52 | unsigned long journal_devnum); |
50 | static int ext4_create_journal(struct super_block *, struct ext4_super_block *, | 53 | static int ext4_create_journal(struct super_block *, struct ext4_super_block *, |
@@ -512,6 +515,8 @@ static void ext4_put_super(struct super_block *sb) | |||
512 | mark_buffer_dirty(sbi->s_sbh); | 515 | mark_buffer_dirty(sbi->s_sbh); |
513 | ext4_commit_super(sb, es, 1); | 516 | ext4_commit_super(sb, es, 1); |
514 | } | 517 | } |
518 | if (sbi->s_proc) | ||
519 | remove_proc_entry(sb->s_id, ext4_proc_root); | ||
515 | 520 | ||
516 | for (i = 0; i < sbi->s_gdb_count; i++) | 521 | for (i = 0; i < sbi->s_gdb_count; i++) |
517 | brelse(sbi->s_group_desc[i]); | 522 | brelse(sbi->s_group_desc[i]); |
@@ -1916,6 +1921,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
1916 | unsigned long journal_devnum = 0; | 1921 | unsigned long journal_devnum = 0; |
1917 | unsigned long def_mount_opts; | 1922 | unsigned long def_mount_opts; |
1918 | struct inode *root; | 1923 | struct inode *root; |
1924 | char *cp; | ||
1919 | int ret = -EINVAL; | 1925 | int ret = -EINVAL; |
1920 | int blocksize; | 1926 | int blocksize; |
1921 | int db_count; | 1927 | int db_count; |
@@ -1936,6 +1942,10 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
1936 | 1942 | ||
1937 | unlock_kernel(); | 1943 | unlock_kernel(); |
1938 | 1944 | ||
1945 | /* Cleanup superblock name */ | ||
1946 | for (cp = sb->s_id; (cp = strchr(cp, '/'));) | ||
1947 | *cp = '!'; | ||
1948 | |||
1939 | blocksize = sb_min_blocksize(sb, EXT4_MIN_BLOCK_SIZE); | 1949 | blocksize = sb_min_blocksize(sb, EXT4_MIN_BLOCK_SIZE); |
1940 | if (!blocksize) { | 1950 | if (!blocksize) { |
1941 | printk(KERN_ERR "EXT4-fs: unable to set blocksize\n"); | 1951 | printk(KERN_ERR "EXT4-fs: unable to set blocksize\n"); |
@@ -2221,6 +2231,9 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
2221 | goto failed_mount; | 2231 | goto failed_mount; |
2222 | } | 2232 | } |
2223 | 2233 | ||
2234 | if (ext4_proc_root) | ||
2235 | sbi->s_proc = proc_mkdir(sb->s_id, ext4_proc_root); | ||
2236 | |||
2224 | bgl_lock_init(&sbi->s_blockgroup_lock); | 2237 | bgl_lock_init(&sbi->s_blockgroup_lock); |
2225 | 2238 | ||
2226 | for (i = 0; i < db_count; i++) { | 2239 | for (i = 0; i < db_count; i++) { |
@@ -2500,6 +2513,8 @@ failed_mount2: | |||
2500 | brelse(sbi->s_group_desc[i]); | 2513 | brelse(sbi->s_group_desc[i]); |
2501 | kfree(sbi->s_group_desc); | 2514 | kfree(sbi->s_group_desc); |
2502 | failed_mount: | 2515 | failed_mount: |
2516 | if (sbi->s_proc) | ||
2517 | remove_proc_entry(sb->s_id, ext4_proc_root); | ||
2503 | #ifdef CONFIG_QUOTA | 2518 | #ifdef CONFIG_QUOTA |
2504 | for (i = 0; i < MAXQUOTAS; i++) | 2519 | for (i = 0; i < MAXQUOTAS; i++) |
2505 | kfree(sbi->s_qf_names[i]); | 2520 | kfree(sbi->s_qf_names[i]); |
@@ -3538,6 +3553,7 @@ static int __init init_ext4_fs(void) | |||
3538 | { | 3553 | { |
3539 | int err; | 3554 | int err; |
3540 | 3555 | ||
3556 | ext4_proc_root = proc_mkdir("fs/ext4", NULL); | ||
3541 | err = init_ext4_mballoc(); | 3557 | err = init_ext4_mballoc(); |
3542 | if (err) | 3558 | if (err) |
3543 | return err; | 3559 | return err; |
@@ -3567,6 +3583,7 @@ static void __exit exit_ext4_fs(void) | |||
3567 | destroy_inodecache(); | 3583 | destroy_inodecache(); |
3568 | exit_ext4_xattr(); | 3584 | exit_ext4_xattr(); |
3569 | exit_ext4_mballoc(); | 3585 | exit_ext4_mballoc(); |
3586 | remove_proc_entry("fs/ext4", NULL); | ||
3570 | } | 3587 | } |
3571 | 3588 | ||
3572 | MODULE_AUTHOR("Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others"); | 3589 | MODULE_AUTHOR("Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others"); |