backref.c (35a3621beb3e2face3e7954eaee20a8fa0043fac) | backref.c (c1c9ff7c94e83fae89a742df74db51156869bad5) |
---|---|
1/* 2 * Copyright (C) 2011 STRATO. All rights reserved. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public 6 * License v2 as published by the Free Software Foundation. 7 * 8 * This program is distributed in the hope that it will be useful, --- 281 unchanged lines hidden (view full) --- 290 291 if (root_level + 1 == level) 292 goto out; 293 294 path->lowest_level = level; 295 ret = btrfs_search_old_slot(root, &ref->key_for_search, path, time_seq); 296 pr_debug("search slot in root %llu (level %d, ref count %d) returned " 297 "%d for key (%llu %u %llu)\n", | 1/* 2 * Copyright (C) 2011 STRATO. All rights reserved. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public 6 * License v2 as published by the Free Software Foundation. 7 * 8 * This program is distributed in the hope that it will be useful, --- 281 unchanged lines hidden (view full) --- 290 291 if (root_level + 1 == level) 292 goto out; 293 294 path->lowest_level = level; 295 ret = btrfs_search_old_slot(root, &ref->key_for_search, path, time_seq); 296 pr_debug("search slot in root %llu (level %d, ref count %d) returned " 297 "%d for key (%llu %u %llu)\n", |
298 (unsigned long long)ref->root_id, level, ref->count, ret, 299 (unsigned long long)ref->key_for_search.objectid, 300 ref->key_for_search.type, 301 (unsigned long long)ref->key_for_search.offset); | 298 ref->root_id, level, ref->count, ret, 299 ref->key_for_search.objectid, ref->key_for_search.type, 300 ref->key_for_search.offset); |
302 if (ret < 0) 303 goto out; 304 305 eb = path->nodes[level]; 306 while (!eb) { 307 if (!level) { 308 WARN_ON(1); 309 ret = 1; --- 1013 unchanged lines hidden (view full) --- 1323 size = fs_info->extent_root->leafsize; 1324 else if (found_key->type == BTRFS_EXTENT_ITEM_KEY) 1325 size = found_key->offset; 1326 1327 if ((found_key->type != BTRFS_EXTENT_ITEM_KEY && 1328 found_key->type != BTRFS_METADATA_ITEM_KEY) || 1329 found_key->objectid > logical || 1330 found_key->objectid + size <= logical) { | 301 if (ret < 0) 302 goto out; 303 304 eb = path->nodes[level]; 305 while (!eb) { 306 if (!level) { 307 WARN_ON(1); 308 ret = 1; --- 1013 unchanged lines hidden (view full) --- 1322 size = fs_info->extent_root->leafsize; 1323 else if (found_key->type == BTRFS_EXTENT_ITEM_KEY) 1324 size = found_key->offset; 1325 1326 if ((found_key->type != BTRFS_EXTENT_ITEM_KEY && 1327 found_key->type != BTRFS_METADATA_ITEM_KEY) || 1328 found_key->objectid > logical || 1329 found_key->objectid + size <= logical) { |
1331 pr_debug("logical %llu is not within any extent\n", 1332 (unsigned long long)logical); | 1330 pr_debug("logical %llu is not within any extent\n", logical); |
1333 return -ENOENT; 1334 } 1335 1336 eb = path->nodes[0]; 1337 item_size = btrfs_item_size_nr(eb, path->slots[0]); 1338 BUG_ON(item_size < sizeof(*ei)); 1339 1340 ei = btrfs_item_ptr(eb, path->slots[0], struct btrfs_extent_item); 1341 flags = btrfs_extent_flags(eb, ei); 1342 1343 pr_debug("logical %llu is at position %llu within the extent (%llu " 1344 "EXTENT_ITEM %llu) flags %#llx size %u\n", | 1331 return -ENOENT; 1332 } 1333 1334 eb = path->nodes[0]; 1335 item_size = btrfs_item_size_nr(eb, path->slots[0]); 1336 BUG_ON(item_size < sizeof(*ei)); 1337 1338 ei = btrfs_item_ptr(eb, path->slots[0], struct btrfs_extent_item); 1339 flags = btrfs_extent_flags(eb, ei); 1340 1341 pr_debug("logical %llu is at position %llu within the extent (%llu " 1342 "EXTENT_ITEM %llu) flags %#llx size %u\n", |
1345 (unsigned long long)logical, 1346 (unsigned long long)(logical - found_key->objectid), 1347 (unsigned long long)found_key->objectid, 1348 (unsigned long long)found_key->offset, 1349 (unsigned long long)flags, item_size); | 1343 logical, logical - found_key->objectid, found_key->objectid, 1344 found_key->offset, flags, item_size); |
1350 1351 WARN_ON(!flags_ret); 1352 if (flags_ret) { 1353 if (flags & BTRFS_EXTENT_FLAG_TREE_BLOCK) 1354 *flags_ret = BTRFS_EXTENT_FLAG_TREE_BLOCK; 1355 else if (flags & BTRFS_EXTENT_FLAG_DATA) 1356 *flags_ret = BTRFS_EXTENT_FLAG_DATA; 1357 else --- 155 unchanged lines hidden (view full) --- 1513 ret = btrfs_find_all_roots(trans, fs_info, ref_node->val, 1514 tree_mod_seq_elem.seq, &roots); 1515 if (ret) 1516 break; 1517 ULIST_ITER_INIT(&root_uiter); 1518 while (!ret && (root_node = ulist_next(roots, &root_uiter))) { 1519 pr_debug("root %llu references leaf %llu, data list " 1520 "%#llx\n", root_node->val, ref_node->val, | 1345 1346 WARN_ON(!flags_ret); 1347 if (flags_ret) { 1348 if (flags & BTRFS_EXTENT_FLAG_TREE_BLOCK) 1349 *flags_ret = BTRFS_EXTENT_FLAG_TREE_BLOCK; 1350 else if (flags & BTRFS_EXTENT_FLAG_DATA) 1351 *flags_ret = BTRFS_EXTENT_FLAG_DATA; 1352 else --- 155 unchanged lines hidden (view full) --- 1508 ret = btrfs_find_all_roots(trans, fs_info, ref_node->val, 1509 tree_mod_seq_elem.seq, &roots); 1510 if (ret) 1511 break; 1512 ULIST_ITER_INIT(&root_uiter); 1513 while (!ret && (root_node = ulist_next(roots, &root_uiter))) { 1514 pr_debug("root %llu references leaf %llu, data list " 1515 "%#llx\n", root_node->val, ref_node->val, |
1521 (long long)ref_node->aux); | 1516 ref_node->aux); |
1522 ret = iterate_leaf_refs((struct extent_inode_elem *) 1523 (uintptr_t)ref_node->aux, 1524 root_node->val, 1525 extent_item_objectid, 1526 iterate, ctx); 1527 } 1528 ulist_free(roots); 1529 } --- 75 unchanged lines hidden (view full) --- 1605 1606 item = btrfs_item_nr(eb, slot); 1607 iref = btrfs_item_ptr(eb, slot, struct btrfs_inode_ref); 1608 1609 for (cur = 0; cur < btrfs_item_size(eb, item); cur += len) { 1610 name_len = btrfs_inode_ref_name_len(eb, iref); 1611 /* path must be released before calling iterate()! */ 1612 pr_debug("following ref at offset %u for inode %llu in " | 1517 ret = iterate_leaf_refs((struct extent_inode_elem *) 1518 (uintptr_t)ref_node->aux, 1519 root_node->val, 1520 extent_item_objectid, 1521 iterate, ctx); 1522 } 1523 ulist_free(roots); 1524 } --- 75 unchanged lines hidden (view full) --- 1600 1601 item = btrfs_item_nr(eb, slot); 1602 iref = btrfs_item_ptr(eb, slot, struct btrfs_inode_ref); 1603 1604 for (cur = 0; cur < btrfs_item_size(eb, item); cur += len) { 1605 name_len = btrfs_inode_ref_name_len(eb, iref); 1606 /* path must be released before calling iterate()! */ 1607 pr_debug("following ref at offset %u for inode %llu in " |
1613 "tree %llu\n", cur, 1614 (unsigned long long)found_key.objectid, 1615 (unsigned long long)fs_root->objectid); | 1608 "tree %llu\n", cur, found_key.objectid, 1609 fs_root->objectid); |
1616 ret = iterate(parent, name_len, 1617 (unsigned long)(iref + 1), eb, ctx); 1618 if (ret) 1619 break; 1620 len = sizeof(*iref) + name_len; 1621 iref = (struct btrfs_inode_ref *)((char *)iref + len); 1622 } 1623 btrfs_tree_read_unlock_blocking(eb); --- 206 unchanged lines hidden --- | 1610 ret = iterate(parent, name_len, 1611 (unsigned long)(iref + 1), eb, ctx); 1612 if (ret) 1613 break; 1614 len = sizeof(*iref) + name_len; 1615 iref = (struct btrfs_inode_ref *)((char *)iref + len); 1616 } 1617 btrfs_tree_read_unlock_blocking(eb); --- 206 unchanged lines hidden --- |