Re: [PATCH 5/8] fsfreeze: move emergency thaw code to fs/super.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu 12-07-12 18:09:00, Fernando Luis Vázquez Cao wrote:
> 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.
  Looks sensinble. You can add:
Reviewed-by: Jan Kara <jack@xxxxxxx>

								Honza
> 
> Cc: Christoph Hellwig <hch@xxxxxxxxxxxxx>
> Cc: Jan Kara <jack@xxxxxxx>
> Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx>
> Signed-off-by: Fernando Luis Vazquez Cao <fernando@xxxxxxxxxxxxx>
> ---
> 
> diff -urNp vfs-orig/fs/buffer.c vfs/fs/buffer.c
> --- vfs-orig/fs/buffer.c	2012-07-12 17:11:42.480606884 +0900
> +++ vfs/fs/buffer.c	2012-07-12 17:14:25.652627936 +0900
> @@ -511,37 +511,6 @@ repeat:
>  	return err;
>  }
>  
> -static void do_thaw_one(struct super_block *sb, void *unused)
> -{
> -	char b[BDEVNAME_SIZE];
> -	while (sb->s_bdev && !thaw_super_emergency(sb))
> -		printk(KERN_WARNING "Emergency Thaw on %s\n",
> -		       bdevname(sb->s_bdev, b));
> -}
> -
> -static void do_thaw_all(struct work_struct *work)
> -{
> -	iterate_supers(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 vfs-orig/fs/super.c vfs/fs/super.c
> --- vfs-orig/fs/super.c	2012-07-12 17:03:18.568626969 +0900
> +++ vfs/fs/super.c	2012-07-12 17:21:40.768626516 +0900
> @@ -1304,7 +1304,35 @@ EXPORT_SYMBOL(thaw_super);
>   * The kernel gets here holding the sb->s_umount lock in read mode so we cannot
>   * grab it again in write mode.
>   */
> -int thaw_super_emergency(struct super_block *sb)
> +static void thaw_super_emergency(struct super_block *sb, void *unused)
>  {
> -	return __thaw_super(sb, 1);
> +	if (sb->s_bdev) {
> +		char b[BDEVNAME_SIZE];
> +		printk(KERN_WARNING "Emergency Thaw on %s.\n",
> +				    bdevname(sb->s_bdev, b));
> +	}
> +	while (!__thaw_super(sb, 1));
> +}
> +
> +static void do_thaw_all(struct work_struct *work)
> +{
> +	iterate_supers(thaw_super_emergency, 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 vfs-orig/include/linux/fs.h vfs/include/linux/fs.h
> --- vfs-orig/include/linux/fs.h	2012-07-12 17:11:42.496609385 +0900
> +++ vfs/include/linux/fs.h	2012-07-12 17:22:14.640642715 +0900
> @@ -1947,7 +1947,6 @@ 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_emergency(struct super_block *super);
>  extern bool our_mnt(struct vfsmount *mnt);
>  
>  extern int current_umask(void);
> 
> 
-- 
Jan Kara <jack@xxxxxxx>
SUSE Labs, CR
--
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


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux