From: Jan Kara Subject: Re: [PATCH 4/8] fsfreeze: switch to using super methods where possible Date: Fri, 13 Jul 2012 15:50:05 +0200 Message-ID: <20120713135005.GG20361@quack.suse.cz> References: <1342083464.7033.6.camel@nexus.lab.ntt.co.jp> <1342084052.7033.14.camel@nexus.lab.ntt.co.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Al Viro , Jan Kara , Dave Chinner , Christoph Hellwig , linux-fsdevel@vger.kernel.org To: Fernando Luis =?iso-8859-1?Q?V=E1zquez?= Cao Return-path: Received: from cantor2.suse.de ([195.135.220.15]:51206 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756673Ab2GMNuH (ORCPT ); Fri, 13 Jul 2012 09:50:07 -0400 Content-Disposition: inline In-Reply-To: <1342084052.7033.14.camel@nexus.lab.ntt.co.jp> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Thu 12-07-12 18:07:32, Fernando Luis V=E1zquez Cao wrote: > Changes from Dave Chinner's version: > - Retain the freeze_bdev/thaw_bdev API so that we can keep the featur= e that > we can freeze a block device that does not have a filesystem mounte= d yet. >=20 > --- >=20 > In some places we are using freeze/thaw_bdev despite the fact the ker= nel > is operating at the sb level there. Convert these users of the bdev > interfaces to use the superblock interfaces instead. This looks good. So you can add: Reviewed-by: Jan Kara Honza >=20 > Cc: Christoph Hellwig > Cc: Jan Kara > Signed-off-by: Dave Chinner > Signed-off-by: Fernando Luis Vazquez Cao > --- >=20 > diff -urNp vfs-orig/fs/block_dev.c vfs/fs/block_dev.c > --- vfs-orig/fs/block_dev.c 2012-07-12 17:03:18.516624899 +0900 > +++ vfs/fs/block_dev.c 2012-07-12 17:04:35.244784436 +0900 > @@ -297,14 +297,14 @@ out: > EXPORT_SYMBOL(freeze_bdev); > =20 > /** > - * __thaw_bdev -- unlock a block device > + * thaw_bdev -- unlock a block device > * @bdev: blockdevice to unlock > * @sb: associated superblock > * @emergency: emergency thaw > * > * Unlocks the block device and, if present, the associated filesyst= em too. > */ > -static int __thaw_bdev(struct block_device *bdev, struct super_block= *sb, int emergency) > +int thaw_bdev(struct block_device *bdev, struct super_block *sb) > { > int error =3D -EINVAL; > =20 > @@ -320,28 +320,15 @@ static int __thaw_bdev(struct block_devi > goto out; > } > =20 > - if (emergency) > - error =3D thaw_super_emergency(sb); > - else > - error =3D thaw_super(sb); > + error =3D thaw_super(sb); > if (error) > bdev->bd_fsfreeze_count++; > out: > mutex_unlock(&bdev->bd_fsfreeze_mutex); > return error; > } > - > -int thaw_bdev(struct block_device *bdev, struct super_block *sb) > -{ > - return __thaw_bdev(bdev, sb, 0); > -} > EXPORT_SYMBOL(thaw_bdev); > =20 > -int thaw_bdev_emergency(struct block_device *bdev, struct super_bloc= k *sb) > -{ > - return __thaw_bdev(bdev, sb, 1); > -} > - > static int blkdev_writepage(struct page *page, struct writeback_cont= rol *wbc) > { > return block_write_full_page(page, blkdev_get_block, wbc); > diff -urNp vfs-orig/fs/buffer.c vfs/fs/buffer.c > --- vfs-orig/fs/buffer.c 2012-07-12 14:31:38.944630298 +0900 > +++ vfs/fs/buffer.c 2012-07-12 17:04:35.244784436 +0900 > @@ -514,7 +514,7 @@ repeat: > static void do_thaw_one(struct super_block *sb, void *unused) > { > char b[BDEVNAME_SIZE]; > - while (sb->s_bdev && !thaw_bdev_emergency(sb->s_bdev, sb)) > + while (sb->s_bdev && !thaw_super_emergency(sb)) > printk(KERN_WARNING "Emergency Thaw on %s\n", > bdevname(sb->s_bdev, b)); > } > diff -urNp vfs-orig/fs/xfs/xfs_fsops.c vfs/fs/xfs/xfs_fsops.c > --- vfs-orig/fs/xfs/xfs_fsops.c 2012-07-04 18:57:54.000000000 +0900 > +++ vfs/fs/xfs/xfs_fsops.c 2012-07-12 17:04:35.252780168 +0900 > @@ -664,16 +664,12 @@ xfs_fs_goingdown( > __uint32_t inflags) > { > switch (inflags) { > - case XFS_FSOP_GOING_FLAGS_DEFAULT: { > - struct super_block *sb =3D freeze_bdev(mp->m_super->s_bdev); > - > - if (sb && !IS_ERR(sb)) { > + case XFS_FSOP_GOING_FLAGS_DEFAULT: > + if (!freeze_super(mp->m_super)) { > xfs_force_shutdown(mp, SHUTDOWN_FORCE_UMOUNT); > - thaw_bdev(sb->s_bdev, sb); > + thaw_super(mp->m_super); > } > - > break; > - } > case XFS_FSOP_GOING_FLAGS_LOGFLUSH: > xfs_force_shutdown(mp, SHUTDOWN_FORCE_UMOUNT); > break; > diff -urNp vfs-orig/include/linux/fs.h vfs/include/linux/fs.h > --- vfs-orig/include/linux/fs.h 2012-07-12 17:03:18.596626998 +0900 > +++ vfs/include/linux/fs.h 2012-07-12 17:04:35.252780168 +0900 > @@ -2111,8 +2111,6 @@ extern void kill_bdev(struct block_devic > extern struct super_block *freeze_bdev(struct block_device *); > extern void emergency_thaw_all(void); > extern int thaw_bdev(struct block_device *bdev, struct super_block *= sb); > -extern int thaw_bdev_emergency(struct block_device *bdev, > - struct super_block *sb); > extern int fsync_bdev(struct block_device *); > #else > static inline void bd_forget(struct inode *inode) {} > @@ -2129,12 +2127,6 @@ static inline int thaw_bdev(struct block > { > return 0; > } > - > -static inline int thaw_bdev_emergency(struct block_device *bdev, > - struct super_block *sb) > -{ > - return 0; > -} > #endif > extern int sync_filesystem(struct super_block *); > extern const struct file_operations def_blk_fops; >=20 >=20 --=20 Jan Kara SUSE Labs, CR -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel= " in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html