summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/file.c
diff options
context:
space:
mode:
authorMiao Xie2013-02-21 07:32:52 +0100
committerChris Mason2013-02-21 14:11:43 +0100
commitdc81cdc58ad2f413b96b9004f8d681e5dc554473 (patch)
tree71f87fc0e172167755f1f572af3b77cb7aff46a7 /fs/btrfs/file.c
parentBtrfs: fix wrong outstanding_extents when doing DIO write (diff)
downloadkernel-qcow2-linux-dc81cdc58ad2f413b96b9004f8d681e5dc554473.tar.gz
kernel-qcow2-linux-dc81cdc58ad2f413b96b9004f8d681e5dc554473.tar.xz
kernel-qcow2-linux-dc81cdc58ad2f413b96b9004f8d681e5dc554473.zip
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;