[PATCH 4/8] fsfreeze: switch to using super methods where possible

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

 



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>
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/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);
 
 /**
- * __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;
 
@@ -320,28 +320,15 @@ static int __thaw_bdev(struct block_devi
 		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 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 = 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;


--
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