diff options
author | Miao Xie <miaox@cn.fujitsu.com> | 2013-05-14 10:20:42 +0000 |
---|---|---|
committer | Josef Bacik <jbacik@fusionio.com> | 2013-06-14 11:29:34 -0400 |
commit | dc7f370c05dd024697d4d6c68f91fd04fe8fad1e (patch) | |
tree | 317b8c9e56af3b1e91bceee326883a63b47ddc6b /fs/btrfs/disk-io.c | |
parent | 05323cd13503937e71d5c6ef2debf69e51a9634f (diff) | |
download | talos-op-linux-dc7f370c05dd024697d4d6c68f91fd04fe8fad1e.tar.gz talos-op-linux-dc7f370c05dd024697d4d6c68f91fd04fe8fad1e.zip |
Btrfs: move the R/O check out of btrfs_clean_one_deleted_snapshot()
If the fs is remounted to be R/O, it is unnecessary to call
btrfs_clean_one_deleted_snapshot(), so move the R/O check out of
this function. And besides that, it can make the check logic in the
caller more clear.
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.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 06f2c011db03..5b9b4eb36e5d 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -1699,6 +1699,15 @@ static int cleaner_kthread(void *arg) if (!mutex_trylock(&root->fs_info->cleaner_mutex)) goto sleep; + /* + * Avoid the problem that we change the status of the fs + * during the above check and trylock. + */ + if (need_cleaner_sleep(root)) { + mutex_unlock(&root->fs_info->cleaner_mutex); + goto sleep; + } + btrfs_run_delayed_iputs(root); again = btrfs_clean_one_deleted_snapshot(root); mutex_unlock(&root->fs_info->cleaner_mutex); |