summaryrefslogtreecommitdiff
path: root/fs/btrfs/file.c
diff options
context:
space:
mode:
authorMiao Xie <miaox@cn.fujitsu.com>2013-02-21 10:32:52 +0400
committerChris Mason <chris.mason@fusionio.com>2013-02-21 17:11:43 +0400
commitdc81cdc58ad2f413b96b9004f8d681e5dc554473 (patch)
tree71f87fc0e172167755f1f572af3b77cb7aff46a7 /fs/btrfs/file.c
parent172a50497ffaf84d60dff37fbeb03894268fe5c2 (diff)
downloadlinux-dc81cdc58ad2f413b96b9004f8d681e5dc554473.tar.xz
Btrfs: fix remount vs autodefrag
If we remount the fs to close the auto defragment or make the fs R/O, we should stop the auto defragment. Signed-off-by: Miao Xie <miaox@cn.fujitsu.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs/btrfs/file.c')
-rw-r--r--fs/btrfs/file.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 9f67e623206d..6e6dd8cdad92 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -374,6 +374,11 @@ int btrfs_run_defrag_inodes(struct btrfs_fs_info *fs_info)
atomic_inc(&fs_info->defrag_running);
while(1) {
+ /* Pause the auto defragger. */
+ if (test_bit(BTRFS_FS_STATE_REMOUNTING,
+ &fs_info->fs_state))
+ break;
+
if (!__need_auto_defrag(fs_info->tree_root))
break;