summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.h
diff options
context:
space:
mode:
authorMiao Xie2013-05-14 12:20:43 +0200
committerJosef Bacik2013-06-14 17:29:36 +0200
commitbabbf170c781f24095336c82ebf18ad272ddb773 (patch)
treecc18313731030bc2f314d103aaf81aa599b1cb17 /fs/btrfs/ctree.h
parentBtrfs: move the R/O check out of btrfs_clean_one_deleted_snapshot() (diff)
downloadkernel-qcow2-linux-babbf170c781f24095336c82ebf18ad272ddb773.tar.gz
kernel-qcow2-linux-babbf170c781f24095336c82ebf18ad272ddb773.tar.xz
kernel-qcow2-linux-babbf170c781f24095336c82ebf18ad272ddb773.zip
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/ctree.h')
-rw-r--r--fs/btrfs/ctree.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index d354de31b81b..d9ff585aadba 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -3318,6 +3318,18 @@ static inline int btrfs_fs_closing(struct btrfs_fs_info *fs_info)
smp_mb();
return fs_info->closing;
}
+
+/*
+ * If we remount the fs to be R/O or umount the fs, the cleaner needn't do
+ * anything except sleeping. This function is used to check the status of
+ * the fs.
+ */
+static inline int btrfs_need_cleaner_sleep(struct btrfs_root *root)
+{
+ return (root->fs_info->sb->s_flags & MS_RDONLY ||
+ btrfs_fs_closing(root->fs_info));
+}
+
static inline void free_fs_info(struct btrfs_fs_info *fs_info)
{
kfree(fs_info->balance_ctl);