Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

btrfs: Remove V0 extent support

The v0 compat code was introduced in commit 5d4f98a28c7d
("Btrfs: Mixed back reference (FORWARD ROLLING FORMAT CHANGE)") 9
years ago, which was merged in 2.6.31. This means that the code is
there to support filesystems which are _VERY_ old and if you are using
btrfs on such an old kernel, you have much bigger problems. This coupled
with the fact that no one is likely testing/maintining this code likely
means it has bugs lurking. All things considered I think 43 kernel
releases later it's high time this remnant of the past got removed.

This patch removes all code wrapped in #ifdefs but leaves the BUG_ONs in case
we have a v0 with no support intact as a sort of safety-net.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>

authored by

Nikolay Borisov and committed by
David Sterba
a79865c6 4de426cd

+4 -394
+1 -5
fs/btrfs/ctree.c
··· 888 888 btrfs_root_last_snapshot(&root->root_item) || 889 889 btrfs_header_flag(buf, BTRFS_HEADER_FLAG_RELOC))) 890 890 return 1; 891 - #ifdef BTRFS_COMPAT_EXTENT_TREE_V0 892 - if (test_bit(BTRFS_ROOT_REF_COWS, &root->state) && 893 - btrfs_header_backref_rev(buf) < BTRFS_MIXED_BACKREF_REV) 894 - return 1; 895 - #endif 891 + 896 892 return 0; 897 893 } 898 894
-2
fs/btrfs/ctree.h
··· 55 55 56 56 #define BTRFS_OLDEST_GENERATION 0ULL 57 57 58 - #define BTRFS_COMPAT_EXTENT_TREE_V0 59 - 60 58 /* 61 59 * the max metadata block size. This limit is somewhat artificial, 62 60 * but the memmove costs go through the roof for larger blocks.
+1 -208
fs/btrfs/extent-tree.c
··· 867 867 num_refs = btrfs_extent_refs(leaf, ei); 868 868 extent_flags = btrfs_extent_flags(leaf, ei); 869 869 } else { 870 - #ifdef BTRFS_COMPAT_EXTENT_TREE_V0 871 - struct btrfs_extent_item_v0 *ei0; 872 - BUG_ON(item_size != sizeof(*ei0)); 873 - ei0 = btrfs_item_ptr(leaf, path->slots[0], 874 - struct btrfs_extent_item_v0); 875 - num_refs = btrfs_extent_refs_v0(leaf, ei0); 876 - /* FIXME: this isn't correct for data */ 877 - extent_flags = BTRFS_BLOCK_FLAG_FULL_BACKREF; 878 - #else 879 870 BUG(); 880 - #endif 881 871 } 882 872 BUG_ON(num_refs == 0); 883 873 } else { ··· 1026 1036 * tree block info structure. 1027 1037 */ 1028 1038 1029 - #ifdef BTRFS_COMPAT_EXTENT_TREE_V0 1030 - static int convert_extent_item_v0(struct btrfs_trans_handle *trans, 1031 - struct btrfs_fs_info *fs_info, 1032 - struct btrfs_path *path, 1033 - u64 owner, u32 extra_size) 1034 - { 1035 - struct btrfs_root *root = fs_info->extent_root; 1036 - struct btrfs_extent_item *item; 1037 - struct btrfs_extent_item_v0 *ei0; 1038 - struct btrfs_extent_ref_v0 *ref0; 1039 - struct btrfs_tree_block_info *bi; 1040 - struct extent_buffer *leaf; 1041 - struct btrfs_key key; 1042 - struct btrfs_key found_key; 1043 - u32 new_size = sizeof(*item); 1044 - u64 refs; 1045 - int ret; 1046 - 1047 - leaf = path->nodes[0]; 1048 - BUG_ON(btrfs_item_size_nr(leaf, path->slots[0]) != sizeof(*ei0)); 1049 - 1050 - btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); 1051 - ei0 = btrfs_item_ptr(leaf, path->slots[0], 1052 - struct btrfs_extent_item_v0); 1053 - refs = btrfs_extent_refs_v0(leaf, ei0); 1054 - 1055 - if (owner == (u64)-1) { 1056 - while (1) { 1057 - if (path->slots[0] >= btrfs_header_nritems(leaf)) { 1058 - ret = btrfs_next_leaf(root, path); 1059 - if (ret < 0) 1060 - return ret; 1061 - BUG_ON(ret > 0); /* Corruption */ 1062 - leaf = path->nodes[0]; 1063 - } 1064 - btrfs_item_key_to_cpu(leaf, &found_key, 1065 - path->slots[0]); 1066 - BUG_ON(key.objectid != found_key.objectid); 1067 - if (found_key.type != BTRFS_EXTENT_REF_V0_KEY) { 1068 - path->slots[0]++; 1069 - continue; 1070 - } 1071 - ref0 = btrfs_item_ptr(leaf, path->slots[0], 1072 - struct btrfs_extent_ref_v0); 1073 - owner = btrfs_ref_objectid_v0(leaf, ref0); 1074 - break; 1075 - } 1076 - } 1077 - btrfs_release_path(path); 1078 - 1079 - if (owner < BTRFS_FIRST_FREE_OBJECTID) 1080 - new_size += sizeof(*bi); 1081 - 1082 - new_size -= sizeof(*ei0); 1083 - ret = btrfs_search_slot(trans, root, &key, path, 1084 - new_size + extra_size, 1); 1085 - if (ret < 0) 1086 - return ret; 1087 - BUG_ON(ret); /* Corruption */ 1088 - 1089 - btrfs_extend_item(fs_info, path, new_size); 1090 - 1091 - leaf = path->nodes[0]; 1092 - item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_extent_item); 1093 - btrfs_set_extent_refs(leaf, item, refs); 1094 - /* FIXME: get real generation */ 1095 - btrfs_set_extent_generation(leaf, item, 0); 1096 - if (owner < BTRFS_FIRST_FREE_OBJECTID) { 1097 - btrfs_set_extent_flags(leaf, item, 1098 - BTRFS_EXTENT_FLAG_TREE_BLOCK | 1099 - BTRFS_BLOCK_FLAG_FULL_BACKREF); 1100 - bi = (struct btrfs_tree_block_info *)(item + 1); 1101 - /* FIXME: get first key of the block */ 1102 - memzero_extent_buffer(leaf, (unsigned long)bi, sizeof(*bi)); 1103 - btrfs_set_tree_block_level(leaf, bi, (int)owner); 1104 - } else { 1105 - btrfs_set_extent_flags(leaf, item, BTRFS_EXTENT_FLAG_DATA); 1106 - } 1107 - btrfs_mark_buffer_dirty(leaf); 1108 - return 0; 1109 - } 1110 - #endif 1111 - 1112 1039 /* 1113 1040 * is_data == BTRFS_REF_TYPE_BLOCK, tree block type is required, 1114 1041 * is_data == BTRFS_REF_TYPE_DATA, data type is requried, ··· 1154 1247 if (parent) { 1155 1248 if (!ret) 1156 1249 return 0; 1157 - #ifdef BTRFS_COMPAT_EXTENT_TREE_V0 1158 - key.type = BTRFS_EXTENT_REF_V0_KEY; 1159 - btrfs_release_path(path); 1160 - ret = btrfs_search_slot(trans, root, &key, path, -1, 1); 1161 - if (ret < 0) { 1162 - err = ret; 1163 - goto fail; 1164 - } 1165 - if (!ret) 1166 - return 0; 1167 - #endif 1168 1250 goto fail; 1169 1251 } 1170 1252 ··· 1296 1400 ref2 = btrfs_item_ptr(leaf, path->slots[0], 1297 1401 struct btrfs_shared_data_ref); 1298 1402 num_refs = btrfs_shared_data_ref_count(leaf, ref2); 1299 - #ifdef BTRFS_COMPAT_EXTENT_TREE_V0 1300 - } else if (key.type == BTRFS_EXTENT_REF_V0_KEY) { 1301 - struct btrfs_extent_ref_v0 *ref0; 1302 - ref0 = btrfs_item_ptr(leaf, path->slots[0], 1303 - struct btrfs_extent_ref_v0); 1304 - num_refs = btrfs_ref_count_v0(leaf, ref0); 1305 - #endif 1306 1403 } else { 1307 1404 BUG(); 1308 1405 } ··· 1311 1422 btrfs_set_extent_data_ref_count(leaf, ref1, num_refs); 1312 1423 else if (key.type == BTRFS_SHARED_DATA_REF_KEY) 1313 1424 btrfs_set_shared_data_ref_count(leaf, ref2, num_refs); 1314 - #ifdef BTRFS_COMPAT_EXTENT_TREE_V0 1315 - else { 1316 - struct btrfs_extent_ref_v0 *ref0; 1317 - ref0 = btrfs_item_ptr(leaf, path->slots[0], 1318 - struct btrfs_extent_ref_v0); 1319 - btrfs_set_ref_count_v0(leaf, ref0, num_refs); 1320 - } 1321 - #endif 1322 1425 btrfs_mark_buffer_dirty(leaf); 1323 1426 } 1324 1427 return ret; ··· 1350 1469 ref2 = btrfs_item_ptr(leaf, path->slots[0], 1351 1470 struct btrfs_shared_data_ref); 1352 1471 num_refs = btrfs_shared_data_ref_count(leaf, ref2); 1353 - #ifdef BTRFS_COMPAT_EXTENT_TREE_V0 1354 - } else if (key.type == BTRFS_EXTENT_REF_V0_KEY) { 1355 - struct btrfs_extent_ref_v0 *ref0; 1356 - ref0 = btrfs_item_ptr(leaf, path->slots[0], 1357 - struct btrfs_extent_ref_v0); 1358 - num_refs = btrfs_ref_count_v0(leaf, ref0); 1359 - #endif 1360 1472 } else { 1361 1473 WARN_ON(1); 1362 1474 } ··· 1377 1503 ret = btrfs_search_slot(trans, root, &key, path, -1, 1); 1378 1504 if (ret > 0) 1379 1505 ret = -ENOENT; 1380 - #ifdef BTRFS_COMPAT_EXTENT_TREE_V0 1381 - if (ret == -ENOENT && parent) { 1382 - btrfs_release_path(path); 1383 - key.type = BTRFS_EXTENT_REF_V0_KEY; 1384 - ret = btrfs_search_slot(trans, root, &key, path, -1, 1); 1385 - if (ret > 0) 1386 - ret = -ENOENT; 1387 - } 1388 - #endif 1389 1506 return ret; 1390 1507 } 1391 1508 ··· 1541 1676 1542 1677 leaf = path->nodes[0]; 1543 1678 item_size = btrfs_item_size_nr(leaf, path->slots[0]); 1544 - #ifdef BTRFS_COMPAT_EXTENT_TREE_V0 1545 - if (item_size < sizeof(*ei)) { 1546 - if (!insert) { 1547 - err = -ENOENT; 1548 - goto out; 1549 - } 1550 - ret = convert_extent_item_v0(trans, fs_info, path, owner, 1551 - extra_size); 1552 - if (ret < 0) { 1553 - err = ret; 1554 - goto out; 1555 - } 1556 - leaf = path->nodes[0]; 1557 - item_size = btrfs_item_size_nr(leaf, path->slots[0]); 1558 - } 1559 - #endif 1560 1679 BUG_ON(item_size < sizeof(*ei)); 1561 1680 1562 1681 ei = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_extent_item); ··· 2265 2416 2266 2417 leaf = path->nodes[0]; 2267 2418 item_size = btrfs_item_size_nr(leaf, path->slots[0]); 2268 - #ifdef BTRFS_COMPAT_EXTENT_TREE_V0 2269 - if (item_size < sizeof(*ei)) { 2270 - ret = convert_extent_item_v0(trans, fs_info, path, (u64)-1, 0); 2271 - if (ret < 0) { 2272 - err = ret; 2273 - goto out; 2274 - } 2275 - leaf = path->nodes[0]; 2276 - item_size = btrfs_item_size_nr(leaf, path->slots[0]); 2277 - } 2278 - #endif 2279 2419 BUG_ON(item_size < sizeof(*ei)); 2280 2420 ei = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_extent_item); 2281 2421 __run_delayed_extent_op(extent_op, leaf, ei); ··· 3076 3238 3077 3239 ret = 1; 3078 3240 item_size = btrfs_item_size_nr(leaf, path->slots[0]); 3079 - #ifdef BTRFS_COMPAT_EXTENT_TREE_V0 3080 - if (item_size < sizeof(*ei)) { 3081 - WARN_ON(item_size != sizeof(struct btrfs_extent_item_v0)); 3082 - goto out; 3083 - } 3084 - #endif 3085 3241 ei = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_extent_item); 3086 3242 3087 3243 if (item_size != sizeof(*ei) + ··· 6720 6888 break; 6721 6889 extent_slot--; 6722 6890 } 6723 - #ifdef BTRFS_COMPAT_EXTENT_TREE_V0 6724 - item_size = btrfs_item_size_nr(path->nodes[0], extent_slot); 6725 - if (found_extent && item_size < sizeof(*ei)) 6726 - found_extent = 0; 6727 - #endif 6891 + 6728 6892 if (!found_extent) { 6729 6893 BUG_ON(iref); 6730 6894 ret = remove_extent_backref(trans, path, NULL, ··· 6796 6968 6797 6969 leaf = path->nodes[0]; 6798 6970 item_size = btrfs_item_size_nr(leaf, extent_slot); 6799 - #ifdef BTRFS_COMPAT_EXTENT_TREE_V0 6800 - if (item_size < sizeof(*ei)) { 6801 - BUG_ON(found_extent || extent_slot != path->slots[0]); 6802 - ret = convert_extent_item_v0(trans, info, path, owner_objectid, 6803 - 0); 6804 - if (ret < 0) { 6805 - btrfs_abort_transaction(trans, ret); 6806 - goto out; 6807 - } 6808 - 6809 - btrfs_release_path(path); 6810 - path->leave_spinning = 1; 6811 - 6812 - key.objectid = bytenr; 6813 - key.type = BTRFS_EXTENT_ITEM_KEY; 6814 - key.offset = num_bytes; 6815 - 6816 - ret = btrfs_search_slot(trans, extent_root, &key, path, 6817 - -1, 1); 6818 - if (ret) { 6819 - btrfs_err(info, 6820 - "umm, got %d back from search, was looking for %llu", 6821 - ret, bytenr); 6822 - btrfs_print_leaf(path->nodes[0]); 6823 - } 6824 - if (ret < 0) { 6825 - btrfs_abort_transaction(trans, ret); 6826 - goto out; 6827 - } 6828 - 6829 - extent_slot = path->slots[0]; 6830 - leaf = path->nodes[0]; 6831 - item_size = btrfs_item_size_nr(leaf, extent_slot); 6832 - } 6833 - #endif 6834 6971 BUG_ON(item_size < sizeof(*ei)); 6835 6972 ei = btrfs_item_ptr(leaf, extent_slot, 6836 6973 struct btrfs_extent_item);
+1 -29
fs/btrfs/print-tree.c
··· 52 52 u64 offset; 53 53 int ref_index = 0; 54 54 55 - if (item_size < sizeof(*ei)) { 56 - #ifdef BTRFS_COMPAT_EXTENT_TREE_V0 57 - struct btrfs_extent_item_v0 *ei0; 58 - BUG_ON(item_size != sizeof(*ei0)); 59 - ei0 = btrfs_item_ptr(eb, slot, struct btrfs_extent_item_v0); 60 - pr_info("\t\textent refs %u\n", 61 - btrfs_extent_refs_v0(eb, ei0)); 62 - return; 63 - #else 55 + if (item_size < sizeof(*ei)) 64 56 BUG(); 65 - #endif 66 - } 67 57 68 58 ei = btrfs_item_ptr(eb, slot, struct btrfs_extent_item); 69 59 flags = btrfs_extent_flags(eb, ei); ··· 122 132 } 123 133 WARN_ON(ptr > end); 124 134 } 125 - 126 - #ifdef BTRFS_COMPAT_EXTENT_TREE_V0 127 - static void print_extent_ref_v0(struct extent_buffer *eb, int slot) 128 - { 129 - struct btrfs_extent_ref_v0 *ref0; 130 - 131 - ref0 = btrfs_item_ptr(eb, slot, struct btrfs_extent_ref_v0); 132 - printk("\t\textent back ref root %llu gen %llu owner %llu num_refs %lu\n", 133 - btrfs_ref_root_v0(eb, ref0), 134 - btrfs_ref_generation_v0(eb, ref0), 135 - btrfs_ref_objectid_v0(eb, ref0), 136 - (unsigned long)btrfs_ref_count_v0(eb, ref0)); 137 - } 138 - #endif 139 135 140 136 static void print_uuid_item(struct extent_buffer *l, unsigned long offset, 141 137 u32 item_size) ··· 256 280 btrfs_file_extent_ram_bytes(l, fi)); 257 281 break; 258 282 case BTRFS_EXTENT_REF_V0_KEY: 259 - #ifdef BTRFS_COMPAT_EXTENT_TREE_V0 260 - print_extent_ref_v0(l, i); 261 - #else 262 283 BUG(); 263 - #endif 264 284 break; 265 285 case BTRFS_BLOCK_GROUP_ITEM_KEY: 266 286 bi = btrfs_item_ptr(l, i,
+1 -150
fs/btrfs/relocation.c
··· 586 586 return btrfs_get_fs_root(fs_info, &key, false); 587 587 } 588 588 589 - #ifdef BTRFS_COMPAT_EXTENT_TREE_V0 590 - static noinline_for_stack 591 - struct btrfs_root *find_tree_root(struct reloc_control *rc, 592 - struct extent_buffer *leaf, 593 - struct btrfs_extent_ref_v0 *ref0) 594 - { 595 - struct btrfs_root *root; 596 - u64 root_objectid = btrfs_ref_root_v0(leaf, ref0); 597 - u64 generation = btrfs_ref_generation_v0(leaf, ref0); 598 - 599 - BUG_ON(root_objectid == BTRFS_TREE_RELOC_OBJECTID); 600 - 601 - root = read_fs_root(rc->extent_root->fs_info, root_objectid); 602 - BUG_ON(IS_ERR(root)); 603 - 604 - if (test_bit(BTRFS_ROOT_REF_COWS, &root->state) && 605 - generation != btrfs_root_generation(&root->root_item)) 606 - return NULL; 607 - 608 - return root; 609 - } 610 - #endif 611 - 612 589 static noinline_for_stack 613 590 int find_inline_backref(struct extent_buffer *leaf, int slot, 614 591 unsigned long *ptr, unsigned long *end) ··· 598 621 btrfs_item_key_to_cpu(leaf, &key, slot); 599 622 600 623 item_size = btrfs_item_size_nr(leaf, slot); 601 - #ifdef BTRFS_COMPAT_EXTENT_TREE_V0 602 - if (item_size < sizeof(*ei)) { 603 - WARN_ON(item_size != sizeof(struct btrfs_extent_item_v0)); 604 - return 1; 605 - } 606 - #endif 607 624 ei = btrfs_item_ptr(leaf, slot, struct btrfs_extent_item); 608 625 WARN_ON(!(btrfs_extent_flags(leaf, ei) & 609 626 BTRFS_EXTENT_FLAG_TREE_BLOCK)); ··· 782 811 goto next; 783 812 } 784 813 785 - #ifdef BTRFS_COMPAT_EXTENT_TREE_V0 786 - if (key.type == BTRFS_SHARED_BLOCK_REF_KEY || 787 - key.type == BTRFS_EXTENT_REF_V0_KEY) { 788 - if (key.type == BTRFS_EXTENT_REF_V0_KEY) { 789 - struct btrfs_extent_ref_v0 *ref0; 790 - ref0 = btrfs_item_ptr(eb, path1->slots[0], 791 - struct btrfs_extent_ref_v0); 792 - if (key.objectid == key.offset) { 793 - root = find_tree_root(rc, eb, ref0); 794 - if (root && !should_ignore_root(root)) 795 - cur->root = root; 796 - else 797 - list_add(&cur->list, &useless); 798 - break; 799 - } 800 - if (is_cowonly_root(btrfs_ref_root_v0(eb, 801 - ref0))) 802 - cur->cowonly = 1; 803 - } 804 - #else 805 814 ASSERT(key.type != BTRFS_EXTENT_REF_V0_KEY); 806 815 if (key.type == BTRFS_SHARED_BLOCK_REF_KEY) { 807 - #endif 808 816 if (key.objectid == key.offset) { 809 817 /* 810 818 * only root blocks of reloc trees use ··· 3283 3333 return 0; 3284 3334 } 3285 3335 3286 - #ifdef BTRFS_COMPAT_EXTENT_TREE_V0 3287 - static int get_ref_objectid_v0(struct reloc_control *rc, 3288 - struct btrfs_path *path, 3289 - struct btrfs_key *extent_key, 3290 - u64 *ref_objectid, int *path_change) 3291 - { 3292 - struct btrfs_key key; 3293 - struct extent_buffer *leaf; 3294 - struct btrfs_extent_ref_v0 *ref0; 3295 - int ret; 3296 - int slot; 3297 - 3298 - leaf = path->nodes[0]; 3299 - slot = path->slots[0]; 3300 - while (1) { 3301 - if (slot >= btrfs_header_nritems(leaf)) { 3302 - ret = btrfs_next_leaf(rc->extent_root, path); 3303 - if (ret < 0) 3304 - return ret; 3305 - BUG_ON(ret > 0); 3306 - leaf = path->nodes[0]; 3307 - slot = path->slots[0]; 3308 - if (path_change) 3309 - *path_change = 1; 3310 - } 3311 - btrfs_item_key_to_cpu(leaf, &key, slot); 3312 - if (key.objectid != extent_key->objectid) 3313 - return -ENOENT; 3314 - 3315 - if (key.type != BTRFS_EXTENT_REF_V0_KEY) { 3316 - slot++; 3317 - continue; 3318 - } 3319 - ref0 = btrfs_item_ptr(leaf, slot, 3320 - struct btrfs_extent_ref_v0); 3321 - *ref_objectid = btrfs_ref_objectid_v0(leaf, ref0); 3322 - break; 3323 - } 3324 - return 0; 3325 - } 3326 - #endif 3327 - 3328 3336 /* 3329 3337 * helper to add a tree block to the list. 3330 3338 * the major work is getting the generation and level of the block ··· 3316 3408 } 3317 3409 generation = btrfs_extent_generation(eb, ei); 3318 3410 } else { 3319 - #ifdef BTRFS_COMPAT_EXTENT_TREE_V0 3320 - u64 ref_owner; 3321 - int ret; 3322 - 3323 - BUG_ON(item_size != sizeof(struct btrfs_extent_item_v0)); 3324 - ret = get_ref_objectid_v0(rc, path, extent_key, 3325 - &ref_owner, NULL); 3326 - if (ret < 0) 3327 - return ret; 3328 - BUG_ON(ref_owner >= BTRFS_MAX_LEVEL); 3329 - level = (int)ref_owner; 3330 - /* FIXME: get real generation */ 3331 - generation = 0; 3332 - #else 3333 3411 BUG(); 3334 - #endif 3335 3412 } 3336 3413 3337 3414 btrfs_release_path(path); ··· 3674 3781 eb = path->nodes[0]; 3675 3782 ptr = btrfs_item_ptr_offset(eb, path->slots[0]); 3676 3783 end = ptr + btrfs_item_size_nr(eb, path->slots[0]); 3677 - #ifdef BTRFS_COMPAT_EXTENT_TREE_V0 3678 - if (ptr + sizeof(struct btrfs_extent_item_v0) == end) 3679 - ptr = end; 3680 - else 3681 - #endif 3682 - ptr += sizeof(struct btrfs_extent_item); 3784 + ptr += sizeof(struct btrfs_extent_item); 3683 3785 3684 3786 while (ptr < end) { 3685 3787 iref = (struct btrfs_extent_inline_ref *)ptr; ··· 3720 3832 if (key.objectid != extent_key->objectid) 3721 3833 break; 3722 3834 3723 - #ifdef BTRFS_COMPAT_EXTENT_TREE_V0 3724 - if (key.type == BTRFS_SHARED_DATA_REF_KEY || 3725 - key.type == BTRFS_EXTENT_REF_V0_KEY) { 3726 - #else 3727 3835 BUG_ON(key.type == BTRFS_EXTENT_REF_V0_KEY); 3728 3836 if (key.type == BTRFS_SHARED_DATA_REF_KEY) { 3729 - #endif 3730 3837 ret = __add_tree_block(rc, key.offset, blocksize, 3731 3838 blocks); 3732 3839 } else if (key.type == BTRFS_EXTENT_DATA_REF_KEY) { ··· 3969 4086 BUG_ON(ret); 3970 4087 3971 4088 } else { 3972 - #ifdef BTRFS_COMPAT_EXTENT_TREE_V0 3973 - u64 ref_owner; 3974 - int path_change = 0; 3975 - 3976 - BUG_ON(item_size != 3977 - sizeof(struct btrfs_extent_item_v0)); 3978 - ret = get_ref_objectid_v0(rc, path, &key, &ref_owner, 3979 - &path_change); 3980 - if (ret < 0) { 3981 - err = ret; 3982 - break; 3983 - } 3984 - if (ref_owner < BTRFS_FIRST_FREE_OBJECTID) 3985 - flags = BTRFS_EXTENT_FLAG_TREE_BLOCK; 3986 - else 3987 - flags = BTRFS_EXTENT_FLAG_DATA; 3988 - 3989 - if (path_change) { 3990 - btrfs_release_path(path); 3991 - 3992 - path->search_commit_root = 1; 3993 - path->skip_locking = 1; 3994 - ret = btrfs_search_slot(NULL, rc->extent_root, 3995 - &key, path, 0, 0); 3996 - if (ret < 0) { 3997 - err = ret; 3998 - break; 3999 - } 4000 - BUG_ON(ret > 0); 4001 - } 4002 - #else 4003 4089 BUG(); 4004 - #endif 4005 4090 } 4006 4091 4007 4092 if (flags & BTRFS_EXTENT_FLAG_TREE_BLOCK) {