Changes from Dave Chinner's version: - Retain the freeze_bdev/thaw_bdev API so that we can keep the feature that we can freeze a block device that does not have a filesystem mounted yet. --- In some places we are using freeze/thaw_bdev despite the fact the kernel is operating at the sb level there. Convert these users of the bdev interfaces to use the superblock interfaces instead. Cc: Christoph Hellwig <hch@xxxxxxxxxxxxx> Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx> Signed-off-by: Fernando Luis Vazquez Cao <fernando@xxxxxxxxxxxxx> --- diff -urNp linux-3.5-rc5-orig/fs/block_dev.c linux-3.5-rc5/fs/block_dev.c --- linux-3.5-rc5-orig/fs/block_dev.c 2012-07-04 20:28:43.523571557 +0900 +++ linux-3.5-rc5/fs/block_dev.c 2012-07-04 23:36:25.748850800 +0900 @@ -297,14 +297,14 @@ out: EXPORT_SYMBOL(freeze_bdev); /** - * __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 filesystem 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 = -EINVAL; @@ -318,28 +318,15 @@ static int __thaw_bdev(struct block_devi if (!sb) goto out; - if (emergency) - error = thaw_super_emergency(sb); - else - error = thaw_super(sb); + error = 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); -int thaw_bdev_emergency(struct block_device *bdev, struct super_block *sb) -{ - return __thaw_bdev(bdev, sb, 1); -} - static int blkdev_writepage(struct page *page, struct writeback_control *wbc) { return block_write_full_page(page, blkdev_get_block, wbc); diff -urNp linux-3.5-rc5-orig/fs/buffer.c linux-3.5-rc5/fs/buffer.c --- linux-3.5-rc5-orig/fs/buffer.c 2012-07-04 08:25:45.861457009 +0900 +++ linux-3.5-rc5/fs/buffer.c 2012-07-04 23:37:35.665197491 +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 linux-3.5-rc5-orig/fs/xfs/xfs_fsops.c linux-3.5-rc5/fs/xfs/xfs_fsops.c --- linux-3.5-rc5-orig/fs/xfs/xfs_fsops.c 2012-07-04 08:20:45.243966324 +0900 +++ linux-3.5-rc5/fs/xfs/xfs_fsops.c 2012-07-04 23:41:22.602322798 +0900 @@ -664,16 +664,12 @@ xfs_fs_goingdown( __uint32_t inflags) { switch (inflags) { - case XFS_FSOP_GOING_FLAGS_DEFAULT: { - struct super_block *sb = 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 linux-3.5-rc5-orig/include/linux/fs.h linux-3.5-rc5/include/linux/fs.h --- linux-3.5-rc5-orig/include/linux/fs.h 2012-07-04 20:28:43.535571618 +0900 +++ linux-3.5-rc5/include/linux/fs.h 2012-07-04 23:42:35.058682005 +0900 @@ -2100,8 +2100,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) {} @@ -2118,12 +2116,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; -- 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