diff options
Diffstat (limited to 'fs/btrfs/ctree.c')
-rw-r--r-- | fs/btrfs/ctree.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index f31ac843bf2e..e2fc6f0d0243 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c | |||
@@ -66,21 +66,21 @@ static int btrfs_cow_block(struct btrfs_trans_handle *trans, struct btrfs_root | |||
66 | if (buf->b_size != root->blocksize || cow->b_size != root->blocksize) | 66 | if (buf->b_size != root->blocksize || cow->b_size != root->blocksize) |
67 | WARN_ON(1); | 67 | WARN_ON(1); |
68 | memcpy(cow_node, btrfs_buffer_node(buf), root->blocksize); | 68 | memcpy(cow_node, btrfs_buffer_node(buf), root->blocksize); |
69 | btrfs_set_header_blocknr(&cow_node->header, cow->b_blocknr); | 69 | btrfs_set_header_blocknr(&cow_node->header, bh_blocknr(cow)); |
70 | btrfs_set_header_generation(&cow_node->header, trans->transid); | 70 | btrfs_set_header_generation(&cow_node->header, trans->transid); |
71 | btrfs_inc_ref(trans, root, buf); | 71 | btrfs_inc_ref(trans, root, buf); |
72 | if (buf == root->node) { | 72 | if (buf == root->node) { |
73 | root->node = cow; | 73 | root->node = cow; |
74 | get_bh(cow); | 74 | get_bh(cow); |
75 | if (buf != root->commit_root) { | 75 | if (buf != root->commit_root) { |
76 | btrfs_free_extent(trans, root, buf->b_blocknr, 1, 1); | 76 | btrfs_free_extent(trans, root, bh_blocknr(buf), 1, 1); |
77 | } | 77 | } |
78 | btrfs_block_release(root, buf); | 78 | btrfs_block_release(root, buf); |
79 | } else { | 79 | } else { |
80 | btrfs_set_node_blockptr(btrfs_buffer_node(parent), parent_slot, | 80 | btrfs_set_node_blockptr(btrfs_buffer_node(parent), parent_slot, |
81 | cow->b_blocknr); | 81 | bh_blocknr(cow)); |
82 | btrfs_mark_buffer_dirty(parent); | 82 | btrfs_mark_buffer_dirty(parent); |
83 | btrfs_free_extent(trans, root, buf->b_blocknr, 1, 1); | 83 | btrfs_free_extent(trans, root, bh_blocknr(buf), 1, 1); |
84 | } | 84 | } |
85 | btrfs_block_release(root, buf); | 85 | btrfs_block_release(root, buf); |
86 | mark_buffer_dirty(cow); | 86 | mark_buffer_dirty(cow); |
@@ -312,7 +312,7 @@ static int balance_level(struct btrfs_trans_handle *trans, struct btrfs_root | |||
312 | */ | 312 | */ |
313 | if (!parent_buf) { | 313 | if (!parent_buf) { |
314 | struct buffer_head *child; | 314 | struct buffer_head *child; |
315 | u64 blocknr = mid_buf->b_blocknr; | 315 | u64 blocknr = bh_blocknr(mid_buf); |
316 | 316 | ||
317 | if (btrfs_header_nritems(&mid->header) != 1) | 317 | if (btrfs_header_nritems(&mid->header) != 1) |
318 | return 0; | 318 | return 0; |
@@ -361,7 +361,7 @@ static int balance_level(struct btrfs_trans_handle *trans, struct btrfs_root | |||
361 | if (wret < 0) | 361 | if (wret < 0) |
362 | ret = wret; | 362 | ret = wret; |
363 | if (btrfs_header_nritems(&right->header) == 0) { | 363 | if (btrfs_header_nritems(&right->header) == 0) { |
364 | u64 blocknr = right_buf->b_blocknr; | 364 | u64 blocknr = bh_blocknr(right_buf); |
365 | clean_tree_block(trans, root, right_buf); | 365 | clean_tree_block(trans, root, right_buf); |
366 | wait_on_buffer(right_buf); | 366 | wait_on_buffer(right_buf); |
367 | btrfs_block_release(root, right_buf); | 367 | btrfs_block_release(root, right_buf); |
@@ -400,7 +400,7 @@ static int balance_level(struct btrfs_trans_handle *trans, struct btrfs_root | |||
400 | } | 400 | } |
401 | if (btrfs_header_nritems(&mid->header) == 0) { | 401 | if (btrfs_header_nritems(&mid->header) == 0) { |
402 | /* we've managed to empty the middle node, drop it */ | 402 | /* we've managed to empty the middle node, drop it */ |
403 | u64 blocknr = mid_buf->b_blocknr; | 403 | u64 blocknr = bh_blocknr(mid_buf); |
404 | clean_tree_block(trans, root, mid_buf); | 404 | clean_tree_block(trans, root, mid_buf); |
405 | wait_on_buffer(mid_buf); | 405 | wait_on_buffer(mid_buf); |
406 | btrfs_block_release(root, mid_buf); | 406 | btrfs_block_release(root, mid_buf); |
@@ -686,7 +686,7 @@ static int insert_new_root(struct btrfs_trans_handle *trans, struct btrfs_root | |||
686 | memset(c, 0, root->blocksize); | 686 | memset(c, 0, root->blocksize); |
687 | btrfs_set_header_nritems(&c->header, 1); | 687 | btrfs_set_header_nritems(&c->header, 1); |
688 | btrfs_set_header_level(&c->header, level); | 688 | btrfs_set_header_level(&c->header, level); |
689 | btrfs_set_header_blocknr(&c->header, t->b_blocknr); | 689 | btrfs_set_header_blocknr(&c->header, bh_blocknr(t)); |
690 | btrfs_set_header_generation(&c->header, trans->transid); | 690 | btrfs_set_header_generation(&c->header, trans->transid); |
691 | lower = btrfs_buffer_node(path->nodes[level-1]); | 691 | lower = btrfs_buffer_node(path->nodes[level-1]); |
692 | memcpy(c->header.fsid, root->fs_info->disk_super->fsid, | 692 | memcpy(c->header.fsid, root->fs_info->disk_super->fsid, |
@@ -697,7 +697,7 @@ static int insert_new_root(struct btrfs_trans_handle *trans, struct btrfs_root | |||
697 | lower_key = &lower->ptrs[0].key; | 697 | lower_key = &lower->ptrs[0].key; |
698 | btrfs_memcpy(root, c, &c->ptrs[0].key, lower_key, | 698 | btrfs_memcpy(root, c, &c->ptrs[0].key, lower_key, |
699 | sizeof(struct btrfs_disk_key)); | 699 | sizeof(struct btrfs_disk_key)); |
700 | btrfs_set_node_blockptr(c, 0, path->nodes[level - 1]->b_blocknr); | 700 | btrfs_set_node_blockptr(c, 0, bh_blocknr(path->nodes[level - 1])); |
701 | 701 | ||
702 | btrfs_mark_buffer_dirty(t); | 702 | btrfs_mark_buffer_dirty(t); |
703 | 703 | ||
@@ -780,7 +780,7 @@ static int split_node(struct btrfs_trans_handle *trans, struct btrfs_root | |||
780 | split = btrfs_buffer_node(split_buffer); | 780 | split = btrfs_buffer_node(split_buffer); |
781 | btrfs_set_header_flags(&split->header, btrfs_header_flags(&c->header)); | 781 | btrfs_set_header_flags(&split->header, btrfs_header_flags(&c->header)); |
782 | btrfs_set_header_level(&split->header, btrfs_header_level(&c->header)); | 782 | btrfs_set_header_level(&split->header, btrfs_header_level(&c->header)); |
783 | btrfs_set_header_blocknr(&split->header, split_buffer->b_blocknr); | 783 | btrfs_set_header_blocknr(&split->header, bh_blocknr(split_buffer)); |
784 | btrfs_set_header_generation(&split->header, trans->transid); | 784 | btrfs_set_header_generation(&split->header, trans->transid); |
785 | memcpy(split->header.fsid, root->fs_info->disk_super->fsid, | 785 | memcpy(split->header.fsid, root->fs_info->disk_super->fsid, |
786 | sizeof(split->header.fsid)); | 786 | sizeof(split->header.fsid)); |
@@ -794,7 +794,7 @@ static int split_node(struct btrfs_trans_handle *trans, struct btrfs_root | |||
794 | btrfs_mark_buffer_dirty(t); | 794 | btrfs_mark_buffer_dirty(t); |
795 | btrfs_mark_buffer_dirty(split_buffer); | 795 | btrfs_mark_buffer_dirty(split_buffer); |
796 | wret = insert_ptr(trans, root, path, &split->ptrs[0].key, | 796 | wret = insert_ptr(trans, root, path, &split->ptrs[0].key, |
797 | split_buffer->b_blocknr, path->slots[level + 1] + 1, | 797 | bh_blocknr(split_buffer), path->slots[level + 1] + 1, |
798 | level + 1); | 798 | level + 1); |
799 | if (wret) | 799 | if (wret) |
800 | ret = wret; | 800 | ret = wret; |
@@ -1138,7 +1138,7 @@ static int split_leaf(struct btrfs_trans_handle *trans, struct btrfs_root | |||
1138 | BUG_ON(!right_buffer); | 1138 | BUG_ON(!right_buffer); |
1139 | right = btrfs_buffer_leaf(right_buffer); | 1139 | right = btrfs_buffer_leaf(right_buffer); |
1140 | memset(&right->header, 0, sizeof(right->header)); | 1140 | memset(&right->header, 0, sizeof(right->header)); |
1141 | btrfs_set_header_blocknr(&right->header, right_buffer->b_blocknr); | 1141 | btrfs_set_header_blocknr(&right->header, bh_blocknr(right_buffer)); |
1142 | btrfs_set_header_generation(&right->header, trans->transid); | 1142 | btrfs_set_header_generation(&right->header, trans->transid); |
1143 | btrfs_set_header_level(&right->header, 0); | 1143 | btrfs_set_header_level(&right->header, 0); |
1144 | memcpy(right->header.fsid, root->fs_info->disk_super->fsid, | 1144 | memcpy(right->header.fsid, root->fs_info->disk_super->fsid, |
@@ -1152,7 +1152,7 @@ static int split_leaf(struct btrfs_trans_handle *trans, struct btrfs_root | |||
1152 | btrfs_set_header_nritems(&right->header, 0); | 1152 | btrfs_set_header_nritems(&right->header, 0); |
1153 | wret = insert_ptr(trans, root, path, | 1153 | wret = insert_ptr(trans, root, path, |
1154 | &disk_key, | 1154 | &disk_key, |
1155 | right_buffer->b_blocknr, | 1155 | bh_blocknr(right_buffer), |
1156 | path->slots[1] + 1, 1); | 1156 | path->slots[1] + 1, 1); |
1157 | if (wret) | 1157 | if (wret) |
1158 | ret = wret; | 1158 | ret = wret; |
@@ -1173,7 +1173,7 @@ static int split_leaf(struct btrfs_trans_handle *trans, struct btrfs_root | |||
1173 | btrfs_set_header_nritems(&right->header, 0); | 1173 | btrfs_set_header_nritems(&right->header, 0); |
1174 | wret = insert_ptr(trans, root, path, | 1174 | wret = insert_ptr(trans, root, path, |
1175 | &disk_key, | 1175 | &disk_key, |
1176 | right_buffer->b_blocknr, | 1176 | bh_blocknr(right_buffer), |
1177 | path->slots[1] - 1, 1); | 1177 | path->slots[1] - 1, 1); |
1178 | if (wret) | 1178 | if (wret) |
1179 | ret = wret; | 1179 | ret = wret; |
@@ -1207,7 +1207,7 @@ static int split_leaf(struct btrfs_trans_handle *trans, struct btrfs_root | |||
1207 | btrfs_set_header_nritems(&l->header, mid); | 1207 | btrfs_set_header_nritems(&l->header, mid); |
1208 | ret = 0; | 1208 | ret = 0; |
1209 | wret = insert_ptr(trans, root, path, &right->items[0].key, | 1209 | wret = insert_ptr(trans, root, path, &right->items[0].key, |
1210 | right_buffer->b_blocknr, path->slots[1] + 1, 1); | 1210 | bh_blocknr(right_buffer), path->slots[1] + 1, 1); |
1211 | if (wret) | 1211 | if (wret) |
1212 | ret = wret; | 1212 | ret = wret; |
1213 | btrfs_mark_buffer_dirty(right_buffer); | 1213 | btrfs_mark_buffer_dirty(right_buffer); |
@@ -1228,7 +1228,7 @@ static int split_leaf(struct btrfs_trans_handle *trans, struct btrfs_root | |||
1228 | BUG_ON(!right_buffer); | 1228 | BUG_ON(!right_buffer); |
1229 | right = btrfs_buffer_leaf(right_buffer); | 1229 | right = btrfs_buffer_leaf(right_buffer); |
1230 | memset(&right->header, 0, sizeof(right->header)); | 1230 | memset(&right->header, 0, sizeof(right->header)); |
1231 | btrfs_set_header_blocknr(&right->header, right_buffer->b_blocknr); | 1231 | btrfs_set_header_blocknr(&right->header, bh_blocknr(right_buffer)); |
1232 | btrfs_set_header_generation(&right->header, trans->transid); | 1232 | btrfs_set_header_generation(&right->header, trans->transid); |
1233 | btrfs_set_header_level(&right->header, 0); | 1233 | btrfs_set_header_level(&right->header, 0); |
1234 | memcpy(right->header.fsid, root->fs_info->disk_super->fsid, | 1234 | memcpy(right->header.fsid, root->fs_info->disk_super->fsid, |
@@ -1237,7 +1237,7 @@ static int split_leaf(struct btrfs_trans_handle *trans, struct btrfs_root | |||
1237 | btrfs_set_header_nritems(&right->header, 0); | 1237 | btrfs_set_header_nritems(&right->header, 0); |
1238 | wret = insert_ptr(trans, root, path, | 1238 | wret = insert_ptr(trans, root, path, |
1239 | &disk_key, | 1239 | &disk_key, |
1240 | right_buffer->b_blocknr, | 1240 | bh_blocknr(right_buffer), |
1241 | path->slots[1], 1); | 1241 | path->slots[1], 1); |
1242 | if (wret) | 1242 | if (wret) |
1243 | ret = wret; | 1243 | ret = wret; |
@@ -1456,7 +1456,7 @@ int btrfs_del_item(struct btrfs_trans_handle *trans, struct btrfs_root *root, | |||
1456 | if (wret) | 1456 | if (wret) |
1457 | ret = wret; | 1457 | ret = wret; |
1458 | wret = btrfs_free_extent(trans, root, | 1458 | wret = btrfs_free_extent(trans, root, |
1459 | leaf_buf->b_blocknr, 1, 1); | 1459 | bh_blocknr(leaf_buf), 1, 1); |
1460 | if (wret) | 1460 | if (wret) |
1461 | ret = wret; | 1461 | ret = wret; |
1462 | } | 1462 | } |
@@ -1487,7 +1487,7 @@ int btrfs_del_item(struct btrfs_trans_handle *trans, struct btrfs_root *root, | |||
1487 | ret = wret; | 1487 | ret = wret; |
1488 | } | 1488 | } |
1489 | if (btrfs_header_nritems(&leaf->header) == 0) { | 1489 | if (btrfs_header_nritems(&leaf->header) == 0) { |
1490 | u64 blocknr = leaf_buf->b_blocknr; | 1490 | u64 blocknr = bh_blocknr(leaf_buf); |
1491 | clean_tree_block(trans, root, leaf_buf); | 1491 | clean_tree_block(trans, root, leaf_buf); |
1492 | wait_on_buffer(leaf_buf); | 1492 | wait_on_buffer(leaf_buf); |
1493 | wret = del_ptr(trans, root, path, 1, slot); | 1493 | wret = del_ptr(trans, root, path, 1, slot); |