aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent-tree.c
diff options
context:
space:
mode:
authorYan Zheng <zheng.yan@oracle.com>2008-10-09 11:46:19 -0400
committerChris Mason <chris.mason@oracle.com>2008-10-09 11:46:19 -0400
commit5b84e8d6eef82fcf7b1b16d92e29375b85b6549a (patch)
treed9ab309bc09f8a615aab2c0728272fa773beacf7 /fs/btrfs/extent-tree.c
parent3bb1a1bc42f2ae9582c28adf620484efcd4da38d (diff)
Btrfs: Fix leaf reference cache miss
Due to the optimization for truncate, tree leaves only containing checksum items can be deleted without being COW'ed first. This causes reference cache misses. The way to fix the miss is create cache entries for tree leaves only contain checksum. This patch also fixes a -EEXIST issue in shared reference cache. Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r--fs/btrfs/extent-tree.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index ab36769c356c..280ac1aa9b6d 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -1151,6 +1151,14 @@ int btrfs_cache_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
1151 } 1151 }
1152 1152
1153 ret = btrfs_add_leaf_ref(root, ref, shared); 1153 ret = btrfs_add_leaf_ref(root, ref, shared);
1154 if (ret == -EEXIST && shared) {
1155 struct btrfs_leaf_ref *old;
1156 old = btrfs_lookup_leaf_ref(root, ref->bytenr);
1157 BUG_ON(!old);
1158 btrfs_remove_leaf_ref(root, old);
1159 btrfs_free_leaf_ref(root, old);
1160 ret = btrfs_add_leaf_ref(root, ref, shared);
1161 }
1154 WARN_ON(ret); 1162 WARN_ON(ret);
1155 btrfs_free_leaf_ref(root, ref); 1163 btrfs_free_leaf_ref(root, ref);
1156 } 1164 }