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.0-rc7-orig/fs/buffer.c linux-3.6.0-rc7/fs/buffer.c --- linux-3.6.0-rc7-orig/fs/buffer.c 2012-09-26 16:18:39.010705981 +0900 +++ linux-3.6.0-rc7/fs/buffer.c 2012-09-26 16:30:27.050760551 +0900 @@ -511,50 +511,6 @@ repeat: return err; } -static void do_thaw_one(struct super_block *sb, void *unused) -{ - int res; - - if (sb->s_bdev) { - char b[BDEVNAME_SIZE]; - printk(KERN_WARNING "Emergency Thaw on %s.\n", - bdevname(sb->s_bdev, b)); - } - - /* We got here from __iterate_supers with the superblock lock taken - * so we can call the lockless version of thaw_super() safely. */ - res = __thaw_super(sb); - /* If we are going to drop the final active reference call - * deactivate_locked_super to clean things up. In the general case - * we avoid calling deactivate_locked_super() because it would relase - * the superblock lock, which is __iterate_supers()'s job. */ - if (!res && !atomic_add_unless(&sb->s_active, -1, 1)) - deactivate_locked_super(sb); -} - -static void do_thaw_all(struct work_struct *work) -{ - iterate_supers_write(do_thaw_one, NULL); - 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.0-rc7-orig/fs/super.c linux-3.6.0-rc7/fs/super.c --- linux-3.6.0-rc7-orig/fs/super.c 2012-09-26 13:25:58.422382440 +0900 +++ linux-3.6.0-rc7/fs/super.c 2012-09-26 16:32:00.650761566 +0900 @@ -603,7 +603,7 @@ void iterate_supers_read(void (*f)(struc * a superblock locked in _write_ mode and given argument. The lock * is automatically relased after the function returns. */ -void iterate_supers_write(void (*f)(struct super_block *, void *), void *arg) +static void iterate_supers_write(void (*f)(struct super_block *, void *), void *arg) { __iterate_supers(f, arg , true); } @@ -1437,7 +1437,7 @@ EXPORT_SYMBOL(freeze_super); * to protect the superblock by grabbing the s_umount semaphore in write mode * and release it again on return. See thaw_super() for an example. */ -int __thaw_super(struct super_block *sb) +static int __thaw_super(struct super_block *sb) { int error = 0; @@ -1484,3 +1484,47 @@ int thaw_super(struct super_block *sb) return res; } EXPORT_SYMBOL(thaw_super); + +static void do_thaw_one(struct super_block *sb, void *unused) +{ + int res; + + if (sb->s_bdev) { + char b[BDEVNAME_SIZE]; + printk(KERN_WARNING "Emergency Thaw on %s.\n", + bdevname(sb->s_bdev, b)); + } + + /* We got here from __iterate_supers with the superblock lock taken + * so we can call the lockless version of thaw_super() safely. */ + res = __thaw_super(sb); + /* If we are going to drop the final active reference call + * deactivate_locked_super to clean things up. In the general case + * we avoid calling deactivate_locked_super() because it would relase + * the superblock lock, which is __iterate_supers()'s job. */ + if (!res && !atomic_add_unless(&sb->s_active, -1, 1)) + deactivate_locked_super(sb); +} + +static void do_thaw_all(struct work_struct *work) +{ + iterate_supers_write(do_thaw_one, NULL); + 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.0-rc7-orig/include/linux/fs.h linux-3.6.0-rc7/include/linux/fs.h --- linux-3.6.0-rc7-orig/include/linux/fs.h 2012-09-26 13:25:58.430382441 +0900 +++ linux-3.6.0-rc7/include/linux/fs.h 2012-09-26 16:33:34.934762455 +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); @@ -2686,7 +2685,6 @@ extern struct super_block *get_super_tha extern struct super_block *get_active_super(struct block_device *bdev); extern void drop_super(struct super_block *sb); extern void iterate_supers_read(void (*)(struct super_block *, void *), void *); -extern void iterate_supers_write(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