diff mbox

[RFC,2/4] Btrfs: add MS_RDONLY to avoid backgroud writeback

Message ID 4CEE3258.2090302@cn.fujitsu.com (mailing list archive)
State New, archived
Headers show

Commit Message

Miao Xie Nov. 25, 2010, 9:54 a.m. UTC
None
diff mbox

Patch

diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 1fffbc0..45c76b9 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -1188,6 +1188,13 @@  int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
 	unsigned long now = get_seconds();
 	int flush_on_commit = btrfs_test_opt(root, FLUSHONCOMMIT);
 
+	/*
+	 * Since some error may force btrfs readonly, this can
+	 * avoid backgroud writeback.
+	 */
+	if (root->fs_info->sb->s_flags & MS_RDONLY)
+		return 0;
+
 	btrfs_run_ordered_operations(root, 0);
 
 	/* make a pass through all the delayed refs we have so far