aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
authorMiao Xie <miaox@cn.fujitsu.com>2013-05-14 06:20:43 -0400
committerJosef Bacik <jbacik@fusionio.com>2013-06-14 11:29:36 -0400
commitbabbf170c781f24095336c82ebf18ad272ddb773 (patch)
treecc18313731030bc2f314d103aaf81aa599b1cb17 /fs/btrfs/disk-io.c
parentdc7f370c05dd024697d4d6c68f91fd04fe8fad1e (diff)
Btrfs: make the snap/subv deletion end more early when the fs is R/O
The snapshot/subvolume deletion might spend lots of time, it would make the remount task wait for a long time. This patch improve this problem, we will break the deletion if the fs is remounted to be R/O. It will make the users happy. Cc: David Sterba <dsterba@suse.cz> Signed-off-by: Miao Xie <miaox@cn.fujitsu.com> Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 5b9b4eb36e5d..8dbd908a3a97 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -1673,17 +1673,6 @@ static void end_workqueue_fn(struct btrfs_work *work)
1673 bio_endio(bio, error); 1673 bio_endio(bio, error);
1674} 1674}
1675 1675
1676/*
1677 * If we remount the fs to be R/O or umount the fs, the cleaner needn't do
1678 * anything except sleeping. This function is used to check the status of
1679 * the fs.
1680 */
1681static inline int need_cleaner_sleep(struct btrfs_root *root)
1682{
1683 return (root->fs_info->sb->s_flags & MS_RDONLY ||
1684 btrfs_fs_closing(root->fs_info));
1685}
1686
1687static int cleaner_kthread(void *arg) 1676static int cleaner_kthread(void *arg)
1688{ 1677{
1689 struct btrfs_root *root = arg; 1678 struct btrfs_root *root = arg;
@@ -1693,7 +1682,7 @@ static int cleaner_kthread(void *arg)
1693 again = 0; 1682 again = 0;
1694 1683
1695 /* Make the cleaner go to sleep early. */ 1684 /* Make the cleaner go to sleep early. */
1696 if (need_cleaner_sleep(root)) 1685 if (btrfs_need_cleaner_sleep(root))
1697 goto sleep; 1686 goto sleep;
1698 1687
1699 if (!mutex_trylock(&root->fs_info->cleaner_mutex)) 1688 if (!mutex_trylock(&root->fs_info->cleaner_mutex))
@@ -1703,7 +1692,7 @@ static int cleaner_kthread(void *arg)
1703 * Avoid the problem that we change the status of the fs 1692 * Avoid the problem that we change the status of the fs
1704 * during the above check and trylock. 1693 * during the above check and trylock.
1705 */ 1694 */
1706 if (need_cleaner_sleep(root)) { 1695 if (btrfs_need_cleaner_sleep(root)) {
1707 mutex_unlock(&root->fs_info->cleaner_mutex); 1696 mutex_unlock(&root->fs_info->cleaner_mutex);
1708 goto sleep; 1697 goto sleep;
1709 } 1698 }