aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.c
diff options
context:
space:
mode:
authorYan Zheng <zheng.yan@oracle.com>2008-10-09 11:46:24 -0400
committerChris Mason <chris.mason@oracle.com>2008-10-09 11:46:24 -0400
commit3bb1a1bc42f2ae9582c28adf620484efcd4da38d (patch)
tree4e65ee859e73ea9558e33a02ba10e1d9d54756f3 /fs/btrfs/ctree.c
parenta76a3cd40c1127ca199d4f7f37bf0d541bf44eb2 (diff)
Btrfs: Remove offset field from struct btrfs_extent_ref
The offset field in struct btrfs_extent_ref records the position inside file that file extent is referenced by. In the new back reference system, tree leaves holding references to file extent are recorded explicitly. We can scan these tree leaves very quickly, so the offset field is not required. This patch also makes the back reference system check the objectid when extents are in deleting. Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
Diffstat (limited to 'fs/btrfs/ctree.c')
-rw-r--r--fs/btrfs/ctree.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 2eab4643dcbc..9caeb377de63 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -254,8 +254,7 @@ int noinline __btrfs_cow_block(struct btrfs_trans_handle *trans,
254 254
255 ret = btrfs_alloc_reserved_extent(trans, root, parent_start, 255 ret = btrfs_alloc_reserved_extent(trans, root, parent_start,
256 root->root_key.objectid, 256 root->root_key.objectid,
257 trans->transid, level, 0, 257 trans->transid, level, &ins);
258 &ins);
259 BUG_ON(ret); 258 BUG_ON(ret);
260 cow = btrfs_init_new_buffer(trans, root, prealloc_dest, 259 cow = btrfs_init_new_buffer(trans, root, prealloc_dest,
261 buf->len); 260 buf->len);
@@ -333,7 +332,7 @@ int noinline __btrfs_cow_block(struct btrfs_trans_handle *trans,
333 buf->len, buf->start, 332 buf->len, buf->start,
334 root->root_key.objectid, 333 root->root_key.objectid,
335 btrfs_header_generation(buf), 334 btrfs_header_generation(buf),
336 0, 0, 1); 335 level, 1);
337 } 336 }
338 free_extent_buffer(buf); 337 free_extent_buffer(buf);
339 add_root_to_dirty_list(root); 338 add_root_to_dirty_list(root);
@@ -347,7 +346,7 @@ int noinline __btrfs_cow_block(struct btrfs_trans_handle *trans,
347 WARN_ON(btrfs_header_generation(parent) != trans->transid); 346 WARN_ON(btrfs_header_generation(parent) != trans->transid);
348 btrfs_free_extent(trans, root, buf->start, buf->len, 347 btrfs_free_extent(trans, root, buf->start, buf->len,
349 parent_start, btrfs_header_owner(parent), 348 parent_start, btrfs_header_owner(parent),
350 btrfs_header_generation(parent), 0, 0, 1); 349 btrfs_header_generation(parent), level, 1);
351 } 350 }
352 if (unlock_orig) 351 if (unlock_orig)
353 btrfs_tree_unlock(buf); 352 btrfs_tree_unlock(buf);
@@ -927,7 +926,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
927 ret = btrfs_update_extent_ref(trans, root, child->start, 926 ret = btrfs_update_extent_ref(trans, root, child->start,
928 mid->start, child->start, 927 mid->start, child->start,
929 root->root_key.objectid, 928 root->root_key.objectid,
930 trans->transid, level - 1, 0); 929 trans->transid, level - 1);
931 BUG_ON(ret); 930 BUG_ON(ret);
932 931
933 add_root_to_dirty_list(root); 932 add_root_to_dirty_list(root);
@@ -940,7 +939,8 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
940 free_extent_buffer(mid); 939 free_extent_buffer(mid);
941 ret = btrfs_free_extent(trans, root, mid->start, mid->len, 940 ret = btrfs_free_extent(trans, root, mid->start, mid->len,
942 mid->start, root->root_key.objectid, 941 mid->start, root->root_key.objectid,
943 btrfs_header_generation(mid), 0, 0, 1); 942 btrfs_header_generation(mid),
943 level, 1);
944 /* once for the root ptr */ 944 /* once for the root ptr */
945 free_extent_buffer(mid); 945 free_extent_buffer(mid);
946 return ret; 946 return ret;
@@ -1006,7 +1006,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
1006 wret = btrfs_free_extent(trans, root, bytenr, 1006 wret = btrfs_free_extent(trans, root, bytenr,
1007 blocksize, parent->start, 1007 blocksize, parent->start,
1008 btrfs_header_owner(parent), 1008 btrfs_header_owner(parent),
1009 generation, 0, 0, 1); 1009 generation, level, 1);
1010 if (wret) 1010 if (wret)
1011 ret = wret; 1011 ret = wret;
1012 } else { 1012 } else {
@@ -1055,7 +1055,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
1055 wret = btrfs_free_extent(trans, root, bytenr, blocksize, 1055 wret = btrfs_free_extent(trans, root, bytenr, blocksize,
1056 parent->start, 1056 parent->start,
1057 btrfs_header_owner(parent), 1057 btrfs_header_owner(parent),
1058 root_gen, 0, 0, 1); 1058 root_gen, level, 1);
1059 if (wret) 1059 if (wret)
1060 ret = wret; 1060 ret = wret;
1061 } else { 1061 } else {
@@ -1691,13 +1691,13 @@ next_level:
1691 blocksize, parent->start, 1691 blocksize, parent->start,
1692 btrfs_header_owner(parent), 1692 btrfs_header_owner(parent),
1693 btrfs_header_generation(parent), 1693 btrfs_header_generation(parent),
1694 level - 1, 0); 1694 level - 1);
1695 BUG_ON(ret); 1695 BUG_ON(ret);
1696 ret = btrfs_free_extent(trans, root, bytenr, 1696 ret = btrfs_free_extent(trans, root, bytenr,
1697 blocksize, parent->start, 1697 blocksize, parent->start,
1698 btrfs_header_owner(parent), 1698 btrfs_header_owner(parent),
1699 btrfs_header_generation(parent), 1699 btrfs_header_generation(parent),
1700 level - 1, 0, 1); 1700 level - 1, 1);
1701 BUG_ON(ret); 1701 BUG_ON(ret);
1702 1702
1703 if (generation == trans->transid) { 1703 if (generation == trans->transid) {
@@ -1973,7 +1973,7 @@ static int noinline insert_new_root(struct btrfs_trans_handle *trans,
1973 ret = btrfs_update_extent_ref(trans, root, lower->start, 1973 ret = btrfs_update_extent_ref(trans, root, lower->start,
1974 lower->start, c->start, 1974 lower->start, c->start,
1975 root->root_key.objectid, 1975 root->root_key.objectid,
1976 trans->transid, level - 1, 0); 1976 trans->transid, level - 1);
1977 BUG_ON(ret); 1977 BUG_ON(ret);
1978 1978
1979 /* the super has an extra ref to root->node */ 1979 /* the super has an extra ref to root->node */
@@ -3213,7 +3213,7 @@ noinline int btrfs_del_leaf(struct btrfs_trans_handle *trans,
3213 btrfs_level_size(root, 0), 3213 btrfs_level_size(root, 0),
3214 path->nodes[1]->start, 3214 path->nodes[1]->start,
3215 btrfs_header_owner(path->nodes[1]), 3215 btrfs_header_owner(path->nodes[1]),
3216 root_gen, 0, 0, 1); 3216 root_gen, 0, 1);
3217 return ret; 3217 return ret;
3218} 3218}
3219/* 3219/*