linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miao Xie <miaox@cn.fujitsu.com>
To: Linux Btrfs <linux-btrfs@vger.kernel.org>
Subject: [PATCH 4/5] Btrfs: fix freeze vs auto defrag
Date: Mon, 26 Nov 2012 17:27:29 +0800	[thread overview]
Message-ID: <50B33601.9050908@cn.fujitsu.com> (raw)
In-Reply-To: <50B32FE7.5080908@cn.fujitsu.com>

If we freeze the fs, the auto defragment should not run. Fix it.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
---
 fs/btrfs/file.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 6ca2b46..40b17d0 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -318,8 +318,11 @@ static int __btrfs_run_defrag_inode(struct btrfs_fs_info *fs_info,
 	memset(&range, 0, sizeof(range));
 	range.len = (u64)-1;
 	range.start = defrag->last_offset;
+
+	sb_start_write(fs_info->sb);
 	num_defrag = btrfs_defrag_file(inode, NULL, &range, defrag->transid,
 				       BTRFS_DEFRAG_BATCH);
+	sb_end_write(fs_info->sb);
 	/*
 	 * if we filled the whole defrag batch, there
 	 * must be more work to do.  Queue this defrag
-- 
1.7.11.7


  parent reply	other threads:[~2012-11-26  9:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-26  9:01 [PATCH 0/5] random fix for autodefrag Miao Xie
2012-11-26  9:24 ` [PATCH 1/5] Btrfs: use slabs for auto defrag allocation Miao Xie
2012-11-26  9:25 ` [PATCH 2/5] Btrfs: fix unprotected defragable inode insertion Miao Xie
2012-11-26  9:26 ` [PATCH 3/5] Btrfs: restructure btrfs_run_defrag_inodes() Miao Xie
2012-11-26  9:27 ` Miao Xie [this message]
2012-11-26  9:28 ` [PATCH 5/5] Btrfs: fix remount vs autodefrag Miao Xie
2012-12-14 17:51   ` Josef Bacik
2012-12-17  7:24     ` Miao Xie
2012-12-18 13:38       ` Josef Bacik
2013-02-21  6:32         ` [PATCH V2] " Miao Xie
2013-01-31  5:54   ` [PATCH 5/5] " Miao Xie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50B33601.9050908@cn.fujitsu.com \
    --to=miaox@cn.fujitsu.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).