diff options
author | Yan, Zheng <zheng.yan@oracle.com> | 2010-05-16 10:49:59 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2010-05-25 10:34:54 -0400 |
commit | 3fd0a5585eb98e074fb9934549c8d85c49756c0d (patch) | |
tree | 3e7ff9bd9678a5eea62818a2f4a50e19dda91a81 /fs/btrfs/transaction.c | |
parent | efa56464562991b8c24f965199888806bd8c4b38 (diff) |
Btrfs: Metadata ENOSPC handling for balance
This patch adds metadata ENOSPC handling for the balance code.
It is consisted by following major changes:
1. Avoid COW tree leave in the phrase of merging tree.
2. Handle interaction with snapshot creation.
3. make the backref cache can live across transactions.
Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/transaction.c')
-rw-r--r-- | fs/btrfs/transaction.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index cfe7f588ef05..c346d320173a 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -853,6 +853,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans, | |||
853 | goto fail; | 853 | goto fail; |
854 | } | 854 | } |
855 | 855 | ||
856 | btrfs_reloc_pre_snapshot(trans, pending, &to_reserve); | ||
856 | btrfs_orphan_pre_snapshot(trans, pending, &to_reserve); | 857 | btrfs_orphan_pre_snapshot(trans, pending, &to_reserve); |
857 | 858 | ||
858 | if (to_reserve > 0) { | 859 | if (to_reserve > 0) { |
@@ -924,6 +925,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans, | |||
924 | pending->snap = btrfs_read_fs_root_no_name(root->fs_info, &key); | 925 | pending->snap = btrfs_read_fs_root_no_name(root->fs_info, &key); |
925 | BUG_ON(IS_ERR(pending->snap)); | 926 | BUG_ON(IS_ERR(pending->snap)); |
926 | 927 | ||
928 | btrfs_reloc_post_snapshot(trans, pending); | ||
927 | btrfs_orphan_post_snapshot(trans, pending); | 929 | btrfs_orphan_post_snapshot(trans, pending); |
928 | fail: | 930 | fail: |
929 | kfree(new_root_item); | 931 | kfree(new_root_item); |
@@ -1213,9 +1215,9 @@ int btrfs_clean_old_snapshots(struct btrfs_root *root) | |||
1213 | 1215 | ||
1214 | if (btrfs_header_backref_rev(root->node) < | 1216 | if (btrfs_header_backref_rev(root->node) < |
1215 | BTRFS_MIXED_BACKREF_REV) | 1217 | BTRFS_MIXED_BACKREF_REV) |
1216 | btrfs_drop_snapshot(root, 0); | 1218 | btrfs_drop_snapshot(root, NULL, 0); |
1217 | else | 1219 | else |
1218 | btrfs_drop_snapshot(root, 1); | 1220 | btrfs_drop_snapshot(root, NULL, 1); |
1219 | } | 1221 | } |
1220 | return 0; | 1222 | return 0; |
1221 | } | 1223 | } |