diff options
Diffstat (limited to 'fs/btrfs/backref.c')
-rw-r--r-- | fs/btrfs/backref.c | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index 382e90351f14..85dc7ab8f89e 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c | |||
@@ -650,7 +650,8 @@ static int __resolve_indirect_ref(struct btrfs_fs_info *fs_info, | |||
650 | /* root node has been locked, we can release @subvol_srcu safely here */ | 650 | /* root node has been locked, we can release @subvol_srcu safely here */ |
651 | srcu_read_unlock(&fs_info->subvol_srcu, index); | 651 | srcu_read_unlock(&fs_info->subvol_srcu, index); |
652 | 652 | ||
653 | pr_debug("search slot in root %llu (level %d, ref count %d) returned %d for key (%llu %u %llu)\n", | 653 | btrfs_debug(fs_info, |
654 | "search slot in root %llu (level %d, ref count %d) returned %d for key (%llu %u %llu)", | ||
654 | ref->root_id, level, ref->count, ret, | 655 | ref->root_id, level, ref->count, ret, |
655 | ref->key_for_search.objectid, ref->key_for_search.type, | 656 | ref->key_for_search.objectid, ref->key_for_search.type, |
656 | ref->key_for_search.offset); | 657 | ref->key_for_search.offset); |
@@ -1834,7 +1835,8 @@ int extent_from_logical(struct btrfs_fs_info *fs_info, u64 logical, | |||
1834 | 1835 | ||
1835 | if (found_key->objectid > logical || | 1836 | if (found_key->objectid > logical || |
1836 | found_key->objectid + size <= logical) { | 1837 | found_key->objectid + size <= logical) { |
1837 | pr_debug("logical %llu is not within any extent\n", logical); | 1838 | btrfs_debug(fs_info, |
1839 | "logical %llu is not within any extent", logical); | ||
1838 | return -ENOENT; | 1840 | return -ENOENT; |
1839 | } | 1841 | } |
1840 | 1842 | ||
@@ -1845,7 +1847,8 @@ int extent_from_logical(struct btrfs_fs_info *fs_info, u64 logical, | |||
1845 | ei = btrfs_item_ptr(eb, path->slots[0], struct btrfs_extent_item); | 1847 | ei = btrfs_item_ptr(eb, path->slots[0], struct btrfs_extent_item); |
1846 | flags = btrfs_extent_flags(eb, ei); | 1848 | flags = btrfs_extent_flags(eb, ei); |
1847 | 1849 | ||
1848 | pr_debug("logical %llu is at position %llu within the extent (%llu EXTENT_ITEM %llu) flags %#llx size %u\n", | 1850 | btrfs_debug(fs_info, |
1851 | "logical %llu is at position %llu within the extent (%llu EXTENT_ITEM %llu) flags %#llx size %u", | ||
1849 | logical, logical - found_key->objectid, found_key->objectid, | 1852 | logical, logical - found_key->objectid, found_key->objectid, |
1850 | found_key->offset, flags, item_size); | 1853 | found_key->offset, flags, item_size); |
1851 | 1854 | ||
@@ -1966,20 +1969,24 @@ int tree_backref_for_extent(unsigned long *ptr, struct extent_buffer *eb, | |||
1966 | return 0; | 1969 | return 0; |
1967 | } | 1970 | } |
1968 | 1971 | ||
1969 | static int iterate_leaf_refs(struct extent_inode_elem *inode_list, | 1972 | static int iterate_leaf_refs(struct btrfs_fs_info *fs_info, |
1970 | u64 root, u64 extent_item_objectid, | 1973 | struct extent_inode_elem *inode_list, |
1971 | iterate_extent_inodes_t *iterate, void *ctx) | 1974 | u64 root, u64 extent_item_objectid, |
1975 | iterate_extent_inodes_t *iterate, void *ctx) | ||
1972 | { | 1976 | { |
1973 | struct extent_inode_elem *eie; | 1977 | struct extent_inode_elem *eie; |
1974 | int ret = 0; | 1978 | int ret = 0; |
1975 | 1979 | ||
1976 | for (eie = inode_list; eie; eie = eie->next) { | 1980 | for (eie = inode_list; eie; eie = eie->next) { |
1977 | pr_debug("ref for %llu resolved, key (%llu EXTEND_DATA %llu), root %llu\n", extent_item_objectid, | 1981 | btrfs_debug(fs_info, |
1978 | eie->inum, eie->offset, root); | 1982 | "ref for %llu resolved, key (%llu EXTEND_DATA %llu), root %llu", |
1983 | extent_item_objectid, eie->inum, | ||
1984 | eie->offset, root); | ||
1979 | ret = iterate(eie->inum, eie->offset, root, ctx); | 1985 | ret = iterate(eie->inum, eie->offset, root, ctx); |
1980 | if (ret) { | 1986 | if (ret) { |
1981 | pr_debug("stopping iteration for %llu due to ret=%d\n", | 1987 | btrfs_debug(fs_info, |
1982 | extent_item_objectid, ret); | 1988 | "stopping iteration for %llu due to ret=%d", |
1989 | extent_item_objectid, ret); | ||
1983 | break; | 1990 | break; |
1984 | } | 1991 | } |
1985 | } | 1992 | } |
@@ -2007,7 +2014,7 @@ int iterate_extent_inodes(struct btrfs_fs_info *fs_info, | |||
2007 | struct ulist_iterator ref_uiter; | 2014 | struct ulist_iterator ref_uiter; |
2008 | struct ulist_iterator root_uiter; | 2015 | struct ulist_iterator root_uiter; |
2009 | 2016 | ||
2010 | pr_debug("resolving all inodes for extent %llu\n", | 2017 | btrfs_debug(fs_info, "resolving all inodes for extent %llu", |
2011 | extent_item_objectid); | 2018 | extent_item_objectid); |
2012 | 2019 | ||
2013 | if (!search_commit_root) { | 2020 | if (!search_commit_root) { |
@@ -2033,9 +2040,12 @@ int iterate_extent_inodes(struct btrfs_fs_info *fs_info, | |||
2033 | break; | 2040 | break; |
2034 | ULIST_ITER_INIT(&root_uiter); | 2041 | ULIST_ITER_INIT(&root_uiter); |
2035 | while (!ret && (root_node = ulist_next(roots, &root_uiter))) { | 2042 | while (!ret && (root_node = ulist_next(roots, &root_uiter))) { |
2036 | pr_debug("root %llu references leaf %llu, data list %#llx\n", root_node->val, ref_node->val, | 2043 | btrfs_debug(fs_info, |
2037 | ref_node->aux); | 2044 | "root %llu references leaf %llu, data list %#llx", |
2038 | ret = iterate_leaf_refs((struct extent_inode_elem *) | 2045 | root_node->val, ref_node->val, |
2046 | ref_node->aux); | ||
2047 | ret = iterate_leaf_refs(fs_info, | ||
2048 | (struct extent_inode_elem *) | ||
2039 | (uintptr_t)ref_node->aux, | 2049 | (uintptr_t)ref_node->aux, |
2040 | root_node->val, | 2050 | root_node->val, |
2041 | extent_item_objectid, | 2051 | extent_item_objectid, |
@@ -2131,8 +2141,9 @@ static int iterate_inode_refs(u64 inum, struct btrfs_root *fs_root, | |||
2131 | for (cur = 0; cur < btrfs_item_size(eb, item); cur += len) { | 2141 | for (cur = 0; cur < btrfs_item_size(eb, item); cur += len) { |
2132 | name_len = btrfs_inode_ref_name_len(eb, iref); | 2142 | name_len = btrfs_inode_ref_name_len(eb, iref); |
2133 | /* path must be released before calling iterate()! */ | 2143 | /* path must be released before calling iterate()! */ |
2134 | pr_debug("following ref at offset %u for inode %llu in tree %llu\n", cur, found_key.objectid, | 2144 | btrfs_debug(fs_root->fs_info, |
2135 | fs_root->objectid); | 2145 | "following ref at offset %u for inode %llu in tree %llu", |
2146 | cur, found_key.objectid, fs_root->objectid); | ||
2136 | ret = iterate(parent, name_len, | 2147 | ret = iterate(parent, name_len, |
2137 | (unsigned long)(iref + 1), eb, ctx); | 2148 | (unsigned long)(iref + 1), eb, ctx); |
2138 | if (ret) | 2149 | if (ret) |