From a1a5e2eaaea5292da062f6dfbed66b5e07d396d3 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Tue, 9 Oct 2007 21:33:06 -0400 Subject: [PATCH] Fix mballoc-core.patch so it will compile w/o CONFIG_PROC_FS Also add better error checking and recovery around mballoc initialization. --- mballoc-core.patch | 72 +++++++++++++++++++++++++++--------------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/mballoc-core.patch b/mballoc-core.patch index 4243e266..e544c1eb 100644 --- a/mballoc-core.patch +++ b/mballoc-core.patch @@ -84,22 +84,7 @@ Signed-off-by: Alex Tomas Signed-off-by: Andreas Dilger Signed-off-by: Eric Sandeen Signed-off-by: Aneesh Kumar K.V ---- - - fs/ext4/Makefile | 2 - fs/ext4/balloc.c | 67 + - fs/ext4/extents.c | 45 - fs/ext4/inode.c | 14 - fs/ext4/mballoc.c | 4407 ++++++++++++++++++++++++++++++++++++++++++++ - fs/ext4/migrate.c | 10 - fs/ext4/super.c | 30 - fs/ext4/xattr.c | 4 - include/linux/ext4_fs.h | 43 - include/linux/ext4_fs_i.h | 4 - include/linux/ext4_fs_sb.h | 61 + - 11 files changed, 4650 insertions(+), 37 deletions(-) - create mode 100644 fs/ext4/mballoc.c - +Signed-off-by: "Theodore Ts'o" diff --git a/fs/ext4/Makefile b/fs/ext4/Makefile index d5fd80b..ac6fa8c 100644 @@ -115,7 +100,7 @@ index d5fd80b..ac6fa8c 100644 ext4dev-$(CONFIG_EXT4DEV_FS_XATTR) += xattr.o xattr_user.o xattr_trusted.o ext4dev-$(CONFIG_EXT4DEV_FS_POSIX_ACL) += acl.o diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c -index d4d0376..47f70a8 100644 +index 43e7263..8e13e3a 100644 --- a/fs/ext4/balloc.c +++ b/fs/ext4/balloc.c @@ -514,6 +514,8 @@ void ext4_discard_reservation(struct inode *inode) @@ -414,10 +399,10 @@ index 1f3517d..de5619f 100644 /* diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c new file mode 100644 -index 0000000..4409c0c +index 0000000..b247ca0 --- /dev/null +++ b/fs/ext4/mballoc.c -@@ -0,0 +1,4407 @@ +@@ -0,0 +1,4411 @@ +/* + * Copyright (c) 2003-2006, Cluster File Systems, Inc, info@clusterfs.com + * Written by Alex Tomas @@ -3265,7 +3250,7 @@ index 0000000..4409c0c + return 0; +} + -+int __init init_ext4_proc(void) ++int __init init_ext4_mballoc(void) +{ + ext4_pspace_cachep = + kmem_cache_create("ext4_prealloc_space", @@ -3274,18 +3259,22 @@ index 0000000..4409c0c + if (ext4_pspace_cachep == NULL) + return -ENOMEM; + ++#ifdef CONFIG_PROC_FS + proc_root_ext4 = proc_mkdir(EXT4_ROOT, proc_root_fs); + if (proc_root_ext4 == NULL) + printk(KERN_ERR "EXT4-fs: Unable to create %s\n", EXT4_ROOT); ++#endif + + return 0; +} + -+void exit_ext4_proc(void) ++void exit_ext4_mballoc(void) +{ + /* XXX: synchronize_rcu(); */ + kmem_cache_destroy(ext4_pspace_cachep); ++#ifdef CONFIG_PROC_FS + remove_proc_entry(EXT4_ROOT, proc_root_fs); ++#endif +} + + @@ -4871,7 +4860,7 @@ index 54f2975..3a306b8 100644 } else { diff --git a/fs/ext4/super.c b/fs/ext4/super.c -index 8876bc8..9456c8f 100644 +index 0426eb7..5882165 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -443,6 +443,7 @@ static void ext4_put_super (struct super_block * sb) @@ -4929,7 +4918,7 @@ index 8876bc8..9456c8f 100644 default: printk (KERN_ERR "EXT4-fs: Unrecognized mount option \"%s\" " -@@ -1994,6 +2014,7 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent) +@@ -1989,6 +2009,7 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent) "writeback"); ext4_ext_init(sb); @@ -4937,26 +4926,37 @@ index 8876bc8..9456c8f 100644 lock_kernel(); return 0; -@@ -2976,7 +2997,13 @@ static struct file_system_type ext4dev_fs_type = { +@@ -2971,9 +2992,15 @@ static struct file_system_type ext4dev_fs_type = { static int __init init_ext4_fs(void) { - int err = init_ext4_xattr(); + int err; + -+ err = init_ext4_proc(); -+ if (err) -+ return err; -+ -+ err = init_ext4_xattr(); ++ err = init_ext4_mballoc(); if (err) return err; ++ ++ err = init_ext4_xattr(); ++ if (err) ++ goto out2; err = init_inodecache(); -@@ -2998,6 +3025,7 @@ static void __exit exit_ext4_fs(void) + if (err) + goto out1; +@@ -2985,6 +3012,8 @@ out: + destroy_inodecache(); + out1: + exit_ext4_xattr(); ++out2: ++ exit_ext4_mballoc(); + return err; + } + +@@ -2993,6 +3022,7 @@ static void __exit exit_ext4_fs(void) unregister_filesystem(&ext4dev_fs_type); destroy_inodecache(); exit_ext4_xattr(); -+ exit_ext4_proc(); ++ exit_ext4_mballoc(); } MODULE_AUTHOR("Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others"); @@ -4983,7 +4983,7 @@ index 8638730..d796213 100644 goto cleanup; } diff --git a/include/linux/ext4_fs.h b/include/linux/ext4_fs.h -index edce61c..ec2e2a1 100644 +index 122e876..783c6f3 100644 --- a/include/linux/ext4_fs.h +++ b/include/linux/ext4_fs.h @@ -20,6 +20,8 @@ @@ -5035,7 +5035,7 @@ index edce61c..ec2e2a1 100644 /* Compatibility, for having both ext2_fs.h and ext4_fs.h included at once */ #ifndef _LINUX_EXT2_FS_H #define clear_opt(o, opt) o &= ~EXT4_MOUNT_##opt -@@ -900,7 +928,7 @@ extern ext4_fsblk_t ext4_new_block (handle_t *handle, struct inode *inode, +@@ -880,7 +908,7 @@ extern ext4_fsblk_t ext4_new_block (handle_t *handle, struct inode *inode, extern ext4_fsblk_t ext4_new_blocks (handle_t *handle, struct inode *inode, ext4_fsblk_t goal, unsigned long *count, int *errp); extern void ext4_free_blocks (handle_t *handle, struct inode *inode, @@ -5044,7 +5044,7 @@ index edce61c..ec2e2a1 100644 extern void ext4_free_blocks_sb (handle_t *handle, struct super_block *sb, ext4_fsblk_t block, unsigned long count, unsigned long *pdquot_freed_blocks); -@@ -938,6 +966,19 @@ extern unsigned long ext4_count_dirs (struct super_block *); +@@ -918,6 +946,19 @@ extern unsigned long ext4_count_dirs (struct super_block *); extern void ext4_check_inodes_bitmap (struct super_block *); extern unsigned long ext4_count_free (struct buffer_head *, unsigned); @@ -5056,8 +5056,8 @@ index edce61c..ec2e2a1 100644 +extern ext4_fsblk_t ext4_mb_new_blocks(handle_t *, struct ext4_allocation_request *, int *); +extern int ext4_mb_reserve_blocks(struct super_block *, int); +extern void ext4_mb_discard_inode_preallocations(struct inode *); -+extern int __init init_ext4_proc(void); -+extern void exit_ext4_proc(void); ++extern int __init init_ext4_mballoc(void); ++extern void exit_ext4_mballoc(void); +extern void ext4_mb_free_blocks(handle_t *, struct inode *, + unsigned long, unsigned long, int, unsigned long *); + -- 2.11.4.GIT