summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Mahoney <jeffm@suse.com>2016-09-20 10:05:00 -0400
committerDavid Sterba <dsterba@suse.com>2016-09-26 12:08:44 -0400
commit5d163e0e68ce743e1e919ddd3264c96ac02e9026 (patch)
treea5659f205f66740cd7f949a7bff11f283d8b8374
parentcea67ab92d3d4da9f2b4141d87cb8664757daca0 (diff)
btrfs: unsplit printed strings
CodingStyle chapter 2: "[...] never break user-visible strings such as printk messages, because that breaks the ability to grep for them." This patch unsplits user-visible strings. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--fs/btrfs/backref.c15
-rw-r--r--fs/btrfs/check-integrity.c143
-rw-r--r--fs/btrfs/ctree.c10
-rw-r--r--fs/btrfs/delayed-inode.c17
-rw-r--r--fs/btrfs/dev-replace.c19
-rw-r--r--fs/btrfs/dir-item.c7
-rw-r--r--fs/btrfs/disk-io.c6
-rw-r--r--fs/btrfs/extent-tree.c44
-rw-r--r--fs/btrfs/extent_io.c42
-rw-r--r--fs/btrfs/free-space-cache.c13
-rw-r--r--fs/btrfs/free-space-tree.c12
-rw-r--r--fs/btrfs/inode.c10
-rw-r--r--fs/btrfs/ioctl.c14
-rw-r--r--fs/btrfs/ordered-data.c4
-rw-r--r--fs/btrfs/print-tree.c50
-rw-r--r--fs/btrfs/qgroup.c11
-rw-r--r--fs/btrfs/reada.c6
-rw-r--r--fs/btrfs/relocation.c16
-rw-r--r--fs/btrfs/root-tree.c18
-rw-r--r--fs/btrfs/scrub.c58
-rw-r--r--fs/btrfs/send.c14
-rw-r--r--fs/btrfs/super.c42
-rw-r--r--fs/btrfs/sysfs.c6
-rw-r--r--fs/btrfs/transaction.c6
-rw-r--r--fs/btrfs/tree-log.c8
-rw-r--r--fs/btrfs/uuid-tree.c27
-rw-r--r--fs/btrfs/volumes.c97
27 files changed, 324 insertions, 391 deletions
diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
index d9688adc763f..382e90351f14 100644
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
@@ -650,8 +650,7 @@ 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 " 653 pr_debug("search slot in root %llu (level %d, ref count %d) returned %d for key (%llu %u %llu)\n",
654 "%d for key (%llu %u %llu)\n",
655 ref->root_id, level, ref->count, ret, 654 ref->root_id, level, ref->count, ret,
656 ref->key_for_search.objectid, ref->key_for_search.type, 655 ref->key_for_search.objectid, ref->key_for_search.type,
657 ref->key_for_search.offset); 656 ref->key_for_search.offset);
@@ -1846,8 +1845,7 @@ int extent_from_logical(struct btrfs_fs_info *fs_info, u64 logical,
1846 ei = btrfs_item_ptr(eb, path->slots[0], struct btrfs_extent_item); 1845 ei = btrfs_item_ptr(eb, path->slots[0], struct btrfs_extent_item);
1847 flags = btrfs_extent_flags(eb, ei); 1846 flags = btrfs_extent_flags(eb, ei);
1848 1847
1849 pr_debug("logical %llu is at position %llu within the extent (%llu " 1848 pr_debug("logical %llu is at position %llu within the extent (%llu EXTENT_ITEM %llu) flags %#llx size %u\n",
1850 "EXTENT_ITEM %llu) flags %#llx size %u\n",
1851 logical, logical - found_key->objectid, found_key->objectid, 1849 logical, logical - found_key->objectid, found_key->objectid,
1852 found_key->offset, flags, item_size); 1850 found_key->offset, flags, item_size);
1853 1851
@@ -1976,8 +1974,7 @@ static int iterate_leaf_refs(struct extent_inode_elem *inode_list,
1976 int ret = 0; 1974 int ret = 0;
1977 1975
1978 for (eie = inode_list; eie; eie = eie->next) { 1976 for (eie = inode_list; eie; eie = eie->next) {
1979 pr_debug("ref for %llu resolved, key (%llu EXTEND_DATA %llu), " 1977 pr_debug("ref for %llu resolved, key (%llu EXTEND_DATA %llu), root %llu\n", extent_item_objectid,
1980 "root %llu\n", extent_item_objectid,
1981 eie->inum, eie->offset, root); 1978 eie->inum, eie->offset, root);
1982 ret = iterate(eie->inum, eie->offset, root, ctx); 1979 ret = iterate(eie->inum, eie->offset, root, ctx);
1983 if (ret) { 1980 if (ret) {
@@ -2036,8 +2033,7 @@ int iterate_extent_inodes(struct btrfs_fs_info *fs_info,
2036 break; 2033 break;
2037 ULIST_ITER_INIT(&root_uiter); 2034 ULIST_ITER_INIT(&root_uiter);
2038 while (!ret && (root_node = ulist_next(roots, &root_uiter))) { 2035 while (!ret && (root_node = ulist_next(roots, &root_uiter))) {
2039 pr_debug("root %llu references leaf %llu, data list " 2036 pr_debug("root %llu references leaf %llu, data list %#llx\n", root_node->val, ref_node->val,
2040 "%#llx\n", root_node->val, ref_node->val,
2041 ref_node->aux); 2037 ref_node->aux);
2042 ret = iterate_leaf_refs((struct extent_inode_elem *) 2038 ret = iterate_leaf_refs((struct extent_inode_elem *)
2043 (uintptr_t)ref_node->aux, 2039 (uintptr_t)ref_node->aux,
@@ -2135,8 +2131,7 @@ static int iterate_inode_refs(u64 inum, struct btrfs_root *fs_root,
2135 for (cur = 0; cur < btrfs_item_size(eb, item); cur += len) { 2131 for (cur = 0; cur < btrfs_item_size(eb, item); cur += len) {
2136 name_len = btrfs_inode_ref_name_len(eb, iref); 2132 name_len = btrfs_inode_ref_name_len(eb, iref);
2137 /* path must be released before calling iterate()! */ 2133 /* path must be released before calling iterate()! */
2138 pr_debug("following ref at offset %u for inode %llu in " 2134 pr_debug("following ref at offset %u for inode %llu in tree %llu\n", cur, found_key.objectid,
2139 "tree %llu\n", cur, found_key.objectid,
2140 fs_root->objectid); 2135 fs_root->objectid);
2141 ret = iterate(parent, name_len, 2136 ret = iterate(parent, name_len,
2142 (unsigned long)(iref + 1), eb, ctx); 2137 (unsigned long)(iref + 1), eb, ctx);
diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c
index 183c98f58e82..d6a5a6eebd11 100644
--- a/fs/btrfs/check-integrity.c
+++ b/fs/btrfs/check-integrity.c
@@ -733,9 +733,7 @@ static int btrfsic_process_superblock(struct btrfsic_state *state,
733 &tmp_next_block_ctx, 733 &tmp_next_block_ctx,
734 mirror_num); 734 mirror_num);
735 if (ret) { 735 if (ret) {
736 printk(KERN_INFO "btrfsic:" 736 printk(KERN_INFO "btrfsic: btrfsic_map_block(root @%llu, mirror %d) failed!\n",
737 " btrfsic_map_block(root @%llu,"
738 " mirror %d) failed!\n",
739 next_bytenr, mirror_num); 737 next_bytenr, mirror_num);
740 kfree(selected_super); 738 kfree(selected_super);
741 return -1; 739 return -1;
@@ -905,8 +903,7 @@ static int btrfsic_process_superblock_dev_mirror(
905 state->metablock_size, 903 state->metablock_size,
906 &tmp_next_block_ctx, 904 &tmp_next_block_ctx,
907 mirror_num)) { 905 mirror_num)) {
908 printk(KERN_INFO "btrfsic: btrfsic_map_block(" 906 printk(KERN_INFO "btrfsic: btrfsic_map_block(bytenr @%llu, mirror %d) failed!\n",
909 "bytenr @%llu, mirror %d) failed!\n",
910 next_bytenr, mirror_num); 907 next_bytenr, mirror_num);
911 brelse(bh); 908 brelse(bh);
912 return -1; 909 return -1;
@@ -995,8 +992,7 @@ continue_with_new_stack_frame:
995 992
996 if (state->print_mask & BTRFSIC_PRINT_MASK_VERBOSE) 993 if (state->print_mask & BTRFSIC_PRINT_MASK_VERBOSE)
997 printk(KERN_INFO 994 printk(KERN_INFO
998 "leaf %llu items %d generation %llu" 995 "leaf %llu items %d generation %llu owner %llu\n",
999 " owner %llu\n",
1000 sf->block_ctx->start, sf->nr, 996 sf->block_ctx->start, sf->nr,
1001 btrfs_stack_header_generation( 997 btrfs_stack_header_generation(
1002 &leafhdr->header), 998 &leafhdr->header),
@@ -1120,8 +1116,7 @@ leaf_item_out_of_bounce_error:
1120 sf->nr = btrfs_stack_header_nritems(&nodehdr->header); 1116 sf->nr = btrfs_stack_header_nritems(&nodehdr->header);
1121 1117
1122 if (state->print_mask & BTRFSIC_PRINT_MASK_VERBOSE) 1118 if (state->print_mask & BTRFSIC_PRINT_MASK_VERBOSE)
1123 printk(KERN_INFO "node %llu level %d items %d" 1119 printk(KERN_INFO "node %llu level %d items %d generation %llu owner %llu\n",
1124 " generation %llu owner %llu\n",
1125 sf->block_ctx->start, 1120 sf->block_ctx->start,
1126 nodehdr->header.level, sf->nr, 1121 nodehdr->header.level, sf->nr,
1127 btrfs_stack_header_generation( 1122 btrfs_stack_header_generation(
@@ -1457,8 +1452,7 @@ static int btrfsic_handle_extent_data(
1457 generation = btrfs_stack_file_extent_generation(&file_extent_item); 1452 generation = btrfs_stack_file_extent_generation(&file_extent_item);
1458 1453
1459 if (state->print_mask & BTRFSIC_PRINT_MASK_VERY_VERBOSE) 1454 if (state->print_mask & BTRFSIC_PRINT_MASK_VERY_VERBOSE)
1460 printk(KERN_INFO "extent_data: type %u, disk_bytenr = %llu," 1455 printk(KERN_INFO "extent_data: type %u, disk_bytenr = %llu, offset = %llu, num_bytes = %llu\n",
1461 " offset = %llu, num_bytes = %llu\n",
1462 file_extent_item.type, 1456 file_extent_item.type,
1463 btrfs_stack_file_extent_disk_bytenr(&file_extent_item), 1457 btrfs_stack_file_extent_disk_bytenr(&file_extent_item),
1464 btrfs_stack_file_extent_offset(&file_extent_item), 1458 btrfs_stack_file_extent_offset(&file_extent_item),
@@ -1485,8 +1479,7 @@ static int btrfsic_handle_extent_data(
1485 int block_was_created; 1479 int block_was_created;
1486 1480
1487 if (state->print_mask & BTRFSIC_PRINT_MASK_VERBOSE) 1481 if (state->print_mask & BTRFSIC_PRINT_MASK_VERBOSE)
1488 printk(KERN_INFO "btrfsic_handle_extent_data(" 1482 printk(KERN_INFO "btrfsic_handle_extent_data(mirror_num=%d)\n", mirror_num);
1489 "mirror_num=%d)\n", mirror_num);
1490 if (state->print_mask & BTRFSIC_PRINT_MASK_VERY_VERBOSE) 1483 if (state->print_mask & BTRFSIC_PRINT_MASK_VERY_VERBOSE)
1491 printk(KERN_INFO 1484 printk(KERN_INFO
1492 "\tdisk_bytenr = %llu, num_bytes %u\n", 1485 "\tdisk_bytenr = %llu, num_bytes %u\n",
@@ -1496,8 +1489,7 @@ static int btrfsic_handle_extent_data(
1496 mirror_num); 1489 mirror_num);
1497 if (ret) { 1490 if (ret) {
1498 printk(KERN_INFO 1491 printk(KERN_INFO
1499 "btrfsic: btrfsic_map_block(@%llu," 1492 "btrfsic: btrfsic_map_block(@%llu, mirror=%d) failed!\n",
1500 " mirror=%d) failed!\n",
1501 next_bytenr, mirror_num); 1493 next_bytenr, mirror_num);
1502 return -1; 1494 return -1;
1503 } 1495 }
@@ -1524,11 +1516,7 @@ static int btrfsic_handle_extent_data(
1524 !(!next_block->is_metadata && 1516 !(!next_block->is_metadata &&
1525 0 == next_block->logical_bytenr)) { 1517 0 == next_block->logical_bytenr)) {
1526 printk(KERN_INFO 1518 printk(KERN_INFO
1527 "Referenced block" 1519 "Referenced block @%llu (%s/%llu/%d) found in hash table, D, bytenr mismatch (!= stored %llu).\n",
1528 " @%llu (%s/%llu/%d)"
1529 " found in hash table, D,"
1530 " bytenr mismatch"
1531 " (!= stored %llu).\n",
1532 next_bytenr, 1520 next_bytenr,
1533 next_block_ctx.dev->name, 1521 next_block_ctx.dev->name,
1534 next_block_ctx.dev_bytenr, 1522 next_block_ctx.dev_bytenr,
@@ -1725,9 +1713,7 @@ static void btrfsic_dump_database(struct btrfsic_state *state)
1725 b_all->dev_bytenr, b_all->mirror_num); 1713 b_all->dev_bytenr, b_all->mirror_num);
1726 1714
1727 list_for_each_entry(l, &b_all->ref_to_list, node_ref_to) { 1715 list_for_each_entry(l, &b_all->ref_to_list, node_ref_to) {
1728 printk(KERN_INFO " %c @%llu (%s/%llu/%d)" 1716 printk(KERN_INFO " %c @%llu (%s/%llu/%d) refers %u* to %c @%llu (%s/%llu/%d)\n",
1729 " refers %u* to"
1730 " %c @%llu (%s/%llu/%d)\n",
1731 btrfsic_get_block_type(state, b_all), 1717 btrfsic_get_block_type(state, b_all),
1732 b_all->logical_bytenr, b_all->dev_state->name, 1718 b_all->logical_bytenr, b_all->dev_state->name,
1733 b_all->dev_bytenr, b_all->mirror_num, 1719 b_all->dev_bytenr, b_all->mirror_num,
@@ -1740,9 +1726,7 @@ static void btrfsic_dump_database(struct btrfsic_state *state)
1740 } 1726 }
1741 1727
1742 list_for_each_entry(l, &b_all->ref_from_list, node_ref_from) { 1728 list_for_each_entry(l, &b_all->ref_from_list, node_ref_from) {
1743 printk(KERN_INFO " %c @%llu (%s/%llu/%d)" 1729 printk(KERN_INFO " %c @%llu (%s/%llu/%d) is ref %u* from %c @%llu (%s/%llu/%d)\n",
1744 " is ref %u* from"
1745 " %c @%llu (%s/%llu/%d)\n",
1746 btrfsic_get_block_type(state, b_all), 1730 btrfsic_get_block_type(state, b_all),
1747 b_all->logical_bytenr, b_all->dev_state->name, 1731 b_all->logical_bytenr, b_all->dev_state->name,
1748 b_all->dev_bytenr, b_all->mirror_num, 1732 b_all->dev_bytenr, b_all->mirror_num,
@@ -1891,8 +1875,7 @@ again:
1891 bytenr = block->logical_bytenr; 1875 bytenr = block->logical_bytenr;
1892 if (state->print_mask & BTRFSIC_PRINT_MASK_VERBOSE) 1876 if (state->print_mask & BTRFSIC_PRINT_MASK_VERBOSE)
1893 printk(KERN_INFO 1877 printk(KERN_INFO
1894 "Written block @%llu (%s/%llu/%d)" 1878 "Written block @%llu (%s/%llu/%d) found in hash table, %c.\n",
1895 " found in hash table, %c.\n",
1896 bytenr, dev_state->name, dev_bytenr, 1879 bytenr, dev_state->name, dev_bytenr,
1897 block->mirror_num, 1880 block->mirror_num,
1898 btrfsic_get_block_type(state, block)); 1881 btrfsic_get_block_type(state, block));
@@ -1904,12 +1887,7 @@ again:
1904 list_empty(&block->ref_to_list) ? ' ' : '!', 1887 list_empty(&block->ref_to_list) ? ' ' : '!',
1905 list_empty(&block->ref_from_list) ? ' ' : '!'); 1888 list_empty(&block->ref_from_list) ? ' ' : '!');
1906 if (btrfsic_is_block_ref_by_superblock(state, block, 0)) { 1889 if (btrfsic_is_block_ref_by_superblock(state, block, 0)) {
1907 printk(KERN_INFO "btrfs: attempt to overwrite %c-block" 1890 printk(KERN_INFO "btrfs: attempt to overwrite %c-block @%llu (%s/%llu/%d), old(gen=%llu, objectid=%llu, type=%d, offset=%llu), new(gen=%llu), which is referenced by most recent superblock (superblockgen=%llu)!\n",
1908 " @%llu (%s/%llu/%d), old(gen=%llu,"
1909 " objectid=%llu, type=%d, offset=%llu),"
1910 " new(gen=%llu),"
1911 " which is referenced by most recent superblock"
1912 " (superblockgen=%llu)!\n",
1913 btrfsic_get_block_type(state, block), bytenr, 1891 btrfsic_get_block_type(state, block), bytenr,
1914 dev_state->name, dev_bytenr, block->mirror_num, 1892 dev_state->name, dev_bytenr, block->mirror_num,
1915 block->generation, 1893 block->generation,
@@ -1923,9 +1901,7 @@ again:
1923 } 1901 }
1924 1902
1925 if (!block->is_iodone && !block->never_written) { 1903 if (!block->is_iodone && !block->never_written) {
1926 printk(KERN_INFO "btrfs: attempt to overwrite %c-block" 1904 printk(KERN_INFO "btrfs: attempt to overwrite %c-block @%llu (%s/%llu/%d), oldgen=%llu, newgen=%llu, which is not yet iodone!\n",
1927 " @%llu (%s/%llu/%d), oldgen=%llu, newgen=%llu,"
1928 " which is not yet iodone!\n",
1929 btrfsic_get_block_type(state, block), bytenr, 1905 btrfsic_get_block_type(state, block), bytenr,
1930 dev_state->name, dev_bytenr, block->mirror_num, 1906 dev_state->name, dev_bytenr, block->mirror_num,
1931 block->generation, 1907 block->generation,
@@ -2037,8 +2013,7 @@ again:
2037 } 2013 }
2038 if (ret) 2014 if (ret)
2039 printk(KERN_INFO 2015 printk(KERN_INFO
2040 "btrfsic: btrfsic_process_metablock" 2016 "btrfsic: btrfsic_process_metablock(root @%llu) failed!\n",
2041 "(root @%llu) failed!\n",
2042 dev_bytenr); 2017 dev_bytenr);
2043 } else { 2018 } else {
2044 block->is_metadata = 0; 2019 block->is_metadata = 0;
@@ -2065,8 +2040,7 @@ again:
2065 if (!is_metadata) { 2040 if (!is_metadata) {
2066 processed_len = state->datablock_size; 2041 processed_len = state->datablock_size;
2067 if (state->print_mask & BTRFSIC_PRINT_MASK_VERBOSE) 2042 if (state->print_mask & BTRFSIC_PRINT_MASK_VERBOSE)
2068 printk(KERN_INFO "Written block (%s/%llu/?)" 2043 printk(KERN_INFO "Written block (%s/%llu/?) !found in hash table, D.\n",
2069 " !found in hash table, D.\n",
2070 dev_state->name, dev_bytenr); 2044 dev_state->name, dev_bytenr);
2071 if (!state->include_extent_data) { 2045 if (!state->include_extent_data) {
2072 /* ignore that written D block */ 2046 /* ignore that written D block */
@@ -2085,8 +2059,7 @@ again:
2085 dev_bytenr); 2059 dev_bytenr);
2086 if (state->print_mask & BTRFSIC_PRINT_MASK_VERBOSE) 2060 if (state->print_mask & BTRFSIC_PRINT_MASK_VERBOSE)
2087 printk(KERN_INFO 2061 printk(KERN_INFO
2088 "Written block @%llu (%s/%llu/?)" 2062 "Written block @%llu (%s/%llu/?) !found in hash table, M.\n",
2089 " !found in hash table, M.\n",
2090 bytenr, dev_state->name, dev_bytenr); 2063 bytenr, dev_state->name, dev_bytenr);
2091 } 2064 }
2092 2065
@@ -2163,8 +2136,7 @@ again:
2163 &block_ctx, 0, 0); 2136 &block_ctx, 0, 0);
2164 if (ret) 2137 if (ret)
2165 printk(KERN_INFO 2138 printk(KERN_INFO
2166 "btrfsic: process_metablock(root @%llu)" 2139 "btrfsic: process_metablock(root @%llu) failed!\n",
2167 " failed!\n",
2168 dev_bytenr); 2140 dev_bytenr);
2169 } 2141 }
2170 btrfsic_release_block_ctx(&block_ctx); 2142 btrfsic_release_block_ctx(&block_ctx);
@@ -2272,8 +2244,7 @@ static int btrfsic_process_written_superblock(
2272 0 == state->max_superblock_generation)) { 2244 0 == state->max_superblock_generation)) {
2273 if (state->print_mask & BTRFSIC_PRINT_MASK_SUPERBLOCK_WRITE) 2245 if (state->print_mask & BTRFSIC_PRINT_MASK_SUPERBLOCK_WRITE)
2274 printk(KERN_INFO 2246 printk(KERN_INFO
2275 "btrfsic: superblock @%llu (%s/%llu/%d)" 2247 "btrfsic: superblock @%llu (%s/%llu/%d) with old gen %llu <= %llu\n",
2276 " with old gen %llu <= %llu\n",
2277 superblock->logical_bytenr, 2248 superblock->logical_bytenr,
2278 superblock->dev_state->name, 2249 superblock->dev_state->name,
2279 superblock->dev_bytenr, superblock->mirror_num, 2250 superblock->dev_bytenr, superblock->mirror_num,
@@ -2282,8 +2253,7 @@ static int btrfsic_process_written_superblock(
2282 } else { 2253 } else {
2283 if (state->print_mask & BTRFSIC_PRINT_MASK_SUPERBLOCK_WRITE) 2254 if (state->print_mask & BTRFSIC_PRINT_MASK_SUPERBLOCK_WRITE)
2284 printk(KERN_INFO 2255 printk(KERN_INFO
2285 "btrfsic: got new superblock @%llu (%s/%llu/%d)" 2256 "btrfsic: got new superblock @%llu (%s/%llu/%d) with new gen %llu > %llu\n",
2286 " with new gen %llu > %llu\n",
2287 superblock->logical_bytenr, 2257 superblock->logical_bytenr,
2288 superblock->dev_state->name, 2258 superblock->dev_state->name,
2289 superblock->dev_bytenr, superblock->mirror_num, 2259 superblock->dev_bytenr, superblock->mirror_num,
@@ -2353,16 +2323,14 @@ static int btrfsic_process_written_superblock(
2353 2323
2354 if (state->print_mask & BTRFSIC_PRINT_MASK_VERBOSE) 2324 if (state->print_mask & BTRFSIC_PRINT_MASK_VERBOSE)
2355 printk(KERN_INFO 2325 printk(KERN_INFO
2356 "btrfsic_process_written_superblock(" 2326 "btrfsic_process_written_superblock(mirror_num=%d)\n", mirror_num);
2357 "mirror_num=%d)\n", mirror_num);
2358 ret = btrfsic_map_block(state, next_bytenr, 2327 ret = btrfsic_map_block(state, next_bytenr,
2359 BTRFS_SUPER_INFO_SIZE, 2328 BTRFS_SUPER_INFO_SIZE,
2360 &tmp_next_block_ctx, 2329 &tmp_next_block_ctx,
2361 mirror_num); 2330 mirror_num);
2362 if (ret) { 2331 if (ret) {
2363 printk(KERN_INFO 2332 printk(KERN_INFO
2364 "btrfsic: btrfsic_map_block(@%llu," 2333 "btrfsic: btrfsic_map_block(@%llu, mirror=%d) failed!\n",
2365 " mirror=%d) failed!\n",
2366 next_bytenr, mirror_num); 2334 next_bytenr, mirror_num);
2367 return -1; 2335 return -1;
2368 } 2336 }
@@ -2438,8 +2406,7 @@ static int btrfsic_check_all_ref_blocks(struct btrfsic_state *state,
2438 list_for_each_entry(l, &block->ref_to_list, node_ref_to) { 2406 list_for_each_entry(l, &block->ref_to_list, node_ref_to) {
2439 if (state->print_mask & BTRFSIC_PRINT_MASK_VERBOSE) 2407 if (state->print_mask & BTRFSIC_PRINT_MASK_VERBOSE)
2440 printk(KERN_INFO 2408 printk(KERN_INFO
2441 "rl=%d, %c @%llu (%s/%llu/%d)" 2409 "rl=%d, %c @%llu (%s/%llu/%d) %u* refers to %c @%llu (%s/%llu/%d)\n",
2442 " %u* refers to %c @%llu (%s/%llu/%d)\n",
2443 recursion_level, 2410 recursion_level,
2444 btrfsic_get_block_type(state, block), 2411 btrfsic_get_block_type(state, block),
2445 block->logical_bytenr, block->dev_state->name, 2412 block->logical_bytenr, block->dev_state->name,
@@ -2451,9 +2418,7 @@ static int btrfsic_check_all_ref_blocks(struct btrfsic_state *state,
2451 l->block_ref_to->dev_bytenr, 2418 l->block_ref_to->dev_bytenr,
2452 l->block_ref_to->mirror_num); 2419 l->block_ref_to->mirror_num);
2453 if (l->block_ref_to->never_written) { 2420 if (l->block_ref_to->never_written) {
2454 printk(KERN_INFO "btrfs: attempt to write superblock" 2421 printk(KERN_INFO "btrfs: attempt to write superblock which references block %c @%llu (%s/%llu/%d) which is never written!\n",
2455 " which references block %c @%llu (%s/%llu/%d)"
2456 " which is never written!\n",
2457 btrfsic_get_block_type(state, l->block_ref_to), 2422 btrfsic_get_block_type(state, l->block_ref_to),
2458 l->block_ref_to->logical_bytenr, 2423 l->block_ref_to->logical_bytenr,
2459 l->block_ref_to->dev_state->name, 2424 l->block_ref_to->dev_state->name,
@@ -2461,9 +2426,7 @@ static int btrfsic_check_all_ref_blocks(struct btrfsic_state *state,
2461 l->block_ref_to->mirror_num); 2426 l->block_ref_to->mirror_num);
2462 ret = -1; 2427 ret = -1;
2463 } else if (!l->block_ref_to->is_iodone) { 2428 } else if (!l->block_ref_to->is_iodone) {
2464 printk(KERN_INFO "btrfs: attempt to write superblock" 2429 printk(KERN_INFO "btrfs: attempt to write superblock which references block %c @%llu (%s/%llu/%d) which is not yet iodone!\n",
2465 " which references block %c @%llu (%s/%llu/%d)"
2466 " which is not yet iodone!\n",
2467 btrfsic_get_block_type(state, l->block_ref_to), 2430 btrfsic_get_block_type(state, l->block_ref_to),
2468 l->block_ref_to->logical_bytenr, 2431 l->block_ref_to->logical_bytenr,
2469 l->block_ref_to->dev_state->name, 2432 l->block_ref_to->dev_state->name,
@@ -2471,9 +2434,7 @@ static int btrfsic_check_all_ref_blocks(struct btrfsic_state *state,
2471 l->block_ref_to->mirror_num); 2434 l->block_ref_to->mirror_num);
2472 ret = -1; 2435 ret = -1;
2473 } else if (l->block_ref_to->iodone_w_error) { 2436 } else if (l->block_ref_to->iodone_w_error) {
2474 printk(KERN_INFO "btrfs: attempt to write superblock" 2437 printk(KERN_INFO "btrfs: attempt to write superblock which references block %c @%llu (%s/%llu/%d) which has write error!\n",
2475 " which references block %c @%llu (%s/%llu/%d)"
2476 " which has write error!\n",
2477 btrfsic_get_block_type(state, l->block_ref_to), 2438 btrfsic_get_block_type(state, l->block_ref_to),
2478 l->block_ref_to->logical_bytenr, 2439 l->block_ref_to->logical_bytenr,
2479 l->block_ref_to->dev_state->name, 2440 l->block_ref_to->dev_state->name,
@@ -2486,10 +2447,7 @@ static int btrfsic_check_all_ref_blocks(struct btrfsic_state *state,
2486 l->parent_generation && 2447 l->parent_generation &&
2487 BTRFSIC_GENERATION_UNKNOWN != 2448 BTRFSIC_GENERATION_UNKNOWN !=
2488 l->block_ref_to->generation) { 2449 l->block_ref_to->generation) {
2489 printk(KERN_INFO "btrfs: attempt to write superblock" 2450 printk(KERN_INFO "btrfs: attempt to write superblock which references block %c @%llu (%s/%llu/%d) with generation %llu != parent generation %llu!\n",
2490 " which references block %c @%llu (%s/%llu/%d)"
2491 " with generation %llu !="
2492 " parent generation %llu!\n",
2493 btrfsic_get_block_type(state, l->block_ref_to), 2451 btrfsic_get_block_type(state, l->block_ref_to),
2494 l->block_ref_to->logical_bytenr, 2452 l->block_ref_to->logical_bytenr,
2495 l->block_ref_to->dev_state->name, 2453 l->block_ref_to->dev_state->name,
@@ -2500,11 +2458,7 @@ static int btrfsic_check_all_ref_blocks(struct btrfsic_state *state,
2500 ret = -1; 2458 ret = -1;
2501 } else if (l->block_ref_to->flush_gen > 2459 } else if (l->block_ref_to->flush_gen >
2502 l->block_ref_to->dev_state->last_flush_gen) { 2460 l->block_ref_to->dev_state->last_flush_gen) {
2503 printk(KERN_INFO "btrfs: attempt to write superblock" 2461 printk(KERN_INFO "btrfs: attempt to write superblock which references block %c @%llu (%s/%llu/%d) which is not flushed out of disk's write cache (block flush_gen=%llu, dev->flush_gen=%llu)!\n",
2504 " which references block %c @%llu (%s/%llu/%d)"
2505 " which is not flushed out of disk's write cache"
2506 " (block flush_gen=%llu,"
2507 " dev->flush_gen=%llu)!\n",
2508 btrfsic_get_block_type(state, l->block_ref_to), 2462 btrfsic_get_block_type(state, l->block_ref_to),
2509 l->block_ref_to->logical_bytenr, 2463 l->block_ref_to->logical_bytenr,
2510 l->block_ref_to->dev_state->name, 2464 l->block_ref_to->dev_state->name,
@@ -2546,8 +2500,7 @@ static int btrfsic_is_block_ref_by_superblock(
2546 list_for_each_entry(l, &block->ref_from_list, node_ref_from) { 2500 list_for_each_entry(l, &block->ref_from_list, node_ref_from) {
2547 if (state->print_mask & BTRFSIC_PRINT_MASK_VERBOSE) 2501 if (state->print_mask & BTRFSIC_PRINT_MASK_VERBOSE)
2548 printk(KERN_INFO 2502 printk(KERN_INFO
2549 "rl=%d, %c @%llu (%s/%llu/%d)" 2503 "rl=%d, %c @%llu (%s/%llu/%d) is ref %u* from %c @%llu (%s/%llu/%d)\n",
2550 " is ref %u* from %c @%llu (%s/%llu/%d)\n",
2551 recursion_level, 2504 recursion_level,
2552 btrfsic_get_block_type(state, block), 2505 btrfsic_get_block_type(state, block),
2553 block->logical_bytenr, block->dev_state->name, 2506 block->logical_bytenr, block->dev_state->name,
@@ -2578,8 +2531,7 @@ static void btrfsic_print_add_link(const struct btrfsic_state *state,
2578 const struct btrfsic_block_link *l) 2531 const struct btrfsic_block_link *l)
2579{ 2532{
2580 printk(KERN_INFO 2533 printk(KERN_INFO
2581 "Add %u* link from %c @%llu (%s/%llu/%d)" 2534 "Add %u* link from %c @%llu (%s/%llu/%d) to %c @%llu (%s/%llu/%d).\n",
2582 " to %c @%llu (%s/%llu/%d).\n",
2583 l->ref_cnt, 2535 l->ref_cnt,
2584 btrfsic_get_block_type(state, l->block_ref_from), 2536 btrfsic_get_block_type(state, l->block_ref_from),
2585 l->block_ref_from->logical_bytenr, 2537 l->block_ref_from->logical_bytenr,
@@ -2595,8 +2547,7 @@ static void btrfsic_print_rem_link(const struct btrfsic_state *state,
2595 const struct btrfsic_block_link *l) 2547 const struct btrfsic_block_link *l)
2596{ 2548{
2597 printk(KERN_INFO 2549 printk(KERN_INFO
2598 "Rem %u* link from %c @%llu (%s/%llu/%d)" 2550 "Rem %u* link from %c @%llu (%s/%llu/%d) to %c @%llu (%s/%llu/%d).\n",
2599 " to %c @%llu (%s/%llu/%d).\n",
2600 l->ref_cnt, 2551 l->ref_cnt,
2601 btrfsic_get_block_type(state, l->block_ref_from), 2552 btrfsic_get_block_type(state, l->block_ref_from),
2602 l->block_ref_from->logical_bytenr, 2553 l->block_ref_from->logical_bytenr,
@@ -2709,7 +2660,7 @@ static struct btrfsic_block_link *btrfsic_block_link_lookup_or_add(
2709 l = btrfsic_block_link_alloc(); 2660 l = btrfsic_block_link_alloc();
2710 if (NULL == l) { 2661 if (NULL == l) {
2711 printk(KERN_INFO 2662 printk(KERN_INFO
2712 "btrfsic: error, kmalloc" " failed!\n"); 2663 "btrfsic: error, kmalloc failed!\n");
2713 return NULL; 2664 return NULL;
2714 } 2665 }
2715 2666
@@ -2810,9 +2761,7 @@ static void btrfsic_cmp_log_and_dev_bytenr(struct btrfsic_state *state,
2810 ret = btrfsic_map_block(state, bytenr, state->metablock_size, 2761 ret = btrfsic_map_block(state, bytenr, state->metablock_size,
2811 &block_ctx, mirror_num); 2762 &block_ctx, mirror_num);
2812 if (ret) { 2763 if (ret) {
2813 printk(KERN_INFO "btrfsic:" 2764 printk(KERN_INFO "btrfsic: btrfsic_map_block(logical @%llu, mirror %d) failed!\n",
2814 " btrfsic_map_block(logical @%llu,"
2815 " mirror %d) failed!\n",
2816 bytenr, mirror_num); 2765 bytenr, mirror_num);
2817 continue; 2766 continue;
2818 } 2767 }
@@ -2827,9 +2776,7 @@ static void btrfsic_cmp_log_and_dev_bytenr(struct btrfsic_state *state,
2827 } 2776 }
2828 2777
2829 if (WARN_ON(!match)) { 2778 if (WARN_ON(!match)) {
2830 printk(KERN_INFO "btrfs: attempt to write M-block which contains logical bytenr that doesn't map to dev+physical bytenr of submit_bio," 2779 printk(KERN_INFO "btrfs: attempt to write M-block which contains logical bytenr that doesn't map to dev+physical bytenr of submit_bio, buffer->log_bytenr=%llu, submit_bio(bdev=%s, phys_bytenr=%llu)!\n",
2831 " buffer->log_bytenr=%llu, submit_bio(bdev=%s,"
2832 " phys_bytenr=%llu)!\n",
2833 bytenr, dev_state->name, dev_bytenr); 2780 bytenr, dev_state->name, dev_bytenr);
2834 for (mirror_num = 1; mirror_num <= num_copies; mirror_num++) { 2781 for (mirror_num = 1; mirror_num <= num_copies; mirror_num++) {
2835 ret = btrfsic_map_block(state, bytenr, 2782 ret = btrfsic_map_block(state, bytenr,
@@ -2838,8 +2785,7 @@ static void btrfsic_cmp_log_and_dev_bytenr(struct btrfsic_state *state,
2838 if (ret) 2785 if (ret)
2839 continue; 2786 continue;
2840 2787
2841 printk(KERN_INFO "Read logical bytenr @%llu maps to" 2788 printk(KERN_INFO "Read logical bytenr @%llu maps to (%s/%llu/%d)\n",
2842 " (%s/%llu/%d)\n",
2843 bytenr, block_ctx.dev->name, 2789 bytenr, block_ctx.dev->name,
2844 block_ctx.dev_bytenr, mirror_num); 2790 block_ctx.dev_bytenr, mirror_num);
2845 } 2791 }
@@ -2874,8 +2820,7 @@ int btrfsic_submit_bh(int op, int op_flags, struct buffer_head *bh)
2874 if (dev_state->state->print_mask & 2820 if (dev_state->state->print_mask &
2875 BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH) 2821 BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH)
2876 printk(KERN_INFO 2822 printk(KERN_INFO
2877 "submit_bh(op=0x%x,0x%x, blocknr=%llu " 2823 "submit_bh(op=0x%x,0x%x, blocknr=%llu (bytenr %llu), size=%zu, data=%p, bdev=%p)\n",
2878 "(bytenr %llu), size=%zu, data=%p, bdev=%p)\n",
2879 op, op_flags, (unsigned long long)bh->b_blocknr, 2824 op, op_flags, (unsigned long long)bh->b_blocknr,
2880 dev_bytenr, bh->b_size, bh->b_data, bh->b_bdev); 2825 dev_bytenr, bh->b_size, bh->b_data, bh->b_bdev);
2881 btrfsic_process_written_block(dev_state, dev_bytenr, 2826 btrfsic_process_written_block(dev_state, dev_bytenr,
@@ -2892,9 +2837,7 @@ int btrfsic_submit_bh(int op, int op_flags, struct buffer_head *bh)
2892 (BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH | 2837 (BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH |
2893 BTRFSIC_PRINT_MASK_VERBOSE))) 2838 BTRFSIC_PRINT_MASK_VERBOSE)))
2894 printk(KERN_INFO 2839 printk(KERN_INFO
2895 "btrfsic_submit_bh(%s) with FLUSH" 2840 "btrfsic_submit_bh(%s) with FLUSH but dummy block already in use (ignored)!\n",
2896 " but dummy block already in use"
2897 " (ignored)!\n",
2898 dev_state->name); 2841 dev_state->name);
2899 } else { 2842 } else {
2900 struct btrfsic_block *const block = 2843 struct btrfsic_block *const block =
@@ -2940,8 +2883,7 @@ static void __btrfsic_submit_bio(struct bio *bio)
2940 if (dev_state->state->print_mask & 2883 if (dev_state->state->print_mask &
2941 BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH) 2884 BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH)
2942 printk(KERN_INFO 2885 printk(KERN_INFO
2943 "submit_bio(rw=%d,0x%x, bi_vcnt=%u," 2886 "submit_bio(rw=%d,0x%x, bi_vcnt=%u, bi_sector=%llu (bytenr %llu), bi_bdev=%p)\n",
2944 " bi_sector=%llu (bytenr %llu), bi_bdev=%p)\n",
2945 bio_op(bio), bio->bi_opf, bio->bi_vcnt, 2887 bio_op(bio), bio->bi_opf, bio->bi_vcnt,
2946 (unsigned long long)bio->bi_iter.bi_sector, 2888 (unsigned long long)bio->bi_iter.bi_sector,
2947 dev_bytenr, bio->bi_bdev); 2889 dev_bytenr, bio->bi_bdev);
@@ -2990,9 +2932,7 @@ static void __btrfsic_submit_bio(struct bio *bio)
2990 (BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH | 2932 (BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH |
2991 BTRFSIC_PRINT_MASK_VERBOSE))) 2933 BTRFSIC_PRINT_MASK_VERBOSE)))
2992 printk(KERN_INFO 2934 printk(KERN_INFO
2993 "btrfsic_submit_bio(%s) with FLUSH" 2935 "btrfsic_submit_bio(%s) with FLUSH but dummy block already in use (ignored)!\n",
2994 " but dummy block already in use"
2995 " (ignored)!\n",
2996 dev_state->name); 2936 dev_state->name);
2997 } else { 2937 } else {
2998 struct btrfsic_block *const block = 2938 struct btrfsic_block *const block =
@@ -3146,8 +3086,7 @@ void btrfsic_unmount(struct btrfs_root *root,
3146 3086
3147 if (NULL == state) { 3087 if (NULL == state) {
3148 printk(KERN_INFO 3088 printk(KERN_INFO
3149 "btrfsic: error, cannot find state information" 3089 "btrfsic: error, cannot find state information on umount!\n");
3150 " on umount!\n");
3151 mutex_unlock(&btrfsic_mutex); 3090 mutex_unlock(&btrfsic_mutex);
3152 return; 3091 return;
3153 } 3092 }
@@ -3174,9 +3113,7 @@ void btrfsic_unmount(struct btrfs_root *root,
3174 if (b_all->is_iodone || b_all->never_written) 3113 if (b_all->is_iodone || b_all->never_written)
3175 btrfsic_block_free(b_all); 3114 btrfsic_block_free(b_all);
3176 else 3115 else
3177 printk(KERN_INFO "btrfs: attempt to free %c-block" 3116 printk(KERN_INFO "btrfs: attempt to free %c-block @%llu (%s/%llu/%d) on umount which is not yet iodone!\n",
3178 " @%llu (%s/%llu/%d) on umount which is"
3179 " not yet iodone!\n",
3180 btrfsic_get_block_type(state, b_all), 3117 btrfsic_get_block_type(state, b_all),
3181 b_all->logical_bytenr, b_all->dev_state->name, 3118 b_all->logical_bytenr, b_all->dev_state->name,
3182 b_all->dev_bytenr, b_all->mirror_num); 3119 b_all->dev_bytenr, b_all->mirror_num);
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 494e6b17bebd..0da812cd1a95 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -4768,8 +4768,9 @@ void setup_items_for_insert(struct btrfs_root *root, struct btrfs_path *path,
4768 4768
4769 if (btrfs_leaf_free_space(root, leaf) < total_size) { 4769 if (btrfs_leaf_free_space(root, leaf) < total_size) {
4770 btrfs_print_leaf(root, leaf); 4770 btrfs_print_leaf(root, leaf);
4771 btrfs_crit(root->fs_info, "not enough freespace need %u have %d", 4771 btrfs_crit(root->fs_info,
4772 total_size, btrfs_leaf_free_space(root, leaf)); 4772 "not enough freespace need %u have %d",
4773 total_size, btrfs_leaf_free_space(root, leaf));
4773 BUG(); 4774 BUG();
4774 } 4775 }
4775 4776
@@ -4778,8 +4779,9 @@ void setup_items_for_insert(struct btrfs_root *root, struct btrfs_path *path,
4778 4779
4779 if (old_data < data_end) { 4780 if (old_data < data_end) {
4780 btrfs_print_leaf(root, leaf); 4781 btrfs_print_leaf(root, leaf);
4781 btrfs_crit(root->fs_info, "slot %d old_data %d data_end %d", 4782 btrfs_crit(root->fs_info,
4782 slot, old_data, data_end); 4783 "slot %d old_data %d data_end %d",
4784 slot, old_data, data_end);
4783 BUG_ON(1); 4785 BUG_ON(1);
4784 } 4786 }
4785 /* 4787 /*
diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c
index 143f551f688c..0fcf5f25d524 100644
--- a/fs/btrfs/delayed-inode.c
+++ b/fs/btrfs/delayed-inode.c
@@ -1478,11 +1478,10 @@ int btrfs_insert_delayed_dir_index(struct btrfs_trans_handle *trans,
1478 mutex_lock(&delayed_node->mutex); 1478 mutex_lock(&delayed_node->mutex);
1479 ret = __btrfs_add_delayed_insertion_item(delayed_node, delayed_item); 1479 ret = __btrfs_add_delayed_insertion_item(delayed_node, delayed_item);
1480 if (unlikely(ret)) { 1480 if (unlikely(ret)) {
1481 btrfs_err(root->fs_info, "err add delayed dir index item(name: %.*s) " 1481 btrfs_err(root->fs_info,
1482 "into the insertion tree of the delayed node" 1482 "err add delayed dir index item(name: %.*s) into the insertion tree of the delayed node(root id: %llu, inode id: %llu, errno: %d)",
1483 "(root id: %llu, inode id: %llu, errno: %d)", 1483 name_len, name, delayed_node->root->objectid,
1484 name_len, name, delayed_node->root->objectid, 1484 delayed_node->inode_id, ret);
1485 delayed_node->inode_id, ret);
1486 BUG(); 1485 BUG();
1487 } 1486 }
1488 mutex_unlock(&delayed_node->mutex); 1487 mutex_unlock(&delayed_node->mutex);
@@ -1550,11 +1549,9 @@ int btrfs_delete_delayed_dir_index(struct btrfs_trans_handle *trans,
1550 mutex_lock(&node->mutex); 1549 mutex_lock(&node->mutex);
1551 ret = __btrfs_add_delayed_deletion_item(node, item); 1550 ret = __btrfs_add_delayed_deletion_item(node, item);
1552 if (unlikely(ret)) { 1551 if (unlikely(ret)) {
1553 btrfs_err(root->fs_info, "err add delayed dir index item(index: %llu) " 1552 btrfs_err(root->fs_info,
1554 "into the deletion tree of the delayed node" 1553 "err add delayed dir index item(index: %llu) into the deletion tree of the delayed node(root id: %llu, inode id: %llu, errno: %d)",
1555 "(root id: %llu, inode id: %llu, errno: %d)", 1554 index, node->root->objectid, node->inode_id, ret);
1556 index, node->root->objectid, node->inode_id,
1557 ret);
1558 BUG(); 1555 BUG();
1559 } 1556 }
1560 mutex_unlock(&node->mutex); 1557 mutex_unlock(&node->mutex);
diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
index e9bbff3c0029..26c6a770674a 100644
--- a/fs/btrfs/dev-replace.c
+++ b/fs/btrfs/dev-replace.c
@@ -218,8 +218,9 @@ int btrfs_run_dev_replace(struct btrfs_trans_handle *trans,
218 } 218 }
219 ret = btrfs_search_slot(trans, dev_root, &key, path, -1, 1); 219 ret = btrfs_search_slot(trans, dev_root, &key, path, -1, 1);
220 if (ret < 0) { 220 if (ret < 0) {
221 btrfs_warn(fs_info, "error %d while searching for dev_replace item!", 221 btrfs_warn(fs_info,
222 ret); 222 "error %d while searching for dev_replace item!",
223 ret);
223 goto out; 224 goto out;
224 } 225 }
225 226
@@ -238,8 +239,9 @@ int btrfs_run_dev_replace(struct btrfs_trans_handle *trans,
238 */ 239 */
239 ret = btrfs_del_item(trans, dev_root, path); 240 ret = btrfs_del_item(trans, dev_root, path);
240 if (ret != 0) { 241 if (ret != 0) {
241 btrfs_warn(fs_info, "delete too small dev_replace item failed %d!", 242 btrfs_warn(fs_info,
242 ret); 243 "delete too small dev_replace item failed %d!",
244 ret);
243 goto out; 245 goto out;
244 } 246 }
245 ret = 1; 247 ret = 1;
@@ -251,8 +253,8 @@ int btrfs_run_dev_replace(struct btrfs_trans_handle *trans,
251 ret = btrfs_insert_empty_item(trans, dev_root, path, 253 ret = btrfs_insert_empty_item(trans, dev_root, path,
252 &key, sizeof(*ptr)); 254 &key, sizeof(*ptr));
253 if (ret < 0) { 255 if (ret < 0) {
254 btrfs_warn(fs_info, "insert dev_replace item failed %d!", 256 btrfs_warn(fs_info,
255 ret); 257 "insert dev_replace item failed %d!", ret);
256 goto out; 258 goto out;
257 } 259 }
258 } 260 }
@@ -772,9 +774,10 @@ int btrfs_resume_dev_replace_async(struct btrfs_fs_info *fs_info)
772 break; 774 break;
773 } 775 }
774 if (!dev_replace->tgtdev || !dev_replace->tgtdev->bdev) { 776 if (!dev_replace->tgtdev || !dev_replace->tgtdev->bdev) {
775 btrfs_info(fs_info, "cannot continue dev_replace, tgtdev is missing");
776 btrfs_info(fs_info, 777 btrfs_info(fs_info,
777 "you may cancel the operation after 'mount -o degraded'"); 778 "cannot continue dev_replace, tgtdev is missing");
779 btrfs_info(fs_info,
780 "you may cancel the operation after 'mount -o degraded'");
778 btrfs_dev_replace_unlock(dev_replace, 1); 781 btrfs_dev_replace_unlock(dev_replace, 1);
779 return 0; 782 return 0;
780 } 783 }
diff --git a/fs/btrfs/dir-item.c b/fs/btrfs/dir-item.c
index 1752625fb4dd..0dc1a033275e 100644
--- a/fs/btrfs/dir-item.c
+++ b/fs/btrfs/dir-item.c
@@ -472,9 +472,10 @@ int verify_dir_item(struct btrfs_root *root,
472 /* BTRFS_MAX_XATTR_SIZE is the same for all dir items */ 472 /* BTRFS_MAX_XATTR_SIZE is the same for all dir items */
473 if ((btrfs_dir_data_len(leaf, dir_item) + 473 if ((btrfs_dir_data_len(leaf, dir_item) +
474 btrfs_dir_name_len(leaf, dir_item)) > BTRFS_MAX_XATTR_SIZE(root)) { 474 btrfs_dir_name_len(leaf, dir_item)) > BTRFS_MAX_XATTR_SIZE(root)) {
475 btrfs_crit(root->fs_info, "invalid dir item name + data len: %u + %u", 475 btrfs_crit(root->fs_info,
476 (unsigned)btrfs_dir_name_len(leaf, dir_item), 476 "invalid dir item name + data len: %u + %u",
477 (unsigned)btrfs_dir_data_len(leaf, dir_item)); 477 (unsigned)btrfs_dir_name_len(leaf, dir_item),
478 (unsigned)btrfs_dir_data_len(leaf, dir_item));
478 return 1; 479 return 1;
479 } 480 }
480 481
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 92dd26eef7ab..9e91b8b238f7 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -326,8 +326,7 @@ static int csum_tree_block(struct btrfs_fs_info *fs_info,
326 326
327 read_extent_buffer(buf, &val, 0, csum_size); 327 read_extent_buffer(buf, &val, 0, csum_size);
328 btrfs_warn_rl(fs_info, 328 btrfs_warn_rl(fs_info,
329 "%s checksum verify failed on %llu wanted %X found %X " 329 "%s checksum verify failed on %llu wanted %X found %X level %d",
330 "level %d",
331 fs_info->sb->s_id, buf->start, 330 fs_info->sb->s_id, buf->start,
332 val, found, btrfs_header_level(buf)); 331 val, found, btrfs_header_level(buf));
333 if (result != (char *)&inline_result) 332 if (result != (char *)&inline_result)
@@ -4052,8 +4051,7 @@ void btrfs_mark_buffer_dirty(struct extent_buffer *buf)
4052 root = BTRFS_I(buf->pages[0]->mapping->host)->root; 4051 root = BTRFS_I(buf->pages[0]->mapping->host)->root;
4053 btrfs_assert_tree_locked(buf); 4052 btrfs_assert_tree_locked(buf);
4054 if (transid != root->fs_info->generation) 4053 if (transid != root->fs_info->generation)
4055 WARN(1, KERN_CRIT "btrfs transid mismatch buffer %llu, " 4054 WARN(1, KERN_CRIT "btrfs transid mismatch buffer %llu, found %llu running %llu\n",
4056 "found %llu running %llu\n",
4057 buf->start, transid, root->fs_info->generation); 4055 buf->start, transid, root->fs_info->generation);
4058 was_dirty = set_extent_buffer_dirty(buf); 4056 was_dirty = set_extent_buffer_dirty(buf);
4059 if (!was_dirty) 4057 if (!was_dirty)
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 3d3b193a396c..1e5b39c218a9 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -2588,7 +2588,9 @@ static noinline int __btrfs_run_delayed_refs(struct btrfs_trans_handle *trans,
2588 if (must_insert_reserved) 2588 if (must_insert_reserved)
2589 locked_ref->must_insert_reserved = 1; 2589 locked_ref->must_insert_reserved = 1;
2590 locked_ref->processing = 0; 2590 locked_ref->processing = 0;
2591 btrfs_debug(fs_info, "run_delayed_extent_op returned %d", ret); 2591 btrfs_debug(fs_info,
2592 "run_delayed_extent_op returned %d",
2593 ret);
2592 btrfs_delayed_ref_unlock(locked_ref); 2594 btrfs_delayed_ref_unlock(locked_ref);
2593 return ret; 2595 return ret;
2594 } 2596 }
@@ -2648,7 +2650,8 @@ static noinline int __btrfs_run_delayed_refs(struct btrfs_trans_handle *trans,
2648 locked_ref->processing = 0; 2650 locked_ref->processing = 0;
2649 btrfs_delayed_ref_unlock(locked_ref); 2651 btrfs_delayed_ref_unlock(locked_ref);
2650 btrfs_put_delayed_ref(ref); 2652 btrfs_put_delayed_ref(ref);
2651 btrfs_debug(fs_info, "run_one_delayed_ref returned %d", ret); 2653 btrfs_debug(fs_info, "run_one_delayed_ref returned %d",
2654 ret);
2652 return ret; 2655 return ret;
2653 } 2656 }
2654 2657
@@ -6930,8 +6933,9 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans,
6930 } 6933 }
6931 6934
6932 if (ret) { 6935 if (ret) {
6933 btrfs_err(info, "umm, got %d back from search, was looking for %llu", 6936 btrfs_err(info,
6934 ret, bytenr); 6937 "umm, got %d back from search, was looking for %llu",
6938 ret, bytenr);
6935 if (ret > 0) 6939 if (ret > 0)
6936 btrfs_print_leaf(extent_root, 6940 btrfs_print_leaf(extent_root,
6937 path->nodes[0]); 6941 path->nodes[0]);
@@ -6977,7 +6981,8 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans,
6977 ret = btrfs_search_slot(trans, extent_root, &key, path, 6981 ret = btrfs_search_slot(trans, extent_root, &key, path,
6978 -1, 1); 6982 -1, 1);
6979 if (ret) { 6983 if (ret) {
6980 btrfs_err(info, "umm, got %d back from search, was looking for %llu", 6984 btrfs_err(info,
6985 "umm, got %d back from search, was looking for %llu",
6981 ret, bytenr); 6986 ret, bytenr);
6982 btrfs_print_leaf(extent_root, path->nodes[0]); 6987 btrfs_print_leaf(extent_root, path->nodes[0]);
6983 } 6988 }
@@ -7004,8 +7009,9 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans,
7004 7009
7005 refs = btrfs_extent_refs(leaf, ei); 7010 refs = btrfs_extent_refs(leaf, ei);
7006 if (refs < refs_to_drop) { 7011 if (refs < refs_to_drop) {
7007 btrfs_err(info, "trying to drop %d refs but we only have %Lu " 7012 btrfs_err(info,
7008 "for bytenr %Lu", refs_to_drop, refs, bytenr); 7013 "trying to drop %d refs but we only have %Lu for bytenr %Lu",
7014 refs_to_drop, refs, bytenr);
7009 ret = -EINVAL; 7015 ret = -EINVAL;
7010 btrfs_abort_transaction(trans, ret); 7016 btrfs_abort_transaction(trans, ret);
7011 goto out; 7017 goto out;
@@ -7913,8 +7919,7 @@ static void dump_space_info(struct btrfs_space_info *info, u64 bytes,
7913 info->total_bytes - info->bytes_used - info->bytes_pinned - 7919 info->total_bytes - info->bytes_used - info->bytes_pinned -
7914 info->bytes_reserved - info->bytes_readonly - 7920 info->bytes_reserved - info->bytes_readonly -
7915 info->bytes_may_use, (info->full) ? "" : "not "); 7921 info->bytes_may_use, (info->full) ? "" : "not ");
7916 printk(KERN_INFO "BTRFS: space_info total=%llu, used=%llu, pinned=%llu, " 7922 printk(KERN_INFO "BTRFS: space_info total=%llu, used=%llu, pinned=%llu, reserved=%llu, may_use=%llu, readonly=%llu\n",
7917 "reserved=%llu, may_use=%llu, readonly=%llu\n",
7918 info->total_bytes, info->bytes_used, info->bytes_pinned, 7923 info->total_bytes, info->bytes_used, info->bytes_pinned,
7919 info->bytes_reserved, info->bytes_may_use, 7924 info->bytes_reserved, info->bytes_may_use,
7920 info->bytes_readonly); 7925 info->bytes_readonly);
@@ -7927,9 +7932,7 @@ static void dump_space_info(struct btrfs_space_info *info, u64 bytes,
7927again: 7932again:
7928 list_for_each_entry(cache, &info->block_groups[index], list) { 7933 list_for_each_entry(cache, &info->block_groups[index], list) {
7929 spin_lock(&cache->lock); 7934 spin_lock(&cache->lock);
7930 printk(KERN_INFO "BTRFS: " 7935 printk(KERN_INFO "BTRFS: block group %llu has %llu bytes, %llu used %llu pinned %llu reserved %s\n",
7931 "block group %llu has %llu bytes, "
7932 "%llu used %llu pinned %llu reserved %s\n",
7933 cache->key.objectid, cache->key.offset, 7936 cache->key.objectid, cache->key.offset,
7934 btrfs_block_group_used(&cache->item), cache->pinned, 7937 btrfs_block_group_used(&cache->item), cache->pinned,
7935 cache->reserved, cache->ro ? "[readonly]" : ""); 7938 cache->reserved, cache->ro ? "[readonly]" : "");
@@ -7971,8 +7974,9 @@ again:
7971 struct btrfs_space_info *sinfo; 7974 struct btrfs_space_info *sinfo;
7972 7975
7973 sinfo = __find_space_info(root->fs_info, flags); 7976 sinfo = __find_space_info(root->fs_info, flags);
7974 btrfs_err(root->fs_info, "allocation failed flags %llu, wanted %llu", 7977 btrfs_err(root->fs_info,
7975 flags, num_bytes); 7978 "allocation failed flags %llu, wanted %llu",
7979 flags, num_bytes);
7976 if (sinfo) 7980 if (sinfo)
7977 dump_space_info(sinfo, num_bytes, 1); 7981 dump_space_info(sinfo, num_bytes, 1);
7978 } 7982 }
@@ -8966,10 +8970,8 @@ skip:
8966 generation, level - 1); 8970 generation, level - 1);
8967 if (ret) { 8971 if (ret) {
8968 btrfs_err_rl(root->fs_info, 8972 btrfs_err_rl(root->fs_info,
8969 "Error " 8973 "Error %d accounting shared subtree. Quota is out of sync, rescan required.",
8970 "%d accounting shared subtree. Quota " 8974 ret);
8971 "is out of sync, rescan required.",
8972 ret);
8973 } 8975 }
8974 } 8976 }
8975 ret = btrfs_free_extent(trans, root, bytenr, blocksize, parent, 8977 ret = btrfs_free_extent(trans, root, bytenr, blocksize, parent,
@@ -9059,10 +9061,8 @@ static noinline int walk_up_proc(struct btrfs_trans_handle *trans,
9059 ret = account_leaf_items(trans, root, eb); 9061 ret = account_leaf_items(trans, root, eb);
9060 if (ret) { 9062 if (ret) {
9061 btrfs_err_rl(root->fs_info, 9063 btrfs_err_rl(root->fs_info,
9062 "error " 9064 "error %d accounting leaf items. Quota is out of sync, rescan required.",
9063 "%d accounting leaf items. Quota " 9065 ret);
9064 "is out of sync, rescan required.",
9065 ret);
9066 } 9066 }
9067 } 9067 }
9068 /* make block locked assertion in clean_tree_block happy */ 9068 /* make block locked assertion in clean_tree_block happy */
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 288ee90a9823..906c5927b0c6 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -75,8 +75,7 @@ void btrfs_leak_debug_check(void)
75 75
76 while (!list_empty(&buffers)) { 76 while (!list_empty(&buffers)) {
77 eb = list_entry(buffers.next, struct extent_buffer, leak_list); 77 eb = list_entry(buffers.next, struct extent_buffer, leak_list);
78 printk(KERN_ERR "BTRFS: buffer leak start %llu len %lu " 78 printk(KERN_ERR "BTRFS: buffer leak start %llu len %lu refs %d\n",
79 "refs %d\n",
80 eb->start, eb->len, atomic_read(&eb->refs)); 79 eb->start, eb->len, atomic_read(&eb->refs));
81 list_del(&eb->leak_list); 80 list_del(&eb->leak_list);
82 kmem_cache_free(extent_buffer_cache, eb); 81 kmem_cache_free(extent_buffer_cache, eb);
@@ -461,8 +460,7 @@ static int insert_state(struct extent_io_tree *tree,
461 if (node) { 460 if (node) {
462 struct extent_state *found; 461 struct extent_state *found;
463 found = rb_entry(node, struct extent_state, rb_node); 462 found = rb_entry(node, struct extent_state, rb_node);
464 printk(KERN_ERR "BTRFS: found node %llu %llu on insert of " 463 printk(KERN_ERR "BTRFS: found node %llu %llu on insert of %llu %llu\n",
465 "%llu %llu\n",
466 found->start, found->end, start, end); 464 found->start, found->end, start, end);
467 return -EEXIST; 465 return -EEXIST;
468 } 466 }
@@ -573,9 +571,8 @@ alloc_extent_state_atomic(struct extent_state *prealloc)
573 571
574static void extent_io_tree_panic(struct extent_io_tree *tree, int err) 572static void extent_io_tree_panic(struct extent_io_tree *tree, int err)
575{ 573{
576 btrfs_panic(tree_fs_info(tree), err, "Locking error: " 574 btrfs_panic(tree_fs_info(tree), err,
577 "Extent tree was modified by another " 575 "Locking error: Extent tree was modified by another thread while locked.");
578 "thread while locked.");
579} 576}
580 577
581/* 578/*
@@ -2485,8 +2482,7 @@ static void end_bio_extent_writepage(struct bio *bio)
2485 bvec->bv_offset, bvec->bv_len); 2482 bvec->bv_offset, bvec->bv_len);
2486 else 2483 else
2487 btrfs_info(BTRFS_I(page->mapping->host)->root->fs_info, 2484 btrfs_info(BTRFS_I(page->mapping->host)->root->fs_info,
2488 "incomplete page write in btrfs with offset %u and " 2485 "incomplete page write in btrfs with offset %u and length %u",
2489 "length %u",
2490 bvec->bv_offset, bvec->bv_len); 2486 bvec->bv_offset, bvec->bv_len);
2491 } 2487 }
2492 2488
@@ -2543,8 +2539,8 @@ static void end_bio_extent_readpage(struct bio *bio)
2543 struct page *page = bvec->bv_page; 2539 struct page *page = bvec->bv_page;
2544 struct inode *inode = page->mapping->host; 2540 struct inode *inode = page->mapping->host;
2545 2541
2546 pr_debug("end_bio_extent_readpage: bi_sector=%llu, err=%d, " 2542 pr_debug("end_bio_extent_readpage: bi_sector=%llu, err=%d, mirror=%u\n",
2547 "mirror=%u\n", (u64)bio->bi_iter.bi_sector, 2543 (u64)bio->bi_iter.bi_sector,
2548 bio->bi_error, io_bio->mirror_num); 2544 bio->bi_error, io_bio->mirror_num);
2549 tree = &BTRFS_I(inode)->io_tree; 2545 tree = &BTRFS_I(inode)->io_tree;
2550 2546
@@ -2560,8 +2556,7 @@ static void end_bio_extent_readpage(struct bio *bio)
2560 bvec->bv_offset, bvec->bv_len); 2556 bvec->bv_offset, bvec->bv_len);
2561 else 2557 else
2562 btrfs_info(BTRFS_I(page->mapping->host)->root->fs_info, 2558 btrfs_info(BTRFS_I(page->mapping->host)->root->fs_info,
2563 "incomplete page read in btrfs with offset %u and " 2559 "incomplete page read in btrfs with offset %u and length %u",
2564 "length %u",
2565 bvec->bv_offset, bvec->bv_len); 2560 bvec->bv_offset, bvec->bv_len);
2566 } 2561 }
2567 2562
@@ -5405,8 +5400,7 @@ int map_private_extent_buffer(struct extent_buffer *eb, unsigned long start,
5405 } 5400 }
5406 5401
5407 if (start + min_len > eb->len) { 5402 if (start + min_len > eb->len) {
5408 WARN(1, KERN_ERR "btrfs bad mapping eb start %llu len %lu, " 5403 WARN(1, KERN_ERR "btrfs bad mapping eb start %llu len %lu, wanted %lu %lu\n",
5409 "wanted %lu %lu\n",
5410 eb->start, eb->len, start, min_len); 5404 eb->start, eb->len, start, min_len);
5411 return -EINVAL; 5405 return -EINVAL;
5412 } 5406 }
@@ -5736,14 +5730,14 @@ void memcpy_extent_buffer(struct extent_buffer *dst, unsigned long dst_offset,
5736 5730
5737 if (src_offset + len > dst->len) { 5731 if (src_offset + len > dst->len) {
5738 btrfs_err(dst->fs_info, 5732 btrfs_err(dst->fs_info,
5739 "memmove bogus src_offset %lu move " 5733 "memmove bogus src_offset %lu move len %lu dst len %lu",
5740 "len %lu dst len %lu", src_offset, len, dst->len); 5734 src_offset, len, dst->len);
5741 BUG_ON(1); 5735 BUG_ON(1);
5742 } 5736 }
5743 if (dst_offset + len > dst->len) { 5737 if (dst_offset + len > dst->len) {
5744 btrfs_err(dst->fs_info, 5738 btrfs_err(dst->fs_info,
5745 "memmove bogus dst_offset %lu move " 5739 "memmove bogus dst_offset %lu move len %lu dst len %lu",
5746 "len %lu dst len %lu", dst_offset, len, dst->len); 5740 dst_offset, len, dst->len);
5747 BUG_ON(1); 5741 BUG_ON(1);
5748 } 5742 }
5749 5743
@@ -5783,13 +5777,15 @@ void memmove_extent_buffer(struct extent_buffer *dst, unsigned long dst_offset,
5783 unsigned long src_i; 5777 unsigned long src_i;
5784 5778
5785 if (src_offset + len > dst->len) { 5779 if (src_offset + len > dst->len) {
5786 btrfs_err(dst->fs_info, "memmove bogus src_offset %lu move " 5780 btrfs_err(dst->fs_info,
5787 "len %lu len %lu", src_offset, len, dst->len); 5781 "memmove bogus src_offset %lu move len %lu len %lu",
5782 src_offset, len, dst->len);
5788 BUG_ON(1); 5783 BUG_ON(1);
5789 } 5784 }
5790 if (dst_offset + len > dst->len) { 5785 if (dst_offset + len > dst->len) {
5791 btrfs_err(dst->fs_info, "memmove bogus dst_offset %lu move " 5786 btrfs_err(dst->fs_info,
5792 "len %lu len %lu", dst_offset, len, dst->len); 5787 "memmove bogus dst_offset %lu move len %lu len %lu",
5788 dst_offset, len, dst->len);
5793 BUG_ON(1); 5789 BUG_ON(1);
5794 } 5790 }
5795 if (dst_offset < src_offset) { 5791 if (dst_offset < src_offset) {
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index d571bd2b697b..ea09fabb06a5 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -716,8 +716,7 @@ static int __load_free_space_cache(struct btrfs_root *root, struct inode *inode,
716 716
717 if (BTRFS_I(inode)->generation != generation) { 717 if (BTRFS_I(inode)->generation != generation) {
718 btrfs_err(root->fs_info, 718 btrfs_err(root->fs_info,
719 "free space inode generation (%llu) " 719 "free space inode generation (%llu) did not match free space cache generation (%llu)",
720 "did not match free space cache generation (%llu)",
721 BTRFS_I(inode)->generation, generation); 720 BTRFS_I(inode)->generation, generation);
722 return 0; 721 return 0;
723 } 722 }
@@ -879,8 +878,9 @@ int load_free_space_cache(struct btrfs_fs_info *fs_info,
879 878
880 if (!matched) { 879 if (!matched) {
881 __btrfs_remove_free_space_cache(ctl); 880 __btrfs_remove_free_space_cache(ctl);
882 btrfs_warn(fs_info, "block group %llu has wrong amount of free space", 881 btrfs_warn(fs_info,
883 block_group->key.objectid); 882 "block group %llu has wrong amount of free space",
883 block_group->key.objectid);
884 ret = -1; 884 ret = -1;
885 } 885 }
886out: 886out:
@@ -891,8 +891,9 @@ out:
891 spin_unlock(&block_group->lock); 891 spin_unlock(&block_group->lock);
892 ret = 0; 892 ret = 0;
893 893
894 btrfs_warn(fs_info, "failed to load free space cache for block group %llu, rebuilding it now", 894 btrfs_warn(fs_info,
895 block_group->key.objectid); 895 "failed to load free space cache for block group %llu, rebuilding it now",
896 block_group->key.objectid);
896 } 897 }
897 898
898 iput(inode); 899 iput(inode);
diff --git a/fs/btrfs/free-space-tree.c b/fs/btrfs/free-space-tree.c
index 83ee63bdca96..1851beaa0377 100644
--- a/fs/btrfs/free-space-tree.c
+++ b/fs/btrfs/free-space-tree.c
@@ -261,7 +261,8 @@ int convert_free_space_to_bitmaps(struct btrfs_trans_handle *trans,
261 btrfs_release_path(path); 261 btrfs_release_path(path);
262 262
263 if (extent_count != expected_extent_count) { 263 if (extent_count != expected_extent_count) {
264 btrfs_err(fs_info, "incorrect extent count for %llu; counted %u, expected %u", 264 btrfs_err(fs_info,
265 "incorrect extent count for %llu; counted %u, expected %u",
265 block_group->key.objectid, extent_count, 266 block_group->key.objectid, extent_count,
266 expected_extent_count); 267 expected_extent_count);
267 ASSERT(0); 268 ASSERT(0);
@@ -442,7 +443,8 @@ int convert_free_space_to_extents(struct btrfs_trans_handle *trans,
442 } 443 }
443 444
444 if (extent_count != expected_extent_count) { 445 if (extent_count != expected_extent_count) {
445 btrfs_err(fs_info, "incorrect extent count for %llu; counted %u, expected %u", 446 btrfs_err(fs_info,
447 "incorrect extent count for %llu; counted %u, expected %u",
446 block_group->key.objectid, extent_count, 448 block_group->key.objectid, extent_count,
447 expected_extent_count); 449 expected_extent_count);
448 ASSERT(0); 450 ASSERT(0);
@@ -1480,7 +1482,8 @@ static int load_free_space_bitmaps(struct btrfs_caching_control *caching_ctl,
1480 } 1482 }
1481 1483
1482 if (extent_count != expected_extent_count) { 1484 if (extent_count != expected_extent_count) {
1483 btrfs_err(fs_info, "incorrect extent count for %llu; counted %u, expected %u", 1485 btrfs_err(fs_info,
1486 "incorrect extent count for %llu; counted %u, expected %u",
1484 block_group->key.objectid, extent_count, 1487 block_group->key.objectid, extent_count,
1485 expected_extent_count); 1488 expected_extent_count);
1486 ASSERT(0); 1489 ASSERT(0);
@@ -1542,7 +1545,8 @@ static int load_free_space_extents(struct btrfs_caching_control *caching_ctl,
1542 } 1545 }
1543 1546
1544 if (extent_count != expected_extent_count) { 1547 if (extent_count != expected_extent_count) {
1545 btrfs_err(fs_info, "incorrect extent count for %llu; counted %u, expected %u", 1548 btrfs_err(fs_info,
1549 "incorrect extent count for %llu; counted %u, expected %u",
1546 block_group->key.objectid, extent_count, 1550 block_group->key.objectid, extent_count,
1547 expected_extent_count); 1551 expected_extent_count);
1548 ASSERT(0); 1552 ASSERT(0);
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index b5e08a903bb3..9323e1c25ee1 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -7024,8 +7024,9 @@ not_found_em:
7024insert: 7024insert:
7025 btrfs_release_path(path); 7025 btrfs_release_path(path);
7026 if (em->start > start || extent_map_end(em) <= start) { 7026 if (em->start > start || extent_map_end(em) <= start) {
7027 btrfs_err(root->fs_info, "bad extent! em: [%llu %llu] passed [%llu %llu]", 7027 btrfs_err(root->fs_info,
7028 em->start, em->len, start, len); 7028 "bad extent! em: [%llu %llu] passed [%llu %llu]",
7029 em->start, em->len, start, len);
7029 err = -EIO; 7030 err = -EIO;
7030 goto out; 7031 goto out;
7031 } 7032 }
@@ -9388,8 +9389,9 @@ void btrfs_destroy_inode(struct inode *inode)
9388 if (!ordered) 9389 if (!ordered)
9389 break; 9390 break;
9390 else { 9391 else {
9391 btrfs_err(root->fs_info, "found ordered extent %llu %llu on inode cleanup", 9392 btrfs_err(root->fs_info,
9392 ordered->file_offset, ordered->len); 9393 "found ordered extent %llu %llu on inode cleanup",
9394 ordered->file_offset, ordered->len);
9393 btrfs_remove_ordered_extent(inode, ordered); 9395 btrfs_remove_ordered_extent(inode, ordered);
9394 btrfs_put_ordered_extent(ordered); 9396 btrfs_put_ordered_extent(ordered);
9395 btrfs_put_ordered_extent(ordered); 9397 btrfs_put_ordered_extent(ordered);
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 7fd939bfbd99..af69129d7e0e 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -1903,8 +1903,9 @@ static noinline int may_destroy_subvol(struct btrfs_root *root)
1903 btrfs_dir_item_key_to_cpu(path->nodes[0], di, &key); 1903 btrfs_dir_item_key_to_cpu(path->nodes[0], di, &key);
1904 if (key.objectid == root->root_key.objectid) { 1904 if (key.objectid == root->root_key.objectid) {
1905 ret = -EPERM; 1905 ret = -EPERM;
1906 btrfs_err(root->fs_info, "deleting default subvolume " 1906 btrfs_err(root->fs_info,
1907 "%llu is not allowed", key.objectid); 1907 "deleting default subvolume %llu is not allowed",
1908 key.objectid);
1908 goto out; 1909 goto out;
1909 } 1910 }
1910 btrfs_release_path(path); 1911 btrfs_release_path(path);
@@ -4097,8 +4098,8 @@ static long btrfs_ioctl_default_subvol(struct file *file, void __user *argp)
4097 if (IS_ERR_OR_NULL(di)) { 4098 if (IS_ERR_OR_NULL(di)) {
4098 btrfs_free_path(path); 4099 btrfs_free_path(path);
4099 btrfs_end_transaction(trans, root); 4100 btrfs_end_transaction(trans, root);
4100 btrfs_err(new_root->fs_info, "Umm, you don't have the default dir" 4101 btrfs_err(new_root->fs_info,
4101 "item, this isn't going to work"); 4102 "Umm, you don't have the default diritem, this isn't going to work");
4102 ret = -ENOENT; 4103 ret = -ENOENT;
4103 goto out; 4104 goto out;
4104 } 4105 }
@@ -5307,8 +5308,9 @@ static int btrfs_ioctl_set_fslabel(struct file *file, void __user *arg)
5307 return -EFAULT; 5308 return -EFAULT;
5308 5309
5309 if (strnlen(label, BTRFS_LABEL_SIZE) == BTRFS_LABEL_SIZE) { 5310 if (strnlen(label, BTRFS_LABEL_SIZE) == BTRFS_LABEL_SIZE) {
5310 btrfs_err(root->fs_info, "unable to set label with more than %d bytes", 5311 btrfs_err(root->fs_info,
5311 BTRFS_LABEL_SIZE - 1); 5312 "unable to set label with more than %d bytes",
5313 BTRFS_LABEL_SIZE - 1);
5312 return -EINVAL; 5314 return -EINVAL;
5313 } 5315 }
5314 5316
diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c
index 3b78d38173b3..b2d1e95de7be 100644
--- a/fs/btrfs/ordered-data.c
+++ b/fs/btrfs/ordered-data.c
@@ -67,8 +67,8 @@ static void ordered_data_tree_panic(struct inode *inode, int errno,
67 u64 offset) 67 u64 offset)
68{ 68{
69 struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb); 69 struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
70 btrfs_panic(fs_info, errno, "Inconsistency in ordered tree at offset " 70 btrfs_panic(fs_info, errno,
71 "%llu", offset); 71 "Inconsistency in ordered tree at offset %llu", offset);
72} 72}
73 73
74/* 74/*
diff --git a/fs/btrfs/print-tree.c b/fs/btrfs/print-tree.c
index aaeee45d917d..2fa49f207ca0 100644
--- a/fs/btrfs/print-tree.c
+++ b/fs/btrfs/print-tree.c
@@ -24,8 +24,7 @@ static void print_chunk(struct extent_buffer *eb, struct btrfs_chunk *chunk)
24{ 24{
25 int num_stripes = btrfs_chunk_num_stripes(eb, chunk); 25 int num_stripes = btrfs_chunk_num_stripes(eb, chunk);
26 int i; 26 int i;
27 printk(KERN_INFO "\t\tchunk length %llu owner %llu type %llu " 27 printk(KERN_INFO "\t\tchunk length %llu owner %llu type %llu num_stripes %d\n",
28 "num_stripes %d\n",
29 btrfs_chunk_length(eb, chunk), btrfs_chunk_owner(eb, chunk), 28 btrfs_chunk_length(eb, chunk), btrfs_chunk_owner(eb, chunk),
30 btrfs_chunk_type(eb, chunk), num_stripes); 29 btrfs_chunk_type(eb, chunk), num_stripes);
31 for (i = 0 ; i < num_stripes ; i++) { 30 for (i = 0 ; i < num_stripes ; i++) {
@@ -37,8 +36,7 @@ static void print_chunk(struct extent_buffer *eb, struct btrfs_chunk *chunk)
37static void print_dev_item(struct extent_buffer *eb, 36static void print_dev_item(struct extent_buffer *eb,
38 struct btrfs_dev_item *dev_item) 37 struct btrfs_dev_item *dev_item)
39{ 38{
40 printk(KERN_INFO "\t\tdev item devid %llu " 39 printk(KERN_INFO "\t\tdev item devid %llu total_bytes %llu bytes used %llu\n",
41 "total_bytes %llu bytes used %llu\n",
42 btrfs_device_id(eb, dev_item), 40 btrfs_device_id(eb, dev_item),
43 btrfs_device_total_bytes(eb, dev_item), 41 btrfs_device_total_bytes(eb, dev_item),
44 btrfs_device_bytes_used(eb, dev_item)); 42 btrfs_device_bytes_used(eb, dev_item));
@@ -46,8 +44,7 @@ static void print_dev_item(struct extent_buffer *eb,
46static void print_extent_data_ref(struct extent_buffer *eb, 44static void print_extent_data_ref(struct extent_buffer *eb,
47 struct btrfs_extent_data_ref *ref) 45 struct btrfs_extent_data_ref *ref)
48{ 46{
49 printk(KERN_INFO "\t\textent data backref root %llu " 47 printk(KERN_INFO "\t\textent data backref root %llu objectid %llu offset %llu count %u\n",
50 "objectid %llu offset %llu count %u\n",
51 btrfs_extent_data_ref_root(eb, ref), 48 btrfs_extent_data_ref_root(eb, ref),
52 btrfs_extent_data_ref_objectid(eb, ref), 49 btrfs_extent_data_ref_objectid(eb, ref),
53 btrfs_extent_data_ref_offset(eb, ref), 50 btrfs_extent_data_ref_offset(eb, ref),
@@ -92,8 +89,7 @@ static void print_extent_item(struct extent_buffer *eb, int slot, int type)
92 struct btrfs_tree_block_info *info; 89 struct btrfs_tree_block_info *info;
93 info = (struct btrfs_tree_block_info *)(ei + 1); 90 info = (struct btrfs_tree_block_info *)(ei + 1);
94 btrfs_tree_block_key(eb, info, &key); 91 btrfs_tree_block_key(eb, info, &key);
95 printk(KERN_INFO "\t\ttree block key (%llu %u %llu) " 92 printk(KERN_INFO "\t\ttree block key (%llu %u %llu) level %d\n",
96 "level %d\n",
97 btrfs_disk_key_objectid(&key), key.type, 93 btrfs_disk_key_objectid(&key), key.type,
98 btrfs_disk_key_offset(&key), 94 btrfs_disk_key_offset(&key),
99 btrfs_tree_block_level(eb, info)); 95 btrfs_tree_block_level(eb, info));
@@ -110,12 +106,10 @@ static void print_extent_item(struct extent_buffer *eb, int slot, int type)
110 offset = btrfs_extent_inline_ref_offset(eb, iref); 106 offset = btrfs_extent_inline_ref_offset(eb, iref);
111 switch (type) { 107 switch (type) {
112 case BTRFS_TREE_BLOCK_REF_KEY: 108 case BTRFS_TREE_BLOCK_REF_KEY:
113 printk(KERN_INFO "\t\ttree block backref " 109 printk(KERN_INFO "\t\ttree block backref root %llu\n", offset);
114 "root %llu\n", offset);
115 break; 110 break;
116 case BTRFS_SHARED_BLOCK_REF_KEY: 111 case BTRFS_SHARED_BLOCK_REF_KEY:
117 printk(KERN_INFO "\t\tshared block backref " 112 printk(KERN_INFO "\t\tshared block backref parent %llu\n", offset);
118 "parent %llu\n", offset);
119 break; 113 break;
120 case BTRFS_EXTENT_DATA_REF_KEY: 114 case BTRFS_EXTENT_DATA_REF_KEY:
121 dref = (struct btrfs_extent_data_ref *)(&iref->offset); 115 dref = (struct btrfs_extent_data_ref *)(&iref->offset);
@@ -123,8 +117,7 @@ static void print_extent_item(struct extent_buffer *eb, int slot, int type)
123 break; 117 break;
124 case BTRFS_SHARED_DATA_REF_KEY: 118 case BTRFS_SHARED_DATA_REF_KEY:
125 sref = (struct btrfs_shared_data_ref *)(iref + 1); 119 sref = (struct btrfs_shared_data_ref *)(iref + 1);
126 printk(KERN_INFO "\t\tshared data backref " 120 printk(KERN_INFO "\t\tshared data backref parent %llu count %u\n",
127 "parent %llu count %u\n",
128 offset, btrfs_shared_data_ref_count(eb, sref)); 121 offset, btrfs_shared_data_ref_count(eb, sref));
129 break; 122 break;
130 default: 123 default:
@@ -141,8 +134,7 @@ static void print_extent_ref_v0(struct extent_buffer *eb, int slot)
141 struct btrfs_extent_ref_v0 *ref0; 134 struct btrfs_extent_ref_v0 *ref0;
142 135
143 ref0 = btrfs_item_ptr(eb, slot, struct btrfs_extent_ref_v0); 136 ref0 = btrfs_item_ptr(eb, slot, struct btrfs_extent_ref_v0);
144 printk("\t\textent back ref root %llu gen %llu " 137 printk("\t\textent back ref root %llu gen %llu owner %llu num_refs %lu\n",
145 "owner %llu num_refs %lu\n",
146 btrfs_ref_root_v0(eb, ref0), 138 btrfs_ref_root_v0(eb, ref0),
147 btrfs_ref_generation_v0(eb, ref0), 139 btrfs_ref_generation_v0(eb, ref0),
148 btrfs_ref_objectid_v0(eb, ref0), 140 btrfs_ref_objectid_v0(eb, ref0),
@@ -196,15 +188,13 @@ void btrfs_print_leaf(struct btrfs_root *root, struct extent_buffer *l)
196 item = btrfs_item_nr(i); 188 item = btrfs_item_nr(i);
197 btrfs_item_key_to_cpu(l, &key, i); 189 btrfs_item_key_to_cpu(l, &key, i);
198 type = key.type; 190 type = key.type;
199 printk(KERN_INFO "\titem %d key (%llu %u %llu) itemoff %d " 191 printk(KERN_INFO "\titem %d key (%llu %u %llu) itemoff %d itemsize %d\n",
200 "itemsize %d\n",
201 i, key.objectid, type, key.offset, 192 i, key.objectid, type, key.offset,
202 btrfs_item_offset(l, item), btrfs_item_size(l, item)); 193 btrfs_item_offset(l, item), btrfs_item_size(l, item));
203 switch (type) { 194 switch (type) {
204 case BTRFS_INODE_ITEM_KEY: 195 case BTRFS_INODE_ITEM_KEY:
205 ii = btrfs_item_ptr(l, i, struct btrfs_inode_item); 196 ii = btrfs_item_ptr(l, i, struct btrfs_inode_item);
206 printk(KERN_INFO "\t\tinode generation %llu size %llu " 197 printk(KERN_INFO "\t\tinode generation %llu size %llu mode %o\n",
207 "mode %o\n",
208 btrfs_inode_generation(l, ii), 198 btrfs_inode_generation(l, ii),
209 btrfs_inode_size(l, ii), 199 btrfs_inode_size(l, ii),
210 btrfs_inode_mode(l, ii)); 200 btrfs_inode_mode(l, ii));
@@ -248,17 +238,14 @@ void btrfs_print_leaf(struct btrfs_root *root, struct extent_buffer *l)
248 struct btrfs_file_extent_item); 238 struct btrfs_file_extent_item);
249 if (btrfs_file_extent_type(l, fi) == 239 if (btrfs_file_extent_type(l, fi) ==
250 BTRFS_FILE_EXTENT_INLINE) { 240 BTRFS_FILE_EXTENT_INLINE) {
251 printk(KERN_INFO "\t\tinline extent data " 241 printk(KERN_INFO "\t\tinline extent data size %u\n",
252 "size %u\n",
253 btrfs_file_extent_inline_len(l, i, fi)); 242 btrfs_file_extent_inline_len(l, i, fi));
254 break; 243 break;
255 } 244 }
256 printk(KERN_INFO "\t\textent data disk bytenr %llu " 245 printk(KERN_INFO "\t\textent data disk bytenr %llu nr %llu\n",
257 "nr %llu\n",
258 btrfs_file_extent_disk_bytenr(l, fi), 246 btrfs_file_extent_disk_bytenr(l, fi),
259 btrfs_file_extent_disk_num_bytes(l, fi)); 247 btrfs_file_extent_disk_num_bytes(l, fi));
260 printk(KERN_INFO "\t\textent data offset %llu " 248 printk(KERN_INFO "\t\textent data offset %llu nr %llu ram %llu\n",
261 "nr %llu ram %llu\n",
262 btrfs_file_extent_offset(l, fi), 249 btrfs_file_extent_offset(l, fi),
263 btrfs_file_extent_num_bytes(l, fi), 250 btrfs_file_extent_num_bytes(l, fi),
264 btrfs_file_extent_ram_bytes(l, fi)); 251 btrfs_file_extent_ram_bytes(l, fi));
@@ -287,9 +274,7 @@ void btrfs_print_leaf(struct btrfs_root *root, struct extent_buffer *l)
287 case BTRFS_DEV_EXTENT_KEY: 274 case BTRFS_DEV_EXTENT_KEY:
288 dev_extent = btrfs_item_ptr(l, i, 275 dev_extent = btrfs_item_ptr(l, i,
289 struct btrfs_dev_extent); 276 struct btrfs_dev_extent);
290 printk(KERN_INFO "\t\tdev extent chunk_tree %llu\n" 277 printk(KERN_INFO "\t\tdev extent chunk_tree %llu\n\t\tchunk objectid %llu chunk offset %llu length %llu\n",
291 "\t\tchunk objectid %llu chunk offset %llu "
292 "length %llu\n",
293 btrfs_dev_extent_chunk_tree(l, dev_extent), 278 btrfs_dev_extent_chunk_tree(l, dev_extent),
294 btrfs_dev_extent_chunk_objectid(l, dev_extent), 279 btrfs_dev_extent_chunk_objectid(l, dev_extent),
295 btrfs_dev_extent_chunk_offset(l, dev_extent), 280 btrfs_dev_extent_chunk_offset(l, dev_extent),
@@ -343,9 +328,10 @@ void btrfs_print_tree(struct btrfs_root *root, struct extent_buffer *c)
343 btrfs_print_leaf(root, c); 328 btrfs_print_leaf(root, c);
344 return; 329 return;
345 } 330 }
346 btrfs_info(root->fs_info, "node %llu level %d total ptrs %d free spc %u", 331 btrfs_info(root->fs_info,
347 btrfs_header_bytenr(c), level, nr, 332 "node %llu level %d total ptrs %d free spc %u",
348 (u32)BTRFS_NODEPTRS_PER_BLOCK(root) - nr); 333 btrfs_header_bytenr(c), level, nr,
334 (u32)BTRFS_NODEPTRS_PER_BLOCK(root) - nr);
349 for (i = 0; i < nr; i++) { 335 for (i = 0; i < nr; i++) {
350 btrfs_node_key_to_cpu(c, &key, i); 336 btrfs_node_key_to_cpu(c, &key, i);
351 printk(KERN_INFO "\tkey %d (%llu %u %llu) block %llu\n", 337 printk(KERN_INFO "\tkey %d (%llu %u %llu) block %llu\n",
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index 13c2dc79501b..0f9df5a68c54 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -360,8 +360,7 @@ int btrfs_read_qgroup_config(struct btrfs_fs_info *fs_info)
360 fs_info->generation) { 360 fs_info->generation) {
361 flags |= BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT; 361 flags |= BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT;
362 btrfs_err(fs_info, 362 btrfs_err(fs_info,
363 "qgroup generation mismatch, " 363 "qgroup generation mismatch, marked as inconsistent");
364 "marked as inconsistent");
365 } 364 }
366 fs_info->qgroup_flags = btrfs_qgroup_status_flags(l, 365 fs_info->qgroup_flags = btrfs_qgroup_status_flags(l,
367 ptr); 366 ptr);
@@ -1994,8 +1993,9 @@ int btrfs_qgroup_inherit(struct btrfs_trans_handle *trans,
1994 ret = update_qgroup_limit_item(trans, quota_root, dstgroup); 1993 ret = update_qgroup_limit_item(trans, quota_root, dstgroup);
1995 if (ret) { 1994 if (ret) {
1996 fs_info->qgroup_flags |= BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT; 1995 fs_info->qgroup_flags |= BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT;
1997 btrfs_info(fs_info, "unable to update quota limit for %llu", 1996 btrfs_info(fs_info,
1998 dstgroup->qgroupid); 1997 "unable to update quota limit for %llu",
1998 dstgroup->qgroupid);
1999 goto unlock; 1999 goto unlock;
2000 } 2000 }
2001 } 2001 }
@@ -2229,8 +2229,7 @@ void assert_qgroups_uptodate(struct btrfs_trans_handle *trans)
2229 if (list_empty(&trans->qgroup_ref_list) && !trans->delayed_ref_elem.seq) 2229 if (list_empty(&trans->qgroup_ref_list) && !trans->delayed_ref_elem.seq)
2230 return; 2230 return;
2231 btrfs_err(trans->fs_info, 2231 btrfs_err(trans->fs_info,
2232 "qgroups not uptodate in trans handle %p: list is%s empty, " 2232 "qgroups not uptodate in trans handle %p: list is%s empty, seq is %#x.%x",
2233 "seq is %#x.%x",
2234 trans, list_empty(&trans->qgroup_ref_list) ? "" : " not", 2233 trans, list_empty(&trans->qgroup_ref_list) ? "" : " not",
2235 (u32)(trans->delayed_ref_elem.seq >> 32), 2234 (u32)(trans->delayed_ref_elem.seq >> 32),
2236 (u32)trans->delayed_ref_elem.seq); 2235 (u32)trans->delayed_ref_elem.seq);
diff --git a/fs/btrfs/reada.c b/fs/btrfs/reada.c
index 8428db7cd88f..9e1bdafbd44b 100644
--- a/fs/btrfs/reada.c
+++ b/fs/btrfs/reada.c
@@ -829,9 +829,9 @@ static void dump_devs(struct btrfs_fs_info *fs_info, int all)
829 (void **)&zone, index, 1); 829 (void **)&zone, index, 1);
830 if (ret == 0) 830 if (ret == 0)
831 break; 831 break;
832 printk(KERN_DEBUG " zone %llu-%llu elems %llu locked " 832 printk(KERN_DEBUG " zone %llu-%llu elems %llu locked %d devs",
833 "%d devs", zone->start, zone->end, zone->elems, 833 zone->start, zone->end, zone->elems,
834 zone->locked); 834 zone->locked);
835 for (j = 0; j < zone->ndevs; ++j) { 835 for (j = 0; j < zone->ndevs; ++j) {
836 printk(KERN_CONT " %lld", 836 printk(KERN_CONT " %lld",
837 zone->devs[j]->devid); 837 zone->devs[j]->devid);
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index 3c0973a68572..0ec8ffa37ab0 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -337,8 +337,9 @@ static void backref_tree_panic(struct rb_node *rb_node, int errno, u64 bytenr)
337 rb_node); 337 rb_node);
338 if (bnode->root) 338 if (bnode->root)
339 fs_info = bnode->root->fs_info; 339 fs_info = bnode->root->fs_info;
340 btrfs_panic(fs_info, errno, "Inconsistency in backref cache " 340 btrfs_panic(fs_info, errno,
341 "found at offset %llu", bytenr); 341 "Inconsistency in backref cache found at offset %llu",
342 bytenr);
342} 343}
343 344
344/* 345/*
@@ -1303,9 +1304,9 @@ static int __must_check __add_reloc_root(struct btrfs_root *root)
1303 node->bytenr, &node->rb_node); 1304 node->bytenr, &node->rb_node);
1304 spin_unlock(&rc->reloc_root_tree.lock); 1305 spin_unlock(&rc->reloc_root_tree.lock);
1305 if (rb_node) { 1306 if (rb_node) {
1306 btrfs_panic(root->fs_info, -EEXIST, "Duplicate root found " 1307 btrfs_panic(root->fs_info, -EEXIST,
1307 "for start=%llu while inserting into relocation " 1308 "Duplicate root found for start=%llu while inserting into relocation tree",
1308 "tree", node->bytenr); 1309 node->bytenr);
1309 kfree(node); 1310 kfree(node);
1310 return -EEXIST; 1311 return -EEXIST;
1311 } 1312 }
@@ -4380,8 +4381,9 @@ int btrfs_relocate_block_group(struct btrfs_root *extent_root, u64 group_start)
4380 goto out; 4381 goto out;
4381 } 4382 }
4382 4383
4383 btrfs_info(extent_root->fs_info, "relocating block group %llu flags %llu", 4384 btrfs_info(extent_root->fs_info,
4384 rc->block_group->key.objectid, rc->block_group->flags); 4385 "relocating block group %llu flags %llu",
4386 rc->block_group->key.objectid, rc->block_group->flags);
4385 4387
4386 btrfs_wait_block_group_reservations(rc->block_group); 4388 btrfs_wait_block_group_reservations(rc->block_group);
4387 btrfs_wait_nocow_writers(rc->block_group); 4389 btrfs_wait_nocow_writers(rc->block_group);
diff --git a/fs/btrfs/root-tree.c b/fs/btrfs/root-tree.c
index 091296062456..edae751e870c 100644
--- a/fs/btrfs/root-tree.c
+++ b/fs/btrfs/root-tree.c
@@ -46,12 +46,7 @@ static void btrfs_read_root_item(struct extent_buffer *eb, int slot,
46 != btrfs_root_generation_v2(item)) { 46 != btrfs_root_generation_v2(item)) {
47 if (btrfs_root_generation_v2(item) != 0) { 47 if (btrfs_root_generation_v2(item) != 0) {
48 btrfs_warn(eb->fs_info, 48 btrfs_warn(eb->fs_info,
49 "mismatching " 49 "mismatching generation and generation_v2 found in root item. This root was probably mounted with an older kernel. Resetting all new fields.");
50 "generation and generation_v2 "
51 "found in root item. This root "
52 "was probably mounted with an "
53 "older kernel. Resetting all "
54 "new fields.");
55 } 50 }
56 need_reset = 1; 51 need_reset = 1;
57 } 52 }
@@ -156,8 +151,9 @@ int btrfs_update_root(struct btrfs_trans_handle *trans, struct btrfs_root
156 151
157 if (ret != 0) { 152 if (ret != 0) {
158 btrfs_print_leaf(root, path->nodes[0]); 153 btrfs_print_leaf(root, path->nodes[0]);
159 btrfs_crit(root->fs_info, "unable to update root key %llu %u %llu", 154 btrfs_crit(root->fs_info,
160 key->objectid, key->type, key->offset); 155 "unable to update root key %llu %u %llu",
156 key->objectid, key->type, key->offset);
161 BUG_ON(1); 157 BUG_ON(1);
162 } 158 }
163 159
@@ -302,8 +298,7 @@ int btrfs_find_orphan_roots(struct btrfs_root *tree_root)
302 if (IS_ERR(trans)) { 298 if (IS_ERR(trans)) {
303 err = PTR_ERR(trans); 299 err = PTR_ERR(trans);
304 btrfs_handle_fs_error(tree_root->fs_info, err, 300 btrfs_handle_fs_error(tree_root->fs_info, err,
305 "Failed to start trans to delete " 301 "Failed to start trans to delete orphan item");
306 "orphan item");
307 break; 302 break;
308 } 303 }
309 err = btrfs_del_orphan_item(trans, tree_root, 304 err = btrfs_del_orphan_item(trans, tree_root,
@@ -311,8 +306,7 @@ int btrfs_find_orphan_roots(struct btrfs_root *tree_root)
311 btrfs_end_transaction(trans, tree_root); 306 btrfs_end_transaction(trans, tree_root);
312 if (err) { 307 if (err) {
313 btrfs_handle_fs_error(tree_root->fs_info, err, 308 btrfs_handle_fs_error(tree_root->fs_info, err,
314 "Failed to delete root orphan " 309 "Failed to delete root orphan item");
315 "item");
316 break; 310 break;
317 } 311 }
318 continue; 312 continue;
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index 1d195d2b32c6..fffb9ab8526e 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -575,23 +575,25 @@ static int scrub_print_warning_inode(u64 inum, u64 offset, u64 root,
575 * hold all of the paths here 575 * hold all of the paths here
576 */ 576 */
577 for (i = 0; i < ipath->fspath->elem_cnt; ++i) 577 for (i = 0; i < ipath->fspath->elem_cnt; ++i)
578 btrfs_warn_in_rcu(fs_info, "%s at logical %llu on dev " 578 btrfs_warn_in_rcu(fs_info,
579 "%s, sector %llu, root %llu, inode %llu, offset %llu, " 579 "%s at logical %llu on dev %s, sector %llu, root %llu, inode %llu, offset %llu, length %llu, links %u (path: %s)",
580 "length %llu, links %u (path: %s)", swarn->errstr, 580 swarn->errstr, swarn->logical,
581 swarn->logical, rcu_str_deref(swarn->dev->name), 581 rcu_str_deref(swarn->dev->name),
582 (unsigned long long)swarn->sector, root, inum, offset, 582 (unsigned long long)swarn->sector,
583 min(isize - offset, (u64)PAGE_SIZE), nlink, 583 root, inum, offset,
584 (char *)(unsigned long)ipath->fspath->val[i]); 584 min(isize - offset, (u64)PAGE_SIZE), nlink,
585 (char *)(unsigned long)ipath->fspath->val[i]);
585 586
586 free_ipath(ipath); 587 free_ipath(ipath);
587 return 0; 588 return 0;
588 589
589err: 590err:
590 btrfs_warn_in_rcu(fs_info, "%s at logical %llu on dev " 591 btrfs_warn_in_rcu(fs_info,
591 "%s, sector %llu, root %llu, inode %llu, offset %llu: path " 592 "%s at logical %llu on dev %s, sector %llu, root %llu, inode %llu, offset %llu: path resolving failed with ret=%d",
592 "resolving failed with ret=%d", swarn->errstr, 593 swarn->errstr, swarn->logical,
593 swarn->logical, rcu_str_deref(swarn->dev->name), 594 rcu_str_deref(swarn->dev->name),
594 (unsigned long long)swarn->sector, root, inum, offset, ret); 595 (unsigned long long)swarn->sector,
596 root, inum, offset, ret);
595 597
596 free_ipath(ipath); 598 free_ipath(ipath);
597 return 0; 599 return 0;
@@ -645,9 +647,8 @@ static void scrub_print_warning(const char *errstr, struct scrub_block *sblock)
645 item_size, &ref_root, 647 item_size, &ref_root,
646 &ref_level); 648 &ref_level);
647 btrfs_warn_in_rcu(fs_info, 649 btrfs_warn_in_rcu(fs_info,
648 "%s at logical %llu on dev %s, " 650 "%s at logical %llu on dev %s, sector %llu: metadata %s (level %d) in tree %llu",
649 "sector %llu: metadata %s (level %d) in tree " 651 errstr, swarn.logical,
650 "%llu", errstr, swarn.logical,
651 rcu_str_deref(dev->name), 652 rcu_str_deref(dev->name),
652 (unsigned long long)swarn.sector, 653 (unsigned long long)swarn.sector,
653 ref_level ? "node" : "leaf", 654 ref_level ? "node" : "leaf",
@@ -1574,8 +1575,7 @@ static int scrub_repair_page_from_good_copy(struct scrub_block *sblock_bad,
1574 1575
1575 if (!page_bad->dev->bdev) { 1576 if (!page_bad->dev->bdev) {
1576 btrfs_warn_rl(sblock_bad->sctx->dev_root->fs_info, 1577 btrfs_warn_rl(sblock_bad->sctx->dev_root->fs_info,
1577 "scrub_repair_page_from_good_copy(bdev == NULL) " 1578 "scrub_repair_page_from_good_copy(bdev == NULL) is unexpected");
1578 "is unexpected");
1579 return -EIO; 1579 return -EIO;
1580 } 1580 }
1581 1581
@@ -2961,7 +2961,8 @@ static noinline_for_stack int scrub_raid56_parity(struct scrub_ctx *sctx,
2961 (key.objectid < logic_start || 2961 (key.objectid < logic_start ||
2962 key.objectid + bytes > 2962 key.objectid + bytes >
2963 logic_start + map->stripe_len)) { 2963 logic_start + map->stripe_len)) {
2964 btrfs_err(fs_info, "scrub: tree block %llu spanning stripes, ignored. logical=%llu", 2964 btrfs_err(fs_info,
2965 "scrub: tree block %llu spanning stripes, ignored. logical=%llu",
2965 key.objectid, logic_start); 2966 key.objectid, logic_start);
2966 spin_lock(&sctx->stat_lock); 2967 spin_lock(&sctx->stat_lock);
2967 sctx->stat.uncorrectable_errors++; 2968 sctx->stat.uncorrectable_errors++;
@@ -3312,8 +3313,7 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx,
3312 key.objectid + bytes > 3313 key.objectid + bytes >
3313 logical + map->stripe_len)) { 3314 logical + map->stripe_len)) {
3314 btrfs_err(fs_info, 3315 btrfs_err(fs_info,
3315 "scrub: tree block %llu spanning " 3316 "scrub: tree block %llu spanning stripes, ignored. logical=%llu",
3316 "stripes, ignored. logical=%llu",
3317 key.objectid, logical); 3317 key.objectid, logical);
3318 spin_lock(&sctx->stat_lock); 3318 spin_lock(&sctx->stat_lock);
3319 sctx->stat.uncorrectable_errors++; 3319 sctx->stat.uncorrectable_errors++;
@@ -3640,7 +3640,8 @@ int scrub_enumerate_chunks(struct scrub_ctx *sctx,
3640 */ 3640 */
3641 ro_set = 0; 3641 ro_set = 0;
3642 } else { 3642 } else {
3643 btrfs_warn(fs_info, "failed setting block group ro, ret=%d\n", 3643 btrfs_warn(fs_info,
3644 "failed setting block group ro, ret=%d\n",
3644 ret); 3645 ret);
3645 btrfs_put_block_group(cache); 3646 btrfs_put_block_group(cache);
3646 break; 3647 break;
@@ -3861,8 +3862,7 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start,
3861 if (fs_info->chunk_root->sectorsize != PAGE_SIZE) { 3862 if (fs_info->chunk_root->sectorsize != PAGE_SIZE) {
3862 /* not supported for data w/o checksums */ 3863 /* not supported for data w/o checksums */
3863 btrfs_err_rl(fs_info, 3864 btrfs_err_rl(fs_info,
3864 "scrub: size assumption sectorsize != PAGE_SIZE " 3865 "scrub: size assumption sectorsize != PAGE_SIZE (%d != %lu) fails",
3865 "(%d != %lu) fails",
3866 fs_info->chunk_root->sectorsize, PAGE_SIZE); 3866 fs_info->chunk_root->sectorsize, PAGE_SIZE);
3867 return -EINVAL; 3867 return -EINVAL;
3868 } 3868 }
@@ -3875,8 +3875,8 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start,
3875 * would exhaust the array bounds of pagev member in 3875 * would exhaust the array bounds of pagev member in
3876 * struct scrub_block 3876 * struct scrub_block
3877 */ 3877 */
3878 btrfs_err(fs_info, "scrub: size assumption nodesize and sectorsize " 3878 btrfs_err(fs_info,
3879 "<= SCRUB_MAX_PAGES_PER_BLOCK (%d <= %d && %d <= %d) fails", 3879 "scrub: size assumption nodesize and sectorsize <= SCRUB_MAX_PAGES_PER_BLOCK (%d <= %d && %d <= %d) fails",
3880 fs_info->chunk_root->nodesize, 3880 fs_info->chunk_root->nodesize,
3881 SCRUB_MAX_PAGES_PER_BLOCK, 3881 SCRUB_MAX_PAGES_PER_BLOCK,
3882 fs_info->chunk_root->sectorsize, 3882 fs_info->chunk_root->sectorsize,
@@ -4202,10 +4202,10 @@ static void copy_nocow_pages_worker(struct btrfs_work *work)
4202 ret = iterate_inodes_from_logical(logical, fs_info, path, 4202 ret = iterate_inodes_from_logical(logical, fs_info, path,
4203 record_inode_for_nocow, nocow_ctx); 4203 record_inode_for_nocow, nocow_ctx);
4204 if (ret != 0 && ret != -ENOENT) { 4204 if (ret != 0 && ret != -ENOENT) {
4205 btrfs_warn(fs_info, "iterate_inodes_from_logical() failed: log %llu, " 4205 btrfs_warn(fs_info,
4206 "phys %llu, len %llu, mir %u, ret %d", 4206 "iterate_inodes_from_logical() failed: log %llu, phys %llu, len %llu, mir %u, ret %d",
4207 logical, physical_for_dev_replace, len, mirror_num, 4207 logical, physical_for_dev_replace, len, mirror_num,
4208 ret); 4208 ret);
4209 not_written = 1; 4209 not_written = 1;
4210 goto out; 4210 goto out;
4211 } 4211 }
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index bc7185c20f32..1f4e78d8b0fe 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -1439,16 +1439,13 @@ static int find_extent_clone(struct send_ctx *sctx,
1439 if (!backref_ctx->found_itself) { 1439 if (!backref_ctx->found_itself) {
1440 /* found a bug in backref code? */ 1440 /* found a bug in backref code? */
1441 ret = -EIO; 1441 ret = -EIO;
1442 btrfs_err(sctx->send_root->fs_info, "did not find backref in " 1442 btrfs_err(sctx->send_root->fs_info,
1443 "send_root. inode=%llu, offset=%llu, " 1443 "did not find backref in send_root. inode=%llu, offset=%llu, disk_byte=%llu found extent=%llu",
1444 "disk_byte=%llu found extent=%llu",
1445 ino, data_offset, disk_byte, found_key.objectid); 1444 ino, data_offset, disk_byte, found_key.objectid);
1446 goto out; 1445 goto out;
1447 } 1446 }
1448 1447
1449verbose_printk(KERN_DEBUG "btrfs: find_extent_clone: data_offset=%llu, " 1448verbose_printk(KERN_DEBUG "btrfs: find_extent_clone: data_offset=%llu, ino=%llu, num_bytes=%llu, logical=%llu\n",
1450 "ino=%llu, "
1451 "num_bytes=%llu, logical=%llu\n",
1452 data_offset, ino, num_bytes, logical); 1449 data_offset, ino, num_bytes, logical);
1453 1450
1454 if (!backref_ctx->found) 1451 if (!backref_ctx->found)
@@ -4710,9 +4707,8 @@ static int send_clone(struct send_ctx *sctx,
4710 struct fs_path *p; 4707 struct fs_path *p;
4711 u64 gen; 4708 u64 gen;
4712 4709
4713verbose_printk("btrfs: send_clone offset=%llu, len=%d, clone_root=%llu, " 4710verbose_printk("btrfs: send_clone offset=%llu, len=%d, clone_root=%llu, clone_inode=%llu, clone_offset=%llu\n",
4714 "clone_inode=%llu, clone_offset=%llu\n", offset, len, 4711 offset, len, clone_root->root->objectid, clone_root->ino,
4715 clone_root->root->objectid, clone_root->ino,
4716 clone_root->offset); 4712 clone_root->offset);
4717 4713
4718 p = fs_path_alloc(); 4714 p = fs_path_alloc();
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 21f2b2d87f37..cb45749df9c4 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -462,9 +462,11 @@ int btrfs_parse_options(struct btrfs_root *root, char *options,
462 case Opt_datasum: 462 case Opt_datasum:
463 if (btrfs_test_opt(info, NODATASUM)) { 463 if (btrfs_test_opt(info, NODATASUM)) {
464 if (btrfs_test_opt(info, NODATACOW)) 464 if (btrfs_test_opt(info, NODATACOW))
465 btrfs_info(root->fs_info, "setting datasum, datacow enabled"); 465 btrfs_info(root->fs_info,
466 "setting datasum, datacow enabled");
466 else 467 else
467 btrfs_info(root->fs_info, "setting datasum"); 468 btrfs_info(root->fs_info,
469 "setting datasum");
468 } 470 }
469 btrfs_clear_opt(info->mount_opt, NODATACOW); 471 btrfs_clear_opt(info->mount_opt, NODATACOW);
470 btrfs_clear_opt(info->mount_opt, NODATASUM); 472 btrfs_clear_opt(info->mount_opt, NODATASUM);
@@ -476,7 +478,8 @@ int btrfs_parse_options(struct btrfs_root *root, char *options,
476 btrfs_info(root->fs_info, 478 btrfs_info(root->fs_info,
477 "setting nodatacow, compression disabled"); 479 "setting nodatacow, compression disabled");
478 } else { 480 } else {
479 btrfs_info(root->fs_info, "setting nodatacow"); 481 btrfs_info(root->fs_info,
482 "setting nodatacow");
480 } 483 }
481 } 484 }
482 btrfs_clear_opt(info->mount_opt, COMPRESS); 485 btrfs_clear_opt(info->mount_opt, COMPRESS);
@@ -608,8 +611,9 @@ int btrfs_parse_options(struct btrfs_root *root, char *options,
608 info->alloc_start = memparse(num, NULL); 611 info->alloc_start = memparse(num, NULL);
609 mutex_unlock(&info->chunk_mutex); 612 mutex_unlock(&info->chunk_mutex);
610 kfree(num); 613 kfree(num);
611 btrfs_info(root->fs_info, "allocations start at %llu", 614 btrfs_info(root->fs_info,
612 info->alloc_start); 615 "allocations start at %llu",
616 info->alloc_start);
613 } else { 617 } else {
614 ret = -ENOMEM; 618 ret = -ENOMEM;
615 goto out; 619 goto out;
@@ -762,8 +766,9 @@ int btrfs_parse_options(struct btrfs_root *root, char *options,
762 goto out; 766 goto out;
763 } else if (intarg >= 0) { 767 } else if (intarg >= 0) {
764 info->check_integrity_print_mask = intarg; 768 info->check_integrity_print_mask = intarg;
765 btrfs_info(root->fs_info, "check_integrity_print_mask 0x%x", 769 btrfs_info(root->fs_info,
766 info->check_integrity_print_mask); 770 "check_integrity_print_mask 0x%x",
771 info->check_integrity_print_mask);
767 } else { 772 } else {
768 ret = -EINVAL; 773 ret = -EINVAL;
769 goto out; 774 goto out;
@@ -794,19 +799,22 @@ int btrfs_parse_options(struct btrfs_root *root, char *options,
794 intarg = 0; 799 intarg = 0;
795 ret = match_int(&args[0], &intarg); 800 ret = match_int(&args[0], &intarg);
796 if (ret < 0) { 801 if (ret < 0) {
797 btrfs_err(root->fs_info, "invalid commit interval"); 802 btrfs_err(root->fs_info,
803 "invalid commit interval");
798 ret = -EINVAL; 804 ret = -EINVAL;
799 goto out; 805 goto out;
800 } 806 }
801 if (intarg > 0) { 807 if (intarg > 0) {
802 if (intarg > 300) { 808 if (intarg > 300) {
803 btrfs_warn(root->fs_info, "excessive commit interval %d", 809 btrfs_warn(root->fs_info,
804 intarg); 810 "excessive commit interval %d",
811 intarg);
805 } 812 }
806 info->commit_interval = intarg; 813 info->commit_interval = intarg;
807 } else { 814 } else {
808 btrfs_info(root->fs_info, "using default commit interval %ds", 815 btrfs_info(root->fs_info,
809 BTRFS_DEFAULT_COMMIT_INTERVAL); 816 "using default commit interval %ds",
817 BTRFS_DEFAULT_COMMIT_INTERVAL);
810 info->commit_interval = BTRFS_DEFAULT_COMMIT_INTERVAL; 818 info->commit_interval = BTRFS_DEFAULT_COMMIT_INTERVAL;
811 } 819 }
812 break; 820 break;
@@ -827,7 +835,8 @@ int btrfs_parse_options(struct btrfs_root *root, char *options,
827 break; 835 break;
828#endif 836#endif
829 case Opt_err: 837 case Opt_err:
830 btrfs_info(root->fs_info, "unrecognized mount option '%s'", p); 838 btrfs_info(root->fs_info,
839 "unrecognized mount option '%s'", p);
831 ret = -EINVAL; 840 ret = -EINVAL;
832 goto out; 841 goto out;
833 default: 842 default:
@@ -917,8 +926,7 @@ static int btrfs_parse_early_options(const char *options, fmode_t flags,
917 break; 926 break;
918 case Opt_subvolrootid: 927 case Opt_subvolrootid:
919 printk(KERN_WARNING 928 printk(KERN_WARNING
920 "BTRFS: 'subvolrootid' mount option is deprecated and has " 929 "BTRFS: 'subvolrootid' mount option is deprecated and has no effect\n");
921 "no effect\n");
922 break; 930 break;
923 case Opt_device: 931 case Opt_device:
924 device_name = match_strdup(&args[0]); 932 device_name = match_strdup(&args[0]);
@@ -1830,7 +1838,9 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
1830 btrfs_info(fs_info, "creating UUID tree"); 1838 btrfs_info(fs_info, "creating UUID tree");
1831 ret = btrfs_create_uuid_tree(fs_info); 1839 ret = btrfs_create_uuid_tree(fs_info);
1832 if (ret) { 1840 if (ret) {
1833 btrfs_warn(fs_info, "failed to create the UUID tree %d", ret); 1841 btrfs_warn(fs_info,
1842 "failed to create the UUID tree %d",
1843 ret);
1834 goto restore; 1844 goto restore;
1835 } 1845 }
1836 } 1846 }
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index e498a472ac20..e5ab27ecbf90 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -430,7 +430,8 @@ static ssize_t btrfs_sectorsize_show(struct kobject *kobj,
430{ 430{
431 struct btrfs_fs_info *fs_info = to_fs_info(kobj); 431 struct btrfs_fs_info *fs_info = to_fs_info(kobj);
432 432
433 return snprintf(buf, PAGE_SIZE, "%u\n", fs_info->super_copy->sectorsize); 433 return snprintf(buf, PAGE_SIZE, "%u\n",
434 fs_info->super_copy->sectorsize);
434} 435}
435 436
436BTRFS_ATTR(sectorsize, btrfs_sectorsize_show); 437BTRFS_ATTR(sectorsize, btrfs_sectorsize_show);
@@ -440,7 +441,8 @@ static ssize_t btrfs_clone_alignment_show(struct kobject *kobj,
440{ 441{
441 struct btrfs_fs_info *fs_info = to_fs_info(kobj); 442 struct btrfs_fs_info *fs_info = to_fs_info(kobj);
442 443
443 return snprintf(buf, PAGE_SIZE, "%u\n", fs_info->super_copy->sectorsize); 444 return snprintf(buf, PAGE_SIZE, "%u\n",
445 fs_info->super_copy->sectorsize);
444} 446}
445 447
446BTRFS_ATTR(clone_alignment, btrfs_clone_alignment_show); 448BTRFS_ATTR(clone_alignment, btrfs_clone_alignment_show);
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 2ce9115a55fd..a80b9a09474d 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -272,11 +272,9 @@ loop:
272 */ 272 */
273 smp_mb(); 273 smp_mb();
274 if (!list_empty(&fs_info->tree_mod_seq_list)) 274 if (!list_empty(&fs_info->tree_mod_seq_list))
275 WARN(1, KERN_ERR "BTRFS: tree_mod_seq_list not empty when " 275 WARN(1, KERN_ERR "BTRFS: tree_mod_seq_list not empty when creating a fresh transaction\n");
276 "creating a fresh transaction\n");
277 if (!RB_EMPTY_ROOT(&fs_info->tree_mod_log)) 276 if (!RB_EMPTY_ROOT(&fs_info->tree_mod_log))
278 WARN(1, KERN_ERR "BTRFS: tree_mod_log rb tree not empty when " 277 WARN(1, KERN_ERR "BTRFS: tree_mod_log rb tree not empty when creating a fresh transaction\n");
279 "creating a fresh transaction\n");
280 atomic64_set(&fs_info->tree_mod_seq, 0); 278 atomic64_set(&fs_info->tree_mod_seq, 0);
281 279
282 spin_lock_init(&cur_trans->delayed_refs.lock); 280 spin_lock_init(&cur_trans->delayed_refs.lock);
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index d22adf4fea7e..688df71c1bf7 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -5592,8 +5592,8 @@ int btrfs_recover_log_trees(struct btrfs_root *log_root_tree)
5592 5592
5593 ret = walk_log_tree(trans, log_root_tree, &wc); 5593 ret = walk_log_tree(trans, log_root_tree, &wc);
5594 if (ret) { 5594 if (ret) {
5595 btrfs_handle_fs_error(fs_info, ret, "Failed to pin buffers while " 5595 btrfs_handle_fs_error(fs_info, ret,
5596 "recovering log root tree."); 5596 "Failed to pin buffers while recovering log root tree.");
5597 goto error; 5597 goto error;
5598 } 5598 }
5599 5599
@@ -5639,8 +5639,8 @@ again:
5639 free_extent_buffer(log->node); 5639 free_extent_buffer(log->node);
5640 free_extent_buffer(log->commit_root); 5640 free_extent_buffer(log->commit_root);
5641 kfree(log); 5641 kfree(log);
5642 btrfs_handle_fs_error(fs_info, ret, "Couldn't read target root " 5642 btrfs_handle_fs_error(fs_info, ret,
5643 "for tree log recovery."); 5643 "Couldn't read target root for tree log recovery.");
5644 goto error; 5644 goto error;
5645 } 5645 }
5646 5646
diff --git a/fs/btrfs/uuid-tree.c b/fs/btrfs/uuid-tree.c
index 778282944530..7fc89e4adb41 100644
--- a/fs/btrfs/uuid-tree.c
+++ b/fs/btrfs/uuid-tree.c
@@ -69,8 +69,9 @@ static int btrfs_uuid_tree_lookup(struct btrfs_root *uuid_root, u8 *uuid,
69 ret = -ENOENT; 69 ret = -ENOENT;
70 70
71 if (!IS_ALIGNED(item_size, sizeof(u64))) { 71 if (!IS_ALIGNED(item_size, sizeof(u64))) {
72 btrfs_warn(uuid_root->fs_info, "uuid item with illegal size %lu!", 72 btrfs_warn(uuid_root->fs_info,
73 (unsigned long)item_size); 73 "uuid item with illegal size %lu!",
74 (unsigned long)item_size);
74 goto out; 75 goto out;
75 } 76 }
76 while (item_size) { 77 while (item_size) {
@@ -137,10 +138,10 @@ int btrfs_uuid_tree_add(struct btrfs_trans_handle *trans,
137 offset = btrfs_item_ptr_offset(eb, slot); 138 offset = btrfs_item_ptr_offset(eb, slot);
138 offset += btrfs_item_size_nr(eb, slot) - sizeof(subid_le); 139 offset += btrfs_item_size_nr(eb, slot) - sizeof(subid_le);
139 } else if (ret < 0) { 140 } else if (ret < 0) {
140 btrfs_warn(uuid_root->fs_info, "insert uuid item failed %d " 141 btrfs_warn(uuid_root->fs_info,
141 "(0x%016llx, 0x%016llx) type %u!", 142 "insert uuid item failed %d (0x%016llx, 0x%016llx) type %u!",
142 ret, (unsigned long long)key.objectid, 143 ret, (unsigned long long)key.objectid,
143 (unsigned long long)key.offset, type); 144 (unsigned long long)key.offset, type);
144 goto out; 145 goto out;
145 } 146 }
146 147
@@ -184,8 +185,8 @@ int btrfs_uuid_tree_rem(struct btrfs_trans_handle *trans,
184 185
185 ret = btrfs_search_slot(trans, uuid_root, &key, path, -1, 1); 186 ret = btrfs_search_slot(trans, uuid_root, &key, path, -1, 1);
186 if (ret < 0) { 187 if (ret < 0) {
187 btrfs_warn(uuid_root->fs_info, "error %d while searching for uuid item!", 188 btrfs_warn(uuid_root->fs_info,
188 ret); 189 "error %d while searching for uuid item!", ret);
189 goto out; 190 goto out;
190 } 191 }
191 if (ret > 0) { 192 if (ret > 0) {
@@ -198,8 +199,9 @@ int btrfs_uuid_tree_rem(struct btrfs_trans_handle *trans,
198 offset = btrfs_item_ptr_offset(eb, slot); 199 offset = btrfs_item_ptr_offset(eb, slot);
199 item_size = btrfs_item_size_nr(eb, slot); 200 item_size = btrfs_item_size_nr(eb, slot);
200 if (!IS_ALIGNED(item_size, sizeof(u64))) { 201 if (!IS_ALIGNED(item_size, sizeof(u64))) {
201 btrfs_warn(uuid_root->fs_info, "uuid item with illegal size %lu!", 202 btrfs_warn(uuid_root->fs_info,
202 (unsigned long)item_size); 203 "uuid item with illegal size %lu!",
204 (unsigned long)item_size);
203 ret = -ENOENT; 205 ret = -ENOENT;
204 goto out; 206 goto out;
205 } 207 }
@@ -299,8 +301,9 @@ again_search_slot:
299 offset = btrfs_item_ptr_offset(leaf, slot); 301 offset = btrfs_item_ptr_offset(leaf, slot);
300 item_size = btrfs_item_size_nr(leaf, slot); 302 item_size = btrfs_item_size_nr(leaf, slot);
301 if (!IS_ALIGNED(item_size, sizeof(u64))) { 303 if (!IS_ALIGNED(item_size, sizeof(u64))) {
302 btrfs_warn(fs_info, "uuid item with illegal size %lu!", 304 btrfs_warn(fs_info,
303 (unsigned long)item_size); 305 "uuid item with illegal size %lu!",
306 (unsigned long)item_size);
304 goto skip; 307 goto skip;
305 } 308 }
306 while (item_size) { 309 while (item_size) {
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index be2c8b35c3ae..3fd983dd722f 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -2478,9 +2478,7 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path)
2478 ret = btrfs_relocate_sys_chunks(root); 2478 ret = btrfs_relocate_sys_chunks(root);
2479 if (ret < 0) 2479 if (ret < 0)
2480 btrfs_handle_fs_error(root->fs_info, ret, 2480 btrfs_handle_fs_error(root->fs_info, ret,
2481 "Failed to relocate sys chunks after " 2481 "Failed to relocate sys chunks after device initialization. This can be fixed using the \"btrfs balance\" command.");
2482 "device initialization. This can be fixed "
2483 "using the \"btrfs balance\" command.");
2484 trans = btrfs_attach_transaction(root); 2482 trans = btrfs_attach_transaction(root);
2485 if (IS_ERR(trans)) { 2483 if (IS_ERR(trans)) {
2486 if (PTR_ERR(trans) == -ENOENT) 2484 if (PTR_ERR(trans) == -ENOENT)
@@ -2539,7 +2537,8 @@ int btrfs_init_dev_replace_tgtdev(struct btrfs_root *root, char *device_path,
2539 devices = &fs_info->fs_devices->devices; 2537 devices = &fs_info->fs_devices->devices;
2540 list_for_each_entry(device, devices, dev_list) { 2538 list_for_each_entry(device, devices, dev_list) {
2541 if (device->bdev == bdev) { 2539 if (device->bdev == bdev) {
2542 btrfs_err(fs_info, "target device is in the filesystem!"); 2540 btrfs_err(fs_info,
2541 "target device is in the filesystem!");
2543 ret = -EEXIST; 2542 ret = -EEXIST;
2544 goto error; 2543 goto error;
2545 } 2544 }
@@ -2548,7 +2547,8 @@ int btrfs_init_dev_replace_tgtdev(struct btrfs_root *root, char *device_path,
2548 2547
2549 if (i_size_read(bdev->bd_inode) < 2548 if (i_size_read(bdev->bd_inode) <
2550 btrfs_device_get_total_bytes(srcdev)) { 2549 btrfs_device_get_total_bytes(srcdev)) {
2551 btrfs_err(fs_info, "target device is smaller than source device!"); 2550 btrfs_err(fs_info,
2551 "target device is smaller than source device!");
2552 ret = -EINVAL; 2552 ret = -EINVAL;
2553 goto error; 2553 goto error;
2554 } 2554 }
@@ -3678,7 +3678,7 @@ error:
3678 btrfs_free_path(path); 3678 btrfs_free_path(path);
3679 if (enospc_errors) { 3679 if (enospc_errors) {
3680 btrfs_info(fs_info, "%d enospc errors during balance", 3680 btrfs_info(fs_info, "%d enospc errors during balance",
3681 enospc_errors); 3681 enospc_errors);
3682 if (!ret) 3682 if (!ret)
3683 ret = -ENOSPC; 3683 ret = -ENOSPC;
3684 } 3684 }
@@ -3772,8 +3772,8 @@ int btrfs_balance(struct btrfs_balance_control *bctl,
3772 if (!(bctl->flags & BTRFS_BALANCE_DATA) || 3772 if (!(bctl->flags & BTRFS_BALANCE_DATA) ||
3773 !(bctl->flags & BTRFS_BALANCE_METADATA) || 3773 !(bctl->flags & BTRFS_BALANCE_METADATA) ||
3774 memcmp(&bctl->data, &bctl->meta, sizeof(bctl->data))) { 3774 memcmp(&bctl->data, &bctl->meta, sizeof(bctl->data))) {
3775 btrfs_err(fs_info, "with mixed groups data and " 3775 btrfs_err(fs_info,
3776 "metadata balance options must be the same"); 3776 "with mixed groups data and metadata balance options must be the same");
3777 ret = -EINVAL; 3777 ret = -EINVAL;
3778 goto out; 3778 goto out;
3779 } 3779 }
@@ -3795,23 +3795,23 @@ int btrfs_balance(struct btrfs_balance_control *bctl,
3795 allowed |= (BTRFS_BLOCK_GROUP_RAID10 | 3795 allowed |= (BTRFS_BLOCK_GROUP_RAID10 |
3796 BTRFS_BLOCK_GROUP_RAID6); 3796 BTRFS_BLOCK_GROUP_RAID6);
3797 if (validate_convert_profile(&bctl->data, allowed)) { 3797 if (validate_convert_profile(&bctl->data, allowed)) {
3798 btrfs_err(fs_info, "unable to start balance with target " 3798 btrfs_err(fs_info,
3799 "data profile %llu", 3799 "unable to start balance with target data profile %llu",
3800 bctl->data.target); 3800 bctl->data.target);
3801 ret = -EINVAL; 3801 ret = -EINVAL;
3802 goto out; 3802 goto out;
3803 } 3803 }
3804 if (validate_convert_profile(&bctl->meta, allowed)) { 3804 if (validate_convert_profile(&bctl->meta, allowed)) {
3805 btrfs_err(fs_info, 3805 btrfs_err(fs_info,
3806 "unable to start balance with target metadata profile %llu", 3806 "unable to start balance with target metadata profile %llu",
3807 bctl->meta.target); 3807 bctl->meta.target);
3808 ret = -EINVAL; 3808 ret = -EINVAL;
3809 goto out; 3809 goto out;
3810 } 3810 }
3811 if (validate_convert_profile(&bctl->sys, allowed)) { 3811 if (validate_convert_profile(&bctl->sys, allowed)) {
3812 btrfs_err(fs_info, 3812 btrfs_err(fs_info,
3813 "unable to start balance with target system profile %llu", 3813 "unable to start balance with target system profile %llu",
3814 bctl->sys.target); 3814 bctl->sys.target);
3815 ret = -EINVAL; 3815 ret = -EINVAL;
3816 goto out; 3816 goto out;
3817 } 3817 }
@@ -3831,10 +3831,11 @@ int btrfs_balance(struct btrfs_balance_control *bctl,
3831 (fs_info->avail_metadata_alloc_bits & allowed) && 3831 (fs_info->avail_metadata_alloc_bits & allowed) &&
3832 !(bctl->meta.target & allowed))) { 3832 !(bctl->meta.target & allowed))) {
3833 if (bctl->flags & BTRFS_BALANCE_FORCE) { 3833 if (bctl->flags & BTRFS_BALANCE_FORCE) {
3834 btrfs_info(fs_info, "force reducing metadata integrity"); 3834 btrfs_info(fs_info,
3835 "force reducing metadata integrity");
3835 } else { 3836 } else {
3836 btrfs_err(fs_info, "balance will reduce metadata " 3837 btrfs_err(fs_info,
3837 "integrity, use force if you want this"); 3838 "balance will reduce metadata integrity, use force if you want this");
3838 ret = -EINVAL; 3839 ret = -EINVAL;
3839 goto out; 3840 goto out;
3840 } 3841 }
@@ -3844,8 +3845,8 @@ int btrfs_balance(struct btrfs_balance_control *bctl,
3844 if (btrfs_get_num_tolerated_disk_barrier_failures(bctl->meta.target) < 3845 if (btrfs_get_num_tolerated_disk_barrier_failures(bctl->meta.target) <
3845 btrfs_get_num_tolerated_disk_barrier_failures(bctl->data.target)) { 3846 btrfs_get_num_tolerated_disk_barrier_failures(bctl->data.target)) {
3846 btrfs_warn(fs_info, 3847 btrfs_warn(fs_info,
3847 "metadata profile 0x%llx has lower redundancy than data profile 0x%llx", 3848 "metadata profile 0x%llx has lower redundancy than data profile 0x%llx",
3848 bctl->meta.target, bctl->data.target); 3849 bctl->meta.target, bctl->data.target);
3849 } 3850 }
3850 3851
3851 if (bctl->sys.flags & BTRFS_BALANCE_ARGS_CONVERT) { 3852 if (bctl->sys.flags & BTRFS_BALANCE_ARGS_CONVERT) {
@@ -4893,15 +4894,16 @@ int btrfs_finish_chunk_alloc(struct btrfs_trans_handle *trans,
4893 read_unlock(&em_tree->lock); 4894 read_unlock(&em_tree->lock);
4894 4895
4895 if (!em) { 4896 if (!em) {
4896 btrfs_crit(extent_root->fs_info, "unable to find logical " 4897 btrfs_crit(extent_root->fs_info,
4897 "%Lu len %Lu", chunk_offset, chunk_size); 4898 "unable to find logical %Lu len %Lu",
4899 chunk_offset, chunk_size);
4898 return -EINVAL; 4900 return -EINVAL;
4899 } 4901 }
4900 4902
4901 if (em->start != chunk_offset || em->len != chunk_size) { 4903 if (em->start != chunk_offset || em->len != chunk_size) {
4902 btrfs_crit(extent_root->fs_info, "found a bad mapping, wanted" 4904 btrfs_crit(extent_root->fs_info,
4903 " %Lu-%Lu, found %Lu-%Lu", chunk_offset, 4905 "found a bad mapping, wanted %Lu-%Lu, found %Lu-%Lu",
4904 chunk_size, em->start, em->len); 4906 chunk_offset, chunk_size, em->start, em->len);
4905 free_extent_map(em); 4907 free_extent_map(em);
4906 return -EINVAL; 4908 return -EINVAL;
4907 } 4909 }
@@ -5134,9 +5136,9 @@ int btrfs_num_copies(struct btrfs_fs_info *fs_info, u64 logical, u64 len)
5134 } 5136 }
5135 5137
5136 if (em->start > logical || em->start + em->len < logical) { 5138 if (em->start > logical || em->start + em->len < logical) {
5137 btrfs_crit(fs_info, "Invalid mapping for %Lu-%Lu, got " 5139 btrfs_crit(fs_info, "Invalid mapping for %Lu-%Lu, got %Lu-%Lu",
5138 "%Lu-%Lu", logical, logical+len, em->start, 5140 logical, logical+len, em->start,
5139 em->start + em->len); 5141 em->start + em->len);
5140 free_extent_map(em); 5142 free_extent_map(em);
5141 return 1; 5143 return 1;
5142 } 5144 }
@@ -5350,9 +5352,9 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int op,
5350 } 5352 }
5351 5353
5352 if (em->start > logical || em->start + em->len < logical) { 5354 if (em->start > logical || em->start + em->len < logical) {
5353 btrfs_crit(fs_info, "found a bad mapping, wanted %Lu, " 5355 btrfs_crit(fs_info,
5354 "found %Lu-%Lu", logical, em->start, 5356 "found a bad mapping, wanted %Lu, found %Lu-%Lu",
5355 em->start + em->len); 5357 logical, em->start, em->start + em->len);
5356 free_extent_map(em); 5358 free_extent_map(em);
5357 return -EINVAL; 5359 return -EINVAL;
5358 } 5360 }
@@ -5370,9 +5372,8 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int op,
5370 5372
5371 stripe_offset = stripe_nr * stripe_len; 5373 stripe_offset = stripe_nr * stripe_len;
5372 if (offset < stripe_offset) { 5374 if (offset < stripe_offset) {
5373 btrfs_crit(fs_info, "stripe math has gone wrong, " 5375 btrfs_crit(fs_info,
5374 "stripe_offset=%llu, offset=%llu, start=%llu, " 5376 "stripe math has gone wrong, stripe_offset=%llu, offset=%llu, start=%llu, logical=%llu, stripe_len=%llu",
5375 "logical=%llu, stripe_len=%llu",
5376 stripe_offset, offset, em->start, logical, 5377 stripe_offset, offset, em->start, logical,
5377 stripe_len); 5378 stripe_len);
5378 free_extent_map(em); 5379 free_extent_map(em);
@@ -5622,8 +5623,8 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int op,
5622 mirror_num = stripe_index + 1; 5623 mirror_num = stripe_index + 1;
5623 } 5624 }
5624 if (stripe_index >= map->num_stripes) { 5625 if (stripe_index >= map->num_stripes) {
5625 btrfs_crit(fs_info, "stripe index math went horribly wrong, " 5626 btrfs_crit(fs_info,
5626 "got stripe_index=%u, num_stripes=%u", 5627 "stripe index math went horribly wrong, got stripe_index=%u, num_stripes=%u",
5627 stripe_index, map->num_stripes); 5628 stripe_index, map->num_stripes);
5628 ret = -EINVAL; 5629 ret = -EINVAL;
5629 goto out; 5630 goto out;
@@ -6117,10 +6118,10 @@ static void submit_stripe_bio(struct btrfs_root *root, struct btrfs_bio *bbio,
6117 6118
6118 rcu_read_lock(); 6119 rcu_read_lock();
6119 name = rcu_dereference(dev->name); 6120 name = rcu_dereference(dev->name);
6120 pr_debug("btrfs_map_bio: rw %d 0x%x, sector=%llu, dev=%lu " 6121 pr_debug("btrfs_map_bio: rw %d 0x%x, sector=%llu, dev=%lu (%s id %llu), size=%u\n",
6121 "(%s id %llu), size=%u\n", bio_op(bio), bio->bi_opf, 6122 bio_op(bio), bio->bi_opf, (u64)bio->bi_iter.bi_sector,
6122 (u64)bio->bi_iter.bi_sector, (u_long)dev->bdev->bd_dev, 6123 (u_long)dev->bdev->bd_dev, name->str, dev->devid,
6123 name->str, dev->devid, bio->bi_iter.bi_size); 6124 bio->bi_iter.bi_size);
6124 rcu_read_unlock(); 6125 rcu_read_unlock();
6125 } 6126 }
6126#endif 6127#endif
@@ -6195,8 +6196,9 @@ int btrfs_map_bio(struct btrfs_root *root, struct bio *bio,
6195 } 6196 }
6196 6197
6197 if (map_length < length) { 6198 if (map_length < length) {
6198 btrfs_crit(root->fs_info, "mapping failed logical %llu bio len %llu len %llu", 6199 btrfs_crit(root->fs_info,
6199 logical, length, map_length); 6200 "mapping failed logical %llu bio len %llu len %llu",
6201 logical, length, map_length);
6200 BUG(); 6202 BUG();
6201 } 6203 }
6202 6204
@@ -6463,8 +6465,9 @@ static int read_one_chunk(struct btrfs_root *root, struct btrfs_key *key,
6463 free_extent_map(em); 6465 free_extent_map(em);
6464 return -EIO; 6466 return -EIO;
6465 } 6467 }
6466 btrfs_warn(root->fs_info, "devid %llu uuid %pU is missing", 6468 btrfs_warn(root->fs_info,
6467 devid, uuid); 6469 "devid %llu uuid %pU is missing",
6470 devid, uuid);
6468 } 6471 }
6469 map->stripes[i].dev->in_fs_metadata = 1; 6472 map->stripes[i].dev->in_fs_metadata = 1;
6470 } 6473 }
@@ -7075,10 +7078,12 @@ int btrfs_get_dev_stats(struct btrfs_root *root,
7075 mutex_unlock(&fs_devices->device_list_mutex); 7078 mutex_unlock(&fs_devices->device_list_mutex);
7076 7079
7077 if (!dev) { 7080 if (!dev) {
7078 btrfs_warn(root->fs_info, "get dev_stats failed, device not found"); 7081 btrfs_warn(root->fs_info,
7082 "get dev_stats failed, device not found");
7079 return -ENODEV; 7083 return -ENODEV;
7080 } else if (!dev->dev_stats_valid) { 7084 } else if (!dev->dev_stats_valid) {
7081 btrfs_warn(root->fs_info, "get dev_stats failed, not yet valid"); 7085 btrfs_warn(root->fs_info,
7086 "get dev_stats failed, not yet valid");
7082 return -ENODEV; 7087 return -ENODEV;
7083 } else if (stats->flags & BTRFS_DEV_STATS_RESET) { 7088 } else if (stats->flags & BTRFS_DEV_STATS_RESET) {
7084 for (i = 0; i < BTRFS_DEV_STAT_VALUES_MAX; i++) { 7089 for (i = 0; i < BTRFS_DEV_STAT_VALUES_MAX; i++) {