It makes no sense having the emergency thaw code in fs/buffer.c when all of it's operations are one superblocks and the code it executes is all in fs/super.c. Move the code there and clean it up. Cc: Josef Bacik <jbacik@xxxxxxxxxxxx> Cc: Eric Sandeen <sandeen@xxxxxxxxxx> Cc: Christoph Hellwig <hch@xxxxxxxxxxxxx> Reviewed-by: Jan Kara <jack@xxxxxxx> Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx> Signed-off-by: Fernando Luis Vazquez Cao <fernando@xxxxxxxxxxxxx> --- diff -urNp linux-3.6-rc5-orig/fs/buffer.c linux-3.6-rc5/fs/buffer.c --- linux-3.6-rc5-orig/fs/buffer.c 2012-09-12 20:44:13.226112590 +0900 +++ linux-3.6-rc5/fs/buffer.c 2012-09-12 20:50:25.406058417 +0900 @@ -511,52 +511,6 @@ repeat: return err; } -static int thaw_super_emergency(struct super_block *sb) -{ - int res; - /* We were called from __iterate_supers with superblock lock taken - * so we do not need to do it here. */ - res = __thaw_super(sb); - if (!res) - deactivate_locked_super(sb); - else - up_write(&sb->s_umount); - return res; -} - -static void do_thaw_one(struct super_block *sb, void *unused) -{ - if (sb->s_bdev) { - char b[BDEVNAME_SIZE]; - printk(KERN_WARNING "Emergency Thaw on %s.\n", - bdevname(sb->s_bdev, b)); - } - while (!thaw_super_emergency(sb)); -} - -static void do_thaw_all(struct work_struct *work) -{ - __iterate_supers(do_thaw_one, NULL, true); - kfree(work); - printk(KERN_WARNING "Emergency Thaw complete\n"); -} - -/** - * emergency_thaw_all -- forcibly thaw every frozen filesystem - * - * Used for emergency unfreeze of all filesystems via SysRq - */ -void emergency_thaw_all(void) -{ - struct work_struct *work; - - work = kmalloc(sizeof(*work), GFP_ATOMIC); - if (work) { - INIT_WORK(work, do_thaw_all); - schedule_work(work); - } -} - /** * sync_mapping_buffers - write out & wait upon a mapping's "associated" buffers * @mapping: the mapping which wants those buffers written diff -urNp linux-3.6-rc5-orig/fs/super.c linux-3.6-rc5/fs/super.c --- linux-3.6-rc5-orig/fs/super.c 2012-09-12 20:24:10.474041390 +0900 +++ linux-3.6-rc5/fs/super.c 2012-09-12 20:50:42.546044906 +0900 @@ -1475,3 +1475,49 @@ int thaw_super(struct super_block *sb) return res; } EXPORT_SYMBOL(thaw_super); + +static int thaw_super_emergency(struct super_block *sb) +{ + int res; + /* We were called from __iterate_supers with superblock lock taken + * so we do not need to do it here. */ + res = __thaw_super(sb); + if (!res) + deactivate_locked_super(sb); + else + up_write(&sb->s_umount); + return res; +} + +static void do_thaw_one(struct super_block *sb, void *unused) +{ + if (sb->s_bdev) { + char b[BDEVNAME_SIZE]; + printk(KERN_WARNING "Emergency Thaw on %s.\n", + bdevname(sb->s_bdev, b)); + } + while (!thaw_super_emergency(sb)); +} + +static void do_thaw_all(struct work_struct *work) +{ + __iterate_supers(do_thaw_one, NULL, true); + kfree(work); + printk(KERN_WARNING "Emergency Thaw complete\n"); +} + +/** + * emergency_thaw_all -- forcibly thaw every frozen filesystem + * + * Used for emergency unfreeze of all filesystems via SysRq + */ +void emergency_thaw_all(void) +{ + struct work_struct *work; + + work = kmalloc(sizeof(*work), GFP_ATOMIC); + if (work) { + INIT_WORK(work, do_thaw_all); + schedule_work(work); + } +} diff -urNp linux-3.6-rc5-orig/include/linux/fs.h linux-3.6-rc5/include/linux/fs.h --- linux-3.6-rc5-orig/include/linux/fs.h 2012-09-12 20:24:10.474041390 +0900 +++ linux-3.6-rc5/include/linux/fs.h 2012-09-12 20:46:22.454047005 +0900 @@ -2082,7 +2082,6 @@ extern int user_statfs(const char __user extern int fd_statfs(int, struct kstatfs *); extern int vfs_ustat(dev_t, struct kstatfs *); extern int freeze_super(struct super_block *super); -extern int __thaw_super(struct super_block *super); extern int thaw_super(struct super_block *super); extern bool our_mnt(struct vfsmount *mnt); @@ -2685,8 +2684,6 @@ extern struct super_block *get_super(str extern struct super_block *get_super_thawed(struct block_device *); extern struct super_block *get_active_super(struct block_device *bdev); extern void drop_super(struct super_block *sb); -extern void __iterate_supers(void (*f)(struct super_block *, void *), void *arg, - bool wlock); extern void iterate_supers(void (*)(struct super_block *, void *), void *); extern void iterate_supers_type(struct file_system_type *, void (*)(struct super_block *, void *), void *); -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html