Skip to contentSkip to conversation

Btrfs: add MS_RDONLY to avoid backgroud writeback

RFC PATCH In review Miao Xie 1 participant 1 message Nov 25, 2010 Btrfs file system

lore
Share & tools
lore

Miao Xie

author
#0 lore raw

RFC PATCH 2/4 Btrfs: add MS_RDONLY to avoid backgroud writeback

From: Liu Bo <[email protected]>

When the filesystem is readonly, commit transaction is forbiddened.

---
 fs/btrfs/transaction.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
fs/btrfs/transaction.c +7 -0
index 1fffbc0..45c76b9 100644
@@ -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
Signature · 1 line
1.7.0.1