aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
authorFrank Holton <fholton@gmail.com>2013-12-20 11:37:06 -0500
committerChris Mason <clm@fb.com>2014-01-28 16:20:05 -0500
commitefe120a067c8674a8ae21b194f0e68f098b61ee2 (patch)
tree1edb3b59b689a96ec15b548387c048ee959fb6fd /fs/btrfs
parent5de865eebb8330eee19c37b31fb6f315a09d4273 (diff)
Btrfs: convert printk to btrfs_ and fix BTRFS prefix
Convert all applicable cases of printk and pr_* to the btrfs_* macros. Fix all uses of the BTRFS prefix. Signed-off-by: Frank Holton <fholton@gmail.com> Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/compression.c12
-rw-r--r--fs/btrfs/ctree.c16
-rw-r--r--fs/btrfs/ctree.h4
-rw-r--r--fs/btrfs/delayed-inode.c8
-rw-r--r--fs/btrfs/dev-replace.c56
-rw-r--r--fs/btrfs/dir-item.c6
-rw-r--r--fs/btrfs/disk-io.c106
-rw-r--r--fs/btrfs/extent-tree.c14
-rw-r--r--fs/btrfs/extent_io.c61
-rw-r--r--fs/btrfs/file-item.c4
-rw-r--r--fs/btrfs/free-space-cache.c21
-rw-r--r--fs/btrfs/inode.c4
-rw-r--r--fs/btrfs/ioctl.c30
-rw-r--r--fs/btrfs/lzo.c6
-rw-r--r--fs/btrfs/ordered-data.c12
-rw-r--r--fs/btrfs/print-tree.c2
-rw-r--r--fs/btrfs/qgroup.c28
-rw-r--r--fs/btrfs/reada.c9
-rw-r--r--fs/btrfs/relocation.c4
-rw-r--r--fs/btrfs/root-tree.c4
-rw-r--r--fs/btrfs/scrub.c50
-rw-r--r--fs/btrfs/send.c4
-rw-r--r--fs/btrfs/super.c104
-rw-r--r--fs/btrfs/sysfs.c2
-rw-r--r--fs/btrfs/tests/btrfs-tests.h2
-rw-r--r--fs/btrfs/transaction.c8
-rw-r--r--fs/btrfs/uuid-tree.c13
-rw-r--r--fs/btrfs/volumes.c89
-rw-r--r--fs/btrfs/zlib.c8
29 files changed, 358 insertions, 329 deletions
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index 1499b27b4186..af815eb8f970 100644
--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -128,11 +128,10 @@ static int check_compressed_csum(struct inode *inode,
128 kunmap_atomic(kaddr); 128 kunmap_atomic(kaddr);
129 129
130 if (csum != *cb_sum) { 130 if (csum != *cb_sum) {
131 printk(KERN_INFO "btrfs csum failed ino %llu " 131 btrfs_info(BTRFS_I(inode)->root->fs_info,
132 "extent %llu csum %u " 132 "csum failed ino %llu extent %llu csum %u wanted %u mirror %d",
133 "wanted %u mirror %d\n", 133 btrfs_ino(inode), disk_start, csum, *cb_sum,
134 btrfs_ino(inode), disk_start, csum, *cb_sum, 134 cb->mirror_num);
135 cb->mirror_num);
136 ret = -EIO; 135 ret = -EIO;
137 goto fail; 136 goto fail;
138 } 137 }
@@ -412,7 +411,8 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start,
412 bio_add_page(bio, page, PAGE_CACHE_SIZE, 0); 411 bio_add_page(bio, page, PAGE_CACHE_SIZE, 0);
413 } 412 }
414 if (bytes_left < PAGE_CACHE_SIZE) { 413 if (bytes_left < PAGE_CACHE_SIZE) {
415 printk("bytes left %lu compress len %lu nr %lu\n", 414 btrfs_info(BTRFS_I(inode)->root->fs_info,
415 "bytes left %lu compress len %lu nr %lu",
416 bytes_left, cb->compressed_len, cb->nr_pages); 416 bytes_left, cb->compressed_len, cb->nr_pages);
417 } 417 }
418 bytes_left -= PAGE_CACHE_SIZE; 418 bytes_left -= PAGE_CACHE_SIZE;
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 7d88d8543aa1..062438d38985 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -1480,8 +1480,8 @@ get_old_root(struct btrfs_root *root, u64 time_seq)
1480 old = read_tree_block(root, logical, blocksize, 0); 1480 old = read_tree_block(root, logical, blocksize, 0);
1481 if (WARN_ON(!old || !extent_buffer_uptodate(old))) { 1481 if (WARN_ON(!old || !extent_buffer_uptodate(old))) {
1482 free_extent_buffer(old); 1482 free_extent_buffer(old);
1483 pr_warn("btrfs: failed to read tree block %llu from get_old_root\n", 1483 btrfs_warn(root->fs_info,
1484 logical); 1484 "failed to read tree block %llu from get_old_root", logical);
1485 } else { 1485 } else {
1486 eb = btrfs_clone_extent_buffer(old); 1486 eb = btrfs_clone_extent_buffer(old);
1487 free_extent_buffer(old); 1487 free_extent_buffer(old);
@@ -3611,8 +3611,8 @@ noinline int btrfs_leaf_free_space(struct btrfs_root *root,
3611 int ret; 3611 int ret;
3612 ret = BTRFS_LEAF_DATA_SIZE(root) - leaf_space_used(leaf, 0, nritems); 3612 ret = BTRFS_LEAF_DATA_SIZE(root) - leaf_space_used(leaf, 0, nritems);
3613 if (ret < 0) { 3613 if (ret < 0) {
3614 printk(KERN_CRIT "leaf free space ret %d, leaf data size %lu, " 3614 btrfs_crit(root->fs_info,
3615 "used %d nritems %d\n", 3615 "leaf free space ret %d, leaf data size %lu, used %d nritems %d",
3616 ret, (unsigned long) BTRFS_LEAF_DATA_SIZE(root), 3616 ret, (unsigned long) BTRFS_LEAF_DATA_SIZE(root),
3617 leaf_space_used(leaf, 0, nritems), nritems); 3617 leaf_space_used(leaf, 0, nritems), nritems);
3618 } 3618 }
@@ -4702,7 +4702,7 @@ void btrfs_extend_item(struct btrfs_root *root, struct btrfs_path *path,
4702 BUG_ON(slot < 0); 4702 BUG_ON(slot < 0);
4703 if (slot >= nritems) { 4703 if (slot >= nritems) {
4704 btrfs_print_leaf(root, leaf); 4704 btrfs_print_leaf(root, leaf);
4705 printk(KERN_CRIT "slot %d too large, nritems %d\n", 4705 btrfs_crit(root->fs_info, "slot %d too large, nritems %d",
4706 slot, nritems); 4706 slot, nritems);
4707 BUG_ON(1); 4707 BUG_ON(1);
4708 } 4708 }
@@ -4765,7 +4765,7 @@ void setup_items_for_insert(struct btrfs_root *root, struct btrfs_path *path,
4765 4765
4766 if (btrfs_leaf_free_space(root, leaf) < total_size) { 4766 if (btrfs_leaf_free_space(root, leaf) < total_size) {
4767 btrfs_print_leaf(root, leaf); 4767 btrfs_print_leaf(root, leaf);
4768 printk(KERN_CRIT "not enough freespace need %u have %d\n", 4768 btrfs_crit(root->fs_info, "not enough freespace need %u have %d",
4769 total_size, btrfs_leaf_free_space(root, leaf)); 4769 total_size, btrfs_leaf_free_space(root, leaf));
4770 BUG(); 4770 BUG();
4771 } 4771 }
@@ -4775,7 +4775,7 @@ void setup_items_for_insert(struct btrfs_root *root, struct btrfs_path *path,
4775 4775
4776 if (old_data < data_end) { 4776 if (old_data < data_end) {
4777 btrfs_print_leaf(root, leaf); 4777 btrfs_print_leaf(root, leaf);
4778 printk(KERN_CRIT "slot %d old_data %d data_end %d\n", 4778 btrfs_crit(root->fs_info, "slot %d old_data %d data_end %d",
4779 slot, old_data, data_end); 4779 slot, old_data, data_end);
4780 BUG_ON(1); 4780 BUG_ON(1);
4781 } 4781 }
@@ -5510,7 +5510,7 @@ int btrfs_compare_trees(struct btrfs_root *left_root,
5510 5510
5511 if (!left_start_ctransid || !right_start_ctransid) { 5511 if (!left_start_ctransid || !right_start_ctransid) {
5512 WARN(1, KERN_WARNING 5512 WARN(1, KERN_WARNING
5513 "btrfs: btrfs_compare_tree detected " 5513 "BTRFS: btrfs_compare_tree detected "
5514 "a change in one of the trees while " 5514 "a change in one of the trees while "
5515 "iterating. This is probably a " 5515 "iterating. This is probably a "
5516 "bug.\n"); 5516 "bug.\n");
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 9318c7520f50..5be778e62a29 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -3838,7 +3838,7 @@ void btrfs_printk(const struct btrfs_fs_info *fs_info, const char *fmt, ...)
3838 3838
3839static inline void assfail(char *expr, char *file, int line) 3839static inline void assfail(char *expr, char *file, int line)
3840{ 3840{
3841 printk(KERN_ERR "BTRFS assertion failed: %s, file: %s, line: %d", 3841 pr_err("BTRFS: assertion failed: %s, file: %s, line: %d",
3842 expr, file, line); 3842 expr, file, line);
3843 BUG(); 3843 BUG();
3844} 3844}
@@ -3876,7 +3876,7 @@ static inline void __btrfs_set_fs_incompat(struct btrfs_fs_info *fs_info,
3876 if (!(features & flag)) { 3876 if (!(features & flag)) {
3877 features |= flag; 3877 features |= flag;
3878 btrfs_set_super_incompat_flags(disk_super, features); 3878 btrfs_set_super_incompat_flags(disk_super, features);
3879 printk(KERN_INFO "btrfs: setting %llu feature flag\n", 3879 btrfs_info(fs_info, "setting %llu feature flag",
3880 flag); 3880 flag);
3881 } 3881 }
3882 spin_unlock(&fs_info->super_lock); 3882 spin_unlock(&fs_info->super_lock);
diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c
index 8d292fbae659..584194938612 100644
--- a/fs/btrfs/delayed-inode.c
+++ b/fs/btrfs/delayed-inode.c
@@ -1472,9 +1472,9 @@ int btrfs_insert_delayed_dir_index(struct btrfs_trans_handle *trans,
1472 mutex_lock(&delayed_node->mutex); 1472 mutex_lock(&delayed_node->mutex);
1473 ret = __btrfs_add_delayed_insertion_item(delayed_node, delayed_item); 1473 ret = __btrfs_add_delayed_insertion_item(delayed_node, delayed_item);
1474 if (unlikely(ret)) { 1474 if (unlikely(ret)) {
1475 printk(KERN_ERR "err add delayed dir index item(name: %.*s) " 1475 btrfs_err(root->fs_info, "err add delayed dir index item(name: %.*s) "
1476 "into the insertion tree of the delayed node" 1476 "into the insertion tree of the delayed node"
1477 "(root id: %llu, inode id: %llu, errno: %d)\n", 1477 "(root id: %llu, inode id: %llu, errno: %d)",
1478 name_len, name, delayed_node->root->objectid, 1478 name_len, name, delayed_node->root->objectid,
1479 delayed_node->inode_id, ret); 1479 delayed_node->inode_id, ret);
1480 BUG(); 1480 BUG();
@@ -1544,9 +1544,9 @@ int btrfs_delete_delayed_dir_index(struct btrfs_trans_handle *trans,
1544 mutex_lock(&node->mutex); 1544 mutex_lock(&node->mutex);
1545 ret = __btrfs_add_delayed_deletion_item(node, item); 1545 ret = __btrfs_add_delayed_deletion_item(node, item);
1546 if (unlikely(ret)) { 1546 if (unlikely(ret)) {
1547 printk(KERN_ERR "err add delayed dir index item(index: %llu) " 1547 btrfs_err(root->fs_info, "err add delayed dir index item(index: %llu) "
1548 "into the deletion tree of the delayed node" 1548 "into the deletion tree of the delayed node"
1549 "(root id: %llu, inode id: %llu, errno: %d)\n", 1549 "(root id: %llu, inode id: %llu, errno: %d)",
1550 index, node->root->objectid, node->inode_id, 1550 index, node->root->objectid, node->inode_id,
1551 ret); 1551 ret);
1552 BUG(); 1552 BUG();
diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
index 2cfc3dfff64f..564c92638b20 100644
--- a/fs/btrfs/dev-replace.c
+++ b/fs/btrfs/dev-replace.c
@@ -102,7 +102,8 @@ no_valid_dev_replace_entry_found:
102 ptr = btrfs_item_ptr(eb, slot, struct btrfs_dev_replace_item); 102 ptr = btrfs_item_ptr(eb, slot, struct btrfs_dev_replace_item);
103 103
104 if (item_size != sizeof(struct btrfs_dev_replace_item)) { 104 if (item_size != sizeof(struct btrfs_dev_replace_item)) {
105 pr_warn("btrfs: dev_replace entry found has unexpected size, ignore entry\n"); 105 btrfs_warn(fs_info,
106 "dev_replace entry found has unexpected size, ignore entry");
106 goto no_valid_dev_replace_entry_found; 107 goto no_valid_dev_replace_entry_found;
107 } 108 }
108 109
@@ -145,13 +146,19 @@ no_valid_dev_replace_entry_found:
145 if (!dev_replace->srcdev && 146 if (!dev_replace->srcdev &&
146 !btrfs_test_opt(dev_root, DEGRADED)) { 147 !btrfs_test_opt(dev_root, DEGRADED)) {
147 ret = -EIO; 148 ret = -EIO;
148 pr_warn("btrfs: cannot mount because device replace operation is ongoing and\n" "srcdev (devid %llu) is missing, need to run 'btrfs dev scan'?\n", 149 btrfs_warn(fs_info,
149 src_devid); 150 "cannot mount because device replace operation is ongoing and");
151 btrfs_warn(fs_info,
152 "srcdev (devid %llu) is missing, need to run 'btrfs dev scan'?",
153 src_devid);
150 } 154 }
151 if (!dev_replace->tgtdev && 155 if (!dev_replace->tgtdev &&
152 !btrfs_test_opt(dev_root, DEGRADED)) { 156 !btrfs_test_opt(dev_root, DEGRADED)) {
153 ret = -EIO; 157 ret = -EIO;
154 pr_warn("btrfs: cannot mount because device replace operation is ongoing and\n" "tgtdev (devid %llu) is missing, need to run btrfs dev scan?\n", 158 btrfs_warn(fs_info,
159 "cannot mount because device replace operation is ongoing and");
160 btrfs_warn(fs_info,
161 "tgtdev (devid %llu) is missing, need to run 'btrfs dev scan'?",
155 BTRFS_DEV_REPLACE_DEVID); 162 BTRFS_DEV_REPLACE_DEVID);
156 } 163 }
157 if (dev_replace->tgtdev) { 164 if (dev_replace->tgtdev) {
@@ -210,7 +217,7 @@ int btrfs_run_dev_replace(struct btrfs_trans_handle *trans,
210 } 217 }
211 ret = btrfs_search_slot(trans, dev_root, &key, path, -1, 1); 218 ret = btrfs_search_slot(trans, dev_root, &key, path, -1, 1);
212 if (ret < 0) { 219 if (ret < 0) {
213 pr_warn("btrfs: error %d while searching for dev_replace item!\n", 220 btrfs_warn(fs_info, "error %d while searching for dev_replace item!",
214 ret); 221 ret);
215 goto out; 222 goto out;
216 } 223 }
@@ -230,7 +237,7 @@ int btrfs_run_dev_replace(struct btrfs_trans_handle *trans,
230 */ 237 */
231 ret = btrfs_del_item(trans, dev_root, path); 238 ret = btrfs_del_item(trans, dev_root, path);
232 if (ret != 0) { 239 if (ret != 0) {
233 pr_warn("btrfs: delete too small dev_replace item failed %d!\n", 240 btrfs_warn(fs_info, "delete too small dev_replace item failed %d!",
234 ret); 241 ret);
235 goto out; 242 goto out;
236 } 243 }
@@ -243,7 +250,7 @@ int btrfs_run_dev_replace(struct btrfs_trans_handle *trans,
243 ret = btrfs_insert_empty_item(trans, dev_root, path, 250 ret = btrfs_insert_empty_item(trans, dev_root, path,
244 &key, sizeof(*ptr)); 251 &key, sizeof(*ptr));
245 if (ret < 0) { 252 if (ret < 0) {
246 pr_warn("btrfs: insert dev_replace item failed %d!\n", 253 btrfs_warn(fs_info, "insert dev_replace item failed %d!",
247 ret); 254 ret);
248 goto out; 255 goto out;
249 } 256 }
@@ -305,7 +312,7 @@ int btrfs_dev_replace_start(struct btrfs_root *root,
305 struct btrfs_device *src_device = NULL; 312 struct btrfs_device *src_device = NULL;
306 313
307 if (btrfs_fs_incompat(fs_info, RAID56)) { 314 if (btrfs_fs_incompat(fs_info, RAID56)) {
308 pr_warn("btrfs: dev_replace cannot yet handle RAID5/RAID6\n"); 315 btrfs_warn(fs_info, "dev_replace cannot yet handle RAID5/RAID6");
309 return -EINVAL; 316 return -EINVAL;
310 } 317 }
311 318
@@ -325,7 +332,7 @@ int btrfs_dev_replace_start(struct btrfs_root *root,
325 ret = btrfs_init_dev_replace_tgtdev(root, args->start.tgtdev_name, 332 ret = btrfs_init_dev_replace_tgtdev(root, args->start.tgtdev_name,
326 &tgt_device); 333 &tgt_device);
327 if (ret) { 334 if (ret) {
328 pr_err("btrfs: target device %s is invalid!\n", 335 btrfs_err(fs_info, "target device %s is invalid!",
329 args->start.tgtdev_name); 336 args->start.tgtdev_name);
330 mutex_unlock(&fs_info->volume_mutex); 337 mutex_unlock(&fs_info->volume_mutex);
331 return -EINVAL; 338 return -EINVAL;
@@ -341,7 +348,7 @@ int btrfs_dev_replace_start(struct btrfs_root *root,
341 } 348 }
342 349
343 if (tgt_device->total_bytes < src_device->total_bytes) { 350 if (tgt_device->total_bytes < src_device->total_bytes) {
344 pr_err("btrfs: target device is smaller than source device!\n"); 351 btrfs_err(fs_info, "target device is smaller than source device!");
345 ret = -EINVAL; 352 ret = -EINVAL;
346 goto leave_no_lock; 353 goto leave_no_lock;
347 } 354 }
@@ -366,7 +373,7 @@ int btrfs_dev_replace_start(struct btrfs_root *root,
366 dev_replace->tgtdev = tgt_device; 373 dev_replace->tgtdev = tgt_device;
367 374
368 printk_in_rcu(KERN_INFO 375 printk_in_rcu(KERN_INFO
369 "btrfs: dev_replace from %s (devid %llu) to %s started\n", 376 "BTRFS: dev_replace from %s (devid %llu) to %s started\n",
370 src_device->missing ? "<missing disk>" : 377 src_device->missing ? "<missing disk>" :
371 rcu_str_deref(src_device->name), 378 rcu_str_deref(src_device->name),
372 src_device->devid, 379 src_device->devid,
@@ -489,7 +496,7 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
489 496
490 if (scrub_ret) { 497 if (scrub_ret) {
491 printk_in_rcu(KERN_ERR 498 printk_in_rcu(KERN_ERR
492 "btrfs: btrfs_scrub_dev(%s, %llu, %s) failed %d\n", 499 "BTRFS: btrfs_scrub_dev(%s, %llu, %s) failed %d\n",
493 src_device->missing ? "<missing disk>" : 500 src_device->missing ? "<missing disk>" :
494 rcu_str_deref(src_device->name), 501 rcu_str_deref(src_device->name),
495 src_device->devid, 502 src_device->devid,
@@ -504,7 +511,7 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
504 } 511 }
505 512
506 printk_in_rcu(KERN_INFO 513 printk_in_rcu(KERN_INFO
507 "btrfs: dev_replace from %s (devid %llu) to %s) finished\n", 514 "BTRFS: dev_replace from %s (devid %llu) to %s) finished\n",
508 src_device->missing ? "<missing disk>" : 515 src_device->missing ? "<missing disk>" :
509 rcu_str_deref(src_device->name), 516 rcu_str_deref(src_device->name),
510 src_device->devid, 517 src_device->devid,
@@ -699,7 +706,7 @@ void btrfs_dev_replace_suspend_for_unmount(struct btrfs_fs_info *fs_info)
699 BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED; 706 BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED;
700 dev_replace->time_stopped = get_seconds(); 707 dev_replace->time_stopped = get_seconds();
701 dev_replace->item_needs_writeback = 1; 708 dev_replace->item_needs_writeback = 1;
702 pr_info("btrfs: suspending dev_replace for unmount\n"); 709 btrfs_info(fs_info, "suspending dev_replace for unmount");
703 break; 710 break;
704 } 711 }
705 712
@@ -728,8 +735,9 @@ int btrfs_resume_dev_replace_async(struct btrfs_fs_info *fs_info)
728 break; 735 break;
729 } 736 }
730 if (!dev_replace->tgtdev || !dev_replace->tgtdev->bdev) { 737 if (!dev_replace->tgtdev || !dev_replace->tgtdev->bdev) {
731 pr_info("btrfs: cannot continue dev_replace, tgtdev is missing\n" 738 btrfs_info(fs_info, "cannot continue dev_replace, tgtdev is missing");
732 "btrfs: you may cancel the operation after 'mount -o degraded'\n"); 739 btrfs_info(fs_info,
740 "you may cancel the operation after 'mount -o degraded'");
733 btrfs_dev_replace_unlock(dev_replace); 741 btrfs_dev_replace_unlock(dev_replace);
734 return 0; 742 return 0;
735 } 743 }
@@ -755,14 +763,14 @@ static int btrfs_dev_replace_kthread(void *data)
755 kfree(status_args); 763 kfree(status_args);
756 do_div(progress, 10); 764 do_div(progress, 10);
757 printk_in_rcu(KERN_INFO 765 printk_in_rcu(KERN_INFO
758 "btrfs: continuing dev_replace from %s (devid %llu) to %s @%u%%\n", 766 "BTRFS: continuing dev_replace from %s (devid %llu) to %s @%u%%\n",
759 dev_replace->srcdev->missing ? "<missing disk>" : 767 dev_replace->srcdev->missing ? "<missing disk>" :
760 rcu_str_deref(dev_replace->srcdev->name), 768 rcu_str_deref(dev_replace->srcdev->name),
761 dev_replace->srcdev->devid, 769 dev_replace->srcdev->devid,
762 dev_replace->tgtdev ? 770 dev_replace->tgtdev ?
763 rcu_str_deref(dev_replace->tgtdev->name) : 771 rcu_str_deref(dev_replace->tgtdev->name) :
764 "<missing target disk>", 772 "<missing target disk>",
765 (unsigned int)progress); 773 (unsigned int)progress);
766 } 774 }
767 btrfs_dev_replace_continue_on_mount(fs_info); 775 btrfs_dev_replace_continue_on_mount(fs_info);
768 atomic_set(&fs_info->mutually_exclusive_operation_running, 0); 776 atomic_set(&fs_info->mutually_exclusive_operation_running, 0);
diff --git a/fs/btrfs/dir-item.c b/fs/btrfs/dir-item.c
index 9a89ceb25e83..a0691df5dcea 100644
--- a/fs/btrfs/dir-item.c
+++ b/fs/btrfs/dir-item.c
@@ -459,7 +459,7 @@ int verify_dir_item(struct btrfs_root *root,
459 u8 type = btrfs_dir_type(leaf, dir_item); 459 u8 type = btrfs_dir_type(leaf, dir_item);
460 460
461 if (type >= BTRFS_FT_MAX) { 461 if (type >= BTRFS_FT_MAX) {
462 printk(KERN_CRIT "btrfs: invalid dir item type: %d\n", 462 btrfs_crit(root->fs_info, "invalid dir item type: %d",
463 (int)type); 463 (int)type);
464 return 1; 464 return 1;
465 } 465 }
@@ -468,7 +468,7 @@ int verify_dir_item(struct btrfs_root *root,
468 namelen = XATTR_NAME_MAX; 468 namelen = XATTR_NAME_MAX;
469 469
470 if (btrfs_dir_name_len(leaf, dir_item) > namelen) { 470 if (btrfs_dir_name_len(leaf, dir_item) > namelen) {
471 printk(KERN_CRIT "btrfs: invalid dir item name len: %u\n", 471 btrfs_crit(root->fs_info, "invalid dir item name len: %u",
472 (unsigned)btrfs_dir_data_len(leaf, dir_item)); 472 (unsigned)btrfs_dir_data_len(leaf, dir_item));
473 return 1; 473 return 1;
474 } 474 }
@@ -476,7 +476,7 @@ int verify_dir_item(struct btrfs_root *root,
476 /* BTRFS_MAX_XATTR_SIZE is the same for all dir items */ 476 /* BTRFS_MAX_XATTR_SIZE is the same for all dir items */
477 if ((btrfs_dir_data_len(leaf, dir_item) + 477 if ((btrfs_dir_data_len(leaf, dir_item) +
478 btrfs_dir_name_len(leaf, dir_item)) > BTRFS_MAX_XATTR_SIZE(root)) { 478 btrfs_dir_name_len(leaf, dir_item)) > BTRFS_MAX_XATTR_SIZE(root)) {
479 printk(KERN_CRIT "btrfs: invalid dir item name + data len: %u + %u\n", 479 btrfs_crit(root->fs_info, "invalid dir item name + data len: %u + %u",
480 (unsigned)btrfs_dir_name_len(leaf, dir_item), 480 (unsigned)btrfs_dir_name_len(leaf, dir_item),
481 (unsigned)btrfs_dir_data_len(leaf, dir_item)); 481 (unsigned)btrfs_dir_data_len(leaf, dir_item));
482 return 1; 482 return 1;
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 4a1871cf797b..0400a26fc8c5 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -300,11 +300,11 @@ static int csum_tree_block(struct btrfs_root *root, struct extent_buffer *buf,
300 memcpy(&found, result, csum_size); 300 memcpy(&found, result, csum_size);
301 301
302 read_extent_buffer(buf, &val, 0, csum_size); 302 read_extent_buffer(buf, &val, 0, csum_size);
303 printk_ratelimited(KERN_INFO "btrfs: %s checksum verify " 303 printk_ratelimited(KERN_INFO
304 "failed on %llu wanted %X found %X " 304 "BTRFS: %s checksum verify failed on %llu wanted %X found %X "
305 "level %d\n", 305 "level %d\n",
306 root->fs_info->sb->s_id, buf->start, 306 root->fs_info->sb->s_id, buf->start,
307 val, found, btrfs_header_level(buf)); 307 val, found, btrfs_header_level(buf));
308 if (result != (char *)&inline_result) 308 if (result != (char *)&inline_result)
309 kfree(result); 309 kfree(result);
310 return 1; 310 return 1;
@@ -383,13 +383,14 @@ static int btrfs_check_super_csum(char *raw_disk_sb)
383 ret = 1; 383 ret = 1;
384 384
385 if (ret && btrfs_super_generation(disk_sb) < 10) { 385 if (ret && btrfs_super_generation(disk_sb) < 10) {
386 printk(KERN_WARNING "btrfs: super block crcs don't match, older mkfs detected\n"); 386 printk(KERN_WARNING
387 "BTRFS: super block crcs don't match, older mkfs detected\n");
387 ret = 0; 388 ret = 0;
388 } 389 }
389 } 390 }
390 391
391 if (csum_type >= ARRAY_SIZE(btrfs_csum_sizes)) { 392 if (csum_type >= ARRAY_SIZE(btrfs_csum_sizes)) {
392 printk(KERN_ERR "btrfs: unsupported checksum algorithm %u\n", 393 printk(KERN_ERR "BTRFS: unsupported checksum algorithm %u\n",
393 csum_type); 394 csum_type);
394 ret = 1; 395 ret = 1;
395 } 396 }
@@ -498,8 +499,8 @@ static int check_tree_block_fsid(struct btrfs_root *root,
498} 499}
499 500
500#define CORRUPT(reason, eb, root, slot) \ 501#define CORRUPT(reason, eb, root, slot) \
501 printk(KERN_CRIT "btrfs: corrupt leaf, %s: block=%llu," \ 502 btrfs_crit(root->fs_info, "corrupt leaf, %s: block=%llu," \
502 "root=%llu, slot=%d\n", reason, \ 503 "root=%llu, slot=%d", reason, \
503 btrfs_header_bytenr(eb), root->objectid, slot) 504 btrfs_header_bytenr(eb), root->objectid, slot)
504 505
505static noinline int check_leaf(struct btrfs_root *root, 506static noinline int check_leaf(struct btrfs_root *root,
@@ -596,21 +597,21 @@ static int btree_readpage_end_io_hook(struct btrfs_io_bio *io_bio,
596 597
597 found_start = btrfs_header_bytenr(eb); 598 found_start = btrfs_header_bytenr(eb);
598 if (found_start != eb->start) { 599 if (found_start != eb->start) {
599 printk_ratelimited(KERN_INFO "btrfs bad tree block start " 600 printk_ratelimited(KERN_INFO "BTRFS: bad tree block start "
600 "%llu %llu\n", 601 "%llu %llu\n",
601 found_start, eb->start); 602 found_start, eb->start);
602 ret = -EIO; 603 ret = -EIO;
603 goto err; 604 goto err;
604 } 605 }
605 if (check_tree_block_fsid(root, eb)) { 606 if (check_tree_block_fsid(root, eb)) {
606 printk_ratelimited(KERN_INFO "btrfs bad fsid on block %llu\n", 607 printk_ratelimited(KERN_INFO "BTRFS: bad fsid on block %llu\n",
607 eb->start); 608 eb->start);
608 ret = -EIO; 609 ret = -EIO;
609 goto err; 610 goto err;
610 } 611 }
611 found_level = btrfs_header_level(eb); 612 found_level = btrfs_header_level(eb);
612 if (found_level >= BTRFS_MAX_LEVEL) { 613 if (found_level >= BTRFS_MAX_LEVEL) {
613 btrfs_info(root->fs_info, "bad tree block level %d\n", 614 btrfs_info(root->fs_info, "bad tree block level %d",
614 (int)btrfs_header_level(eb)); 615 (int)btrfs_header_level(eb));
615 ret = -EIO; 616 ret = -EIO;
616 goto err; 617 goto err;
@@ -1004,8 +1005,9 @@ static void btree_invalidatepage(struct page *page, unsigned int offset,
1004 extent_invalidatepage(tree, page, offset); 1005 extent_invalidatepage(tree, page, offset);
1005 btree_releasepage(page, GFP_NOFS); 1006 btree_releasepage(page, GFP_NOFS);
1006 if (PagePrivate(page)) { 1007 if (PagePrivate(page)) {
1007 printk(KERN_WARNING "btrfs warning page private not zero " 1008 btrfs_warn(BTRFS_I(page->mapping->host)->root->fs_info,
1008 "on page %llu\n", (unsigned long long)page_offset(page)); 1009 "page private not zero on page %llu",
1010 (unsigned long long)page_offset(page));
1009 ClearPagePrivate(page); 1011 ClearPagePrivate(page);
1010 set_page_private(page, 0); 1012 set_page_private(page, 0);
1011 page_cache_release(page); 1013 page_cache_release(page);
@@ -2322,7 +2324,7 @@ int open_ctree(struct super_block *sb,
2322 * Pass the whole disk block of size BTRFS_SUPER_INFO_SIZE (4k). 2324 * Pass the whole disk block of size BTRFS_SUPER_INFO_SIZE (4k).
2323 */ 2325 */
2324 if (btrfs_check_super_csum(bh->b_data)) { 2326 if (btrfs_check_super_csum(bh->b_data)) {
2325 printk(KERN_ERR "btrfs: superblock checksum mismatch\n"); 2327 printk(KERN_ERR "BTRFS: superblock checksum mismatch\n");
2326 err = -EINVAL; 2328 err = -EINVAL;
2327 goto fail_alloc; 2329 goto fail_alloc;
2328 } 2330 }
@@ -2341,7 +2343,7 @@ int open_ctree(struct super_block *sb,
2341 2343
2342 ret = btrfs_check_super_valid(fs_info, sb->s_flags & MS_RDONLY); 2344 ret = btrfs_check_super_valid(fs_info, sb->s_flags & MS_RDONLY);
2343 if (ret) { 2345 if (ret) {
2344 printk(KERN_ERR "btrfs: superblock contains fatal errors\n"); 2346 printk(KERN_ERR "BTRFS: superblock contains fatal errors\n");
2345 err = -EINVAL; 2347 err = -EINVAL;
2346 goto fail_alloc; 2348 goto fail_alloc;
2347 } 2349 }
@@ -2406,7 +2408,7 @@ int open_ctree(struct super_block *sb,
2406 features |= BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO; 2408 features |= BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO;
2407 2409
2408 if (features & BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA) 2410 if (features & BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA)
2409 printk(KERN_ERR "btrfs: has skinny extents\n"); 2411 printk(KERN_ERR "BTRFS: has skinny extents\n");
2410 2412
2411 /* 2413 /*
2412 * flag our filesystem as having big metadata blocks if 2414 * flag our filesystem as having big metadata blocks if
@@ -2414,7 +2416,7 @@ int open_ctree(struct super_block *sb,
2414 */ 2416 */
2415 if (btrfs_super_leafsize(disk_super) > PAGE_CACHE_SIZE) { 2417 if (btrfs_super_leafsize(disk_super) > PAGE_CACHE_SIZE) {
2416 if (!(features & BTRFS_FEATURE_INCOMPAT_BIG_METADATA)) 2418 if (!(features & BTRFS_FEATURE_INCOMPAT_BIG_METADATA))
2417 printk(KERN_INFO "btrfs flagging fs with big metadata feature\n"); 2419 printk(KERN_INFO "BTRFS: flagging fs with big metadata feature\n");
2418 features |= BTRFS_FEATURE_INCOMPAT_BIG_METADATA; 2420 features |= BTRFS_FEATURE_INCOMPAT_BIG_METADATA;
2419 } 2421 }
2420 2422
@@ -2431,7 +2433,7 @@ int open_ctree(struct super_block *sb,
2431 */ 2433 */
2432 if ((features & BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS) && 2434 if ((features & BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS) &&
2433 (sectorsize != leafsize)) { 2435 (sectorsize != leafsize)) {
2434 printk(KERN_WARNING "btrfs: unequal leaf/node/sector sizes " 2436 printk(KERN_WARNING "BTRFS: unequal leaf/node/sector sizes "
2435 "are not allowed for mixed block groups on %s\n", 2437 "are not allowed for mixed block groups on %s\n",
2436 sb->s_id); 2438 sb->s_id);
2437 goto fail_alloc; 2439 goto fail_alloc;
@@ -2568,12 +2570,12 @@ int open_ctree(struct super_block *sb,
2568 sb->s_blocksize_bits = blksize_bits(sectorsize); 2570 sb->s_blocksize_bits = blksize_bits(sectorsize);
2569 2571
2570 if (btrfs_super_magic(disk_super) != BTRFS_MAGIC) { 2572 if (btrfs_super_magic(disk_super) != BTRFS_MAGIC) {
2571 printk(KERN_INFO "btrfs: valid FS not found on %s\n", sb->s_id); 2573 printk(KERN_INFO "BTRFS: valid FS not found on %s\n", sb->s_id);
2572 goto fail_sb_buffer; 2574 goto fail_sb_buffer;
2573 } 2575 }
2574 2576
2575 if (sectorsize != PAGE_SIZE) { 2577 if (sectorsize != PAGE_SIZE) {
2576 printk(KERN_WARNING "btrfs: Incompatible sector size(%lu) " 2578 printk(KERN_WARNING "BTRFS: Incompatible sector size(%lu) "
2577 "found on %s\n", (unsigned long)sectorsize, sb->s_id); 2579 "found on %s\n", (unsigned long)sectorsize, sb->s_id);
2578 goto fail_sb_buffer; 2580 goto fail_sb_buffer;
2579 } 2581 }
@@ -2582,7 +2584,7 @@ int open_ctree(struct super_block *sb,
2582 ret = btrfs_read_sys_array(tree_root); 2584 ret = btrfs_read_sys_array(tree_root);
2583 mutex_unlock(&fs_info->chunk_mutex); 2585 mutex_unlock(&fs_info->chunk_mutex);
2584 if (ret) { 2586 if (ret) {
2585 printk(KERN_WARNING "btrfs: failed to read the system " 2587 printk(KERN_WARNING "BTRFS: failed to read the system "
2586 "array on %s\n", sb->s_id); 2588 "array on %s\n", sb->s_id);
2587 goto fail_sb_buffer; 2589 goto fail_sb_buffer;
2588 } 2590 }
@@ -2599,7 +2601,7 @@ int open_ctree(struct super_block *sb,
2599 blocksize, generation); 2601 blocksize, generation);
2600 if (!chunk_root->node || 2602 if (!chunk_root->node ||
2601 !test_bit(EXTENT_BUFFER_UPTODATE, &chunk_root->node->bflags)) { 2603 !test_bit(EXTENT_BUFFER_UPTODATE, &chunk_root->node->bflags)) {
2602 printk(KERN_WARNING "btrfs: failed to read chunk root on %s\n", 2604 printk(KERN_WARNING "BTRFS: failed to read chunk root on %s\n",
2603 sb->s_id); 2605 sb->s_id);
2604 goto fail_tree_roots; 2606 goto fail_tree_roots;
2605 } 2607 }
@@ -2611,7 +2613,7 @@ int open_ctree(struct super_block *sb,
2611 2613
2612 ret = btrfs_read_chunk_tree(chunk_root); 2614 ret = btrfs_read_chunk_tree(chunk_root);
2613 if (ret) { 2615 if (ret) {
2614 printk(KERN_WARNING "btrfs: failed to read chunk tree on %s\n", 2616 printk(KERN_WARNING "BTRFS: failed to read chunk tree on %s\n",
2615 sb->s_id); 2617 sb->s_id);
2616 goto fail_tree_roots; 2618 goto fail_tree_roots;
2617 } 2619 }
@@ -2623,7 +2625,7 @@ int open_ctree(struct super_block *sb,
2623 btrfs_close_extra_devices(fs_info, fs_devices, 0); 2625 btrfs_close_extra_devices(fs_info, fs_devices, 0);
2624 2626
2625 if (!fs_devices->latest_bdev) { 2627 if (!fs_devices->latest_bdev) {
2626 printk(KERN_CRIT "btrfs: failed to read devices on %s\n", 2628 printk(KERN_CRIT "BTRFS: failed to read devices on %s\n",
2627 sb->s_id); 2629 sb->s_id);
2628 goto fail_tree_roots; 2630 goto fail_tree_roots;
2629 } 2631 }
@@ -2638,7 +2640,7 @@ retry_root_backup:
2638 blocksize, generation); 2640 blocksize, generation);
2639 if (!tree_root->node || 2641 if (!tree_root->node ||
2640 !test_bit(EXTENT_BUFFER_UPTODATE, &tree_root->node->bflags)) { 2642 !test_bit(EXTENT_BUFFER_UPTODATE, &tree_root->node->bflags)) {
2641 printk(KERN_WARNING "btrfs: failed to read tree root on %s\n", 2643 printk(KERN_WARNING "BTRFS: failed to read tree root on %s\n",
2642 sb->s_id); 2644 sb->s_id);
2643 2645
2644 goto recovery_tree_root; 2646 goto recovery_tree_root;
@@ -2709,20 +2711,20 @@ retry_root_backup:
2709 2711
2710 ret = btrfs_recover_balance(fs_info); 2712 ret = btrfs_recover_balance(fs_info);
2711 if (ret) { 2713 if (ret) {
2712 printk(KERN_WARNING "btrfs: failed to recover balance\n"); 2714 printk(KERN_WARNING "BTRFS: failed to recover balance\n");
2713 goto fail_block_groups; 2715 goto fail_block_groups;
2714 } 2716 }
2715 2717
2716 ret = btrfs_init_dev_stats(fs_info); 2718 ret = btrfs_init_dev_stats(fs_info);
2717 if (ret) { 2719 if (ret) {
2718 printk(KERN_ERR "btrfs: failed to init dev_stats: %d\n", 2720 printk(KERN_ERR "BTRFS: failed to init dev_stats: %d\n",
2719 ret); 2721 ret);
2720 goto fail_block_groups; 2722 goto fail_block_groups;
2721 } 2723 }
2722 2724
2723 ret = btrfs_init_dev_replace(fs_info); 2725 ret = btrfs_init_dev_replace(fs_info);
2724 if (ret) { 2726 if (ret) {
2725 pr_err("btrfs: failed to init dev_replace: %d\n", ret); 2727 pr_err("BTRFS: failed to init dev_replace: %d\n", ret);
2726 goto fail_block_groups; 2728 goto fail_block_groups;
2727 } 2729 }
2728 2730
@@ -2730,19 +2732,19 @@ retry_root_backup:
2730 2732
2731 ret = btrfs_sysfs_add_one(fs_info); 2733 ret = btrfs_sysfs_add_one(fs_info);
2732 if (ret) { 2734 if (ret) {
2733 pr_err("btrfs: failed to init sysfs interface: %d\n", ret); 2735 pr_err("BTRFS: failed to init sysfs interface: %d\n", ret);
2734 goto fail_block_groups; 2736 goto fail_block_groups;
2735 } 2737 }
2736 2738
2737 ret = btrfs_init_space_info(fs_info); 2739 ret = btrfs_init_space_info(fs_info);
2738 if (ret) { 2740 if (ret) {
2739 printk(KERN_ERR "Failed to initial space info: %d\n", ret); 2741 printk(KERN_ERR "BTRFS: Failed to initial space info: %d\n", ret);
2740 goto fail_block_groups; 2742 goto fail_block_groups;
2741 } 2743 }
2742 2744
2743 ret = btrfs_read_block_groups(extent_root); 2745 ret = btrfs_read_block_groups(extent_root);
2744 if (ret) { 2746 if (ret) {
2745 printk(KERN_ERR "Failed to read block groups: %d\n", ret); 2747 printk(KERN_ERR "BTRFS: Failed to read block groups: %d\n", ret);
2746 goto fail_block_groups; 2748 goto fail_block_groups;
2747 } 2749 }
2748 fs_info->num_tolerated_disk_barrier_failures = 2750 fs_info->num_tolerated_disk_barrier_failures =
@@ -2750,8 +2752,8 @@ retry_root_backup:
2750 if (fs_info->fs_devices->missing_devices > 2752 if (fs_info->fs_devices->missing_devices >
2751 fs_info->num_tolerated_disk_barrier_failures && 2753 fs_info->num_tolerated_disk_barrier_failures &&
2752 !(sb->s_flags & MS_RDONLY)) { 2754 !(sb->s_flags & MS_RDONLY)) {
2753 printk(KERN_WARNING 2755 printk(KERN_WARNING "BTRFS: "
2754 "Btrfs: too many missing devices, writeable mount is not allowed\n"); 2756 "too many missing devices, writeable mount is not allowed\n");
2755 goto fail_block_groups; 2757 goto fail_block_groups;
2756 } 2758 }
2757 2759
@@ -2769,7 +2771,7 @@ retry_root_backup:
2769 if (!btrfs_test_opt(tree_root, SSD) && 2771 if (!btrfs_test_opt(tree_root, SSD) &&
2770 !btrfs_test_opt(tree_root, NOSSD) && 2772 !btrfs_test_opt(tree_root, NOSSD) &&
2771 !fs_info->fs_devices->rotating) { 2773 !fs_info->fs_devices->rotating) {
2772 printk(KERN_INFO "Btrfs detected SSD devices, enabling SSD " 2774 printk(KERN_INFO "BTRFS: detected SSD devices, enabling SSD "
2773 "mode\n"); 2775 "mode\n");
2774 btrfs_set_opt(fs_info->mount_opt, SSD); 2776 btrfs_set_opt(fs_info->mount_opt, SSD);
2775 } 2777 }
@@ -2782,7 +2784,7 @@ retry_root_backup:
2782 1 : 0, 2784 1 : 0,
2783 fs_info->check_integrity_print_mask); 2785 fs_info->check_integrity_print_mask);
2784 if (ret) 2786 if (ret)
2785 printk(KERN_WARNING "btrfs: failed to initialize" 2787 printk(KERN_WARNING "BTRFS: failed to initialize"
2786 " integrity check module %s\n", sb->s_id); 2788 " integrity check module %s\n", sb->s_id);
2787 } 2789 }
2788#endif 2790#endif
@@ -2795,7 +2797,7 @@ retry_root_backup:
2795 u64 bytenr = btrfs_super_log_root(disk_super); 2797 u64 bytenr = btrfs_super_log_root(disk_super);
2796 2798
2797 if (fs_devices->rw_devices == 0) { 2799 if (fs_devices->rw_devices == 0) {
2798 printk(KERN_WARNING "Btrfs log replay required " 2800 printk(KERN_WARNING "BTRFS: log replay required "
2799 "on RO media\n"); 2801 "on RO media\n");
2800 err = -EIO; 2802 err = -EIO;
2801 goto fail_qgroup; 2803 goto fail_qgroup;
@@ -2818,7 +2820,7 @@ retry_root_backup:
2818 generation + 1); 2820 generation + 1);
2819 if (!log_tree_root->node || 2821 if (!log_tree_root->node ||
2820 !extent_buffer_uptodate(log_tree_root->node)) { 2822 !extent_buffer_uptodate(log_tree_root->node)) {
2821 printk(KERN_ERR "btrfs: failed to read log tree\n"); 2823 printk(KERN_ERR "BTRFS: failed to read log tree\n");
2822 free_extent_buffer(log_tree_root->node); 2824 free_extent_buffer(log_tree_root->node);
2823 kfree(log_tree_root); 2825 kfree(log_tree_root);
2824 goto fail_trans_kthread; 2826 goto fail_trans_kthread;
@@ -2852,7 +2854,7 @@ retry_root_backup:
2852 ret = btrfs_recover_relocation(tree_root); 2854 ret = btrfs_recover_relocation(tree_root);
2853 if (ret < 0) { 2855 if (ret < 0) {
2854 printk(KERN_WARNING 2856 printk(KERN_WARNING
2855 "btrfs: failed to recover relocation\n"); 2857 "BTRFS: failed to recover relocation\n");
2856 err = -EINVAL; 2858 err = -EINVAL;
2857 goto fail_qgroup; 2859 goto fail_qgroup;
2858 } 2860 }
@@ -2882,14 +2884,14 @@ retry_root_backup:
2882 2884
2883 ret = btrfs_resume_balance_async(fs_info); 2885 ret = btrfs_resume_balance_async(fs_info);
2884 if (ret) { 2886 if (ret) {
2885 printk(KERN_WARNING "btrfs: failed to resume balance\n"); 2887 printk(KERN_WARNING "BTRFS: failed to resume balance\n");
2886 close_ctree(tree_root); 2888 close_ctree(tree_root);
2887 return ret; 2889 return ret;
2888 } 2890 }
2889 2891
2890 ret = btrfs_resume_dev_replace_async(fs_info); 2892 ret = btrfs_resume_dev_replace_async(fs_info);
2891 if (ret) { 2893 if (ret) {
2892 pr_warn("btrfs: failed to resume dev_replace\n"); 2894 pr_warn("BTRFS: failed to resume dev_replace\n");
2893 close_ctree(tree_root); 2895 close_ctree(tree_root);
2894 return ret; 2896 return ret;
2895 } 2897 }
@@ -2897,20 +2899,20 @@ retry_root_backup:
2897 btrfs_qgroup_rescan_resume(fs_info); 2899 btrfs_qgroup_rescan_resume(fs_info);
2898 2900
2899 if (create_uuid_tree) { 2901 if (create_uuid_tree) {
2900 pr_info("btrfs: creating UUID tree\n"); 2902 pr_info("BTRFS: creating UUID tree\n");
2901 ret = btrfs_create_uuid_tree(fs_info); 2903 ret = btrfs_create_uuid_tree(fs_info);
2902 if (ret) { 2904 if (ret) {
2903 pr_warn("btrfs: failed to create the UUID tree %d\n", 2905 pr_warn("BTRFS: failed to create the UUID tree %d\n",
2904 ret); 2906 ret);
2905 close_ctree(tree_root); 2907 close_ctree(tree_root);
2906 return ret; 2908 return ret;
2907 } 2909 }
2908 } else if (check_uuid_tree || 2910 } else if (check_uuid_tree ||
2909 btrfs_test_opt(tree_root, RESCAN_UUID_TREE)) { 2911 btrfs_test_opt(tree_root, RESCAN_UUID_TREE)) {
2910 pr_info("btrfs: checking UUID tree\n"); 2912 pr_info("BTRFS: checking UUID tree\n");
2911 ret = btrfs_check_uuid_tree(fs_info); 2913 ret = btrfs_check_uuid_tree(fs_info);
2912 if (ret) { 2914 if (ret) {
2913 pr_warn("btrfs: failed to check the UUID tree %d\n", 2915 pr_warn("BTRFS: failed to check the UUID tree %d\n",
2914 ret); 2916 ret);
2915 close_ctree(tree_root); 2917 close_ctree(tree_root);
2916 return ret; 2918 return ret;
@@ -2991,7 +2993,7 @@ static void btrfs_end_buffer_write_sync(struct buffer_head *bh, int uptodate)
2991 struct btrfs_device *device = (struct btrfs_device *) 2993 struct btrfs_device *device = (struct btrfs_device *)
2992 bh->b_private; 2994 bh->b_private;
2993 2995
2994 printk_ratelimited_in_rcu(KERN_WARNING "lost page write due to " 2996 printk_ratelimited_in_rcu(KERN_WARNING "BTRFS: lost page write due to "
2995 "I/O error on %s\n", 2997 "I/O error on %s\n",
2996 rcu_str_deref(device->name)); 2998 rcu_str_deref(device->name));
2997 /* note, we dont' set_buffer_write_io_error because we have 2999 /* note, we dont' set_buffer_write_io_error because we have
@@ -3110,7 +3112,7 @@ static int write_dev_supers(struct btrfs_device *device,
3110 bh = __getblk(device->bdev, bytenr / 4096, 3112 bh = __getblk(device->bdev, bytenr / 4096,
3111 BTRFS_SUPER_INFO_SIZE); 3113 BTRFS_SUPER_INFO_SIZE);
3112 if (!bh) { 3114 if (!bh) {
3113 printk(KERN_ERR "btrfs: couldn't get super " 3115 printk(KERN_ERR "BTRFS: couldn't get super "
3114 "buffer head for bytenr %Lu\n", bytenr); 3116 "buffer head for bytenr %Lu\n", bytenr);
3115 errors++; 3117 errors++;
3116 continue; 3118 continue;
@@ -3177,7 +3179,7 @@ static int write_dev_flush(struct btrfs_device *device, int wait)
3177 wait_for_completion(&device->flush_wait); 3179 wait_for_completion(&device->flush_wait);
3178 3180
3179 if (bio_flagged(bio, BIO_EOPNOTSUPP)) { 3181 if (bio_flagged(bio, BIO_EOPNOTSUPP)) {
3180 printk_in_rcu("btrfs: disabling barriers on dev %s\n", 3182 printk_in_rcu("BTRFS: disabling barriers on dev %s\n",
3181 rcu_str_deref(device->name)); 3183 rcu_str_deref(device->name));
3182 device->nobarriers = 1; 3184 device->nobarriers = 1;
3183 } else if (!bio_flagged(bio, BIO_UPTODATE)) { 3185 } else if (!bio_flagged(bio, BIO_UPTODATE)) {
@@ -3398,7 +3400,7 @@ static int write_all_supers(struct btrfs_root *root, int max_mirrors)
3398 total_errors++; 3400 total_errors++;
3399 } 3401 }
3400 if (total_errors > max_errors) { 3402 if (total_errors > max_errors) {
3401 printk(KERN_ERR "btrfs: %d errors while writing supers\n", 3403 btrfs_err(root->fs_info, "%d errors while writing supers",
3402 total_errors); 3404 total_errors);
3403 mutex_unlock(&root->fs_info->fs_devices->device_list_mutex); 3405 mutex_unlock(&root->fs_info->fs_devices->device_list_mutex);
3404 3406
@@ -3554,7 +3556,7 @@ int close_ctree(struct btrfs_root *root)
3554 if (!(fs_info->sb->s_flags & MS_RDONLY)) { 3556 if (!(fs_info->sb->s_flags & MS_RDONLY)) {
3555 ret = btrfs_commit_super(root); 3557 ret = btrfs_commit_super(root);
3556 if (ret) 3558 if (ret)
3557 printk(KERN_ERR "btrfs: commit super ret %d\n", ret); 3559 btrfs_err(root->fs_info, "commit super ret %d", ret);
3558 } 3560 }
3559 3561
3560 if (test_bit(BTRFS_FS_STATE_ERROR, &fs_info->fs_state)) 3562 if (test_bit(BTRFS_FS_STATE_ERROR, &fs_info->fs_state))
@@ -3571,7 +3573,7 @@ int close_ctree(struct btrfs_root *root)
3571 btrfs_free_qgroup_config(root->fs_info); 3573 btrfs_free_qgroup_config(root->fs_info);
3572 3574
3573 if (percpu_counter_sum(&fs_info->delalloc_bytes)) { 3575 if (percpu_counter_sum(&fs_info->delalloc_bytes)) {
3574 printk(KERN_INFO "btrfs: at unmount delalloc count %lld\n", 3576 btrfs_info(root->fs_info, "at unmount delalloc count %lld",
3575 percpu_counter_sum(&fs_info->delalloc_bytes)); 3577 percpu_counter_sum(&fs_info->delalloc_bytes));
3576 } 3578 }
3577 3579
@@ -3798,7 +3800,7 @@ static int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans,
3798 spin_lock(&delayed_refs->lock); 3800 spin_lock(&delayed_refs->lock);
3799 if (delayed_refs->num_entries == 0) { 3801 if (delayed_refs->num_entries == 0) {
3800 spin_unlock(&delayed_refs->lock); 3802 spin_unlock(&delayed_refs->lock);
3801 printk(KERN_INFO "delayed_refs has NO entry\n"); 3803 btrfs_info(root->fs_info, "delayed_refs has NO entry");
3802 return ret; 3804 return ret;
3803 } 3805 }
3804 3806
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 9e524b0a7b3c..1c82bead2c08 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -6637,12 +6637,12 @@ static void dump_space_info(struct btrfs_space_info *info, u64 bytes,
6637 int index = 0; 6637 int index = 0;
6638 6638
6639 spin_lock(&info->lock); 6639 spin_lock(&info->lock);
6640 printk(KERN_INFO "space_info %llu has %llu free, is %sfull\n", 6640 printk(KERN_INFO "BTRFS: space_info %llu has %llu free, is %sfull\n",
6641 info->flags, 6641 info->flags,
6642 info->total_bytes - info->bytes_used - info->bytes_pinned - 6642 info->total_bytes - info->bytes_used - info->bytes_pinned -
6643 info->bytes_reserved - info->bytes_readonly, 6643 info->bytes_reserved - info->bytes_readonly,
6644 (info->full) ? "" : "not "); 6644 (info->full) ? "" : "not ");
6645 printk(KERN_INFO "space_info total=%llu, used=%llu, pinned=%llu, " 6645 printk(KERN_INFO "BTRFS: space_info total=%llu, used=%llu, pinned=%llu, "
6646 "reserved=%llu, may_use=%llu, readonly=%llu\n", 6646 "reserved=%llu, may_use=%llu, readonly=%llu\n",
6647 info->total_bytes, info->bytes_used, info->bytes_pinned, 6647 info->total_bytes, info->bytes_used, info->bytes_pinned,
6648 info->bytes_reserved, info->bytes_may_use, 6648 info->bytes_reserved, info->bytes_may_use,
@@ -6656,7 +6656,9 @@ static void dump_space_info(struct btrfs_space_info *info, u64 bytes,
6656again: 6656again:
6657 list_for_each_entry(cache, &info->block_groups[index], list) { 6657 list_for_each_entry(cache, &info->block_groups[index], list) {
6658 spin_lock(&cache->lock); 6658 spin_lock(&cache->lock);
6659 printk(KERN_INFO "block group %llu has %llu bytes, %llu used %llu pinned %llu reserved %s\n", 6659 printk(KERN_INFO "BTRFS: "
6660 "block group %llu has %llu bytes, "
6661 "%llu used %llu pinned %llu reserved %s\n",
6660 cache->key.objectid, cache->key.offset, 6662 cache->key.objectid, cache->key.offset,
6661 btrfs_block_group_used(&cache->item), cache->pinned, 6663 btrfs_block_group_used(&cache->item), cache->pinned,
6662 cache->reserved, cache->ro ? "[readonly]" : ""); 6664 cache->reserved, cache->ro ? "[readonly]" : "");
@@ -7019,7 +7021,7 @@ again:
7019 /*DEFAULT_RATELIMIT_BURST*/ 1); 7021 /*DEFAULT_RATELIMIT_BURST*/ 1);
7020 if (__ratelimit(&_rs)) 7022 if (__ratelimit(&_rs))
7021 WARN(1, KERN_DEBUG 7023 WARN(1, KERN_DEBUG
7022 "btrfs: block rsv returned %d\n", ret); 7024 "BTRFS: block rsv returned %d\n", ret);
7023 } 7025 }
7024try_reserve: 7026try_reserve:
7025 ret = reserve_metadata_bytes(root, block_rsv, blocksize, 7027 ret = reserve_metadata_bytes(root, block_rsv, blocksize,
@@ -7767,7 +7769,7 @@ int btrfs_drop_snapshot(struct btrfs_root *root,
7767 7769
7768 btrfs_end_transaction_throttle(trans, tree_root); 7770 btrfs_end_transaction_throttle(trans, tree_root);
7769 if (!for_reloc && btrfs_need_cleaner_sleep(root)) { 7771 if (!for_reloc && btrfs_need_cleaner_sleep(root)) {
7770 pr_debug("btrfs: drop snapshot early exit\n"); 7772 pr_debug("BTRFS: drop snapshot early exit\n");
7771 err = -EAGAIN; 7773 err = -EAGAIN;
7772 goto out_free; 7774 goto out_free;
7773 } 7775 }
@@ -8427,7 +8429,7 @@ static void __link_block_group(struct btrfs_space_info *space_info,
8427 ret = kobject_add(kobj, &space_info->kobj, "%s", 8429 ret = kobject_add(kobj, &space_info->kobj, "%s",
8428 get_raid_name(index)); 8430 get_raid_name(index));
8429 if (ret) { 8431 if (ret) {
8430 pr_warn("btrfs: failed to add kobject for block cache. ignoring.\n"); 8432 pr_warn("BTRFS: failed to add kobject for block cache. ignoring.\n");
8431 kobject_put(&space_info->kobj); 8433 kobject_put(&space_info->kobj);
8432 } 8434 }
8433 } 8435 }
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 2fa23b57d8df..fbe501d3bd01 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -59,7 +59,7 @@ void btrfs_leak_debug_check(void)
59 59
60 while (!list_empty(&states)) { 60 while (!list_empty(&states)) {
61 state = list_entry(states.next, struct extent_state, leak_list); 61 state = list_entry(states.next, struct extent_state, leak_list);
62 printk(KERN_ERR "btrfs state leak: start %llu end %llu " 62 printk(KERN_ERR "BTRFS: state leak: start %llu end %llu "
63 "state %lu in tree %p refs %d\n", 63 "state %lu in tree %p refs %d\n",
64 state->start, state->end, state->state, state->tree, 64 state->start, state->end, state->state, state->tree,
65 atomic_read(&state->refs)); 65 atomic_read(&state->refs));
@@ -69,7 +69,7 @@ void btrfs_leak_debug_check(void)
69 69
70 while (!list_empty(&buffers)) { 70 while (!list_empty(&buffers)) {
71 eb = list_entry(buffers.next, struct extent_buffer, leak_list); 71 eb = list_entry(buffers.next, struct extent_buffer, leak_list);
72 printk(KERN_ERR "btrfs buffer leak start %llu len %lu " 72 printk(KERN_ERR "BTRFS: buffer leak start %llu len %lu "
73 "refs %d\n", 73 "refs %d\n",
74 eb->start, eb->len, atomic_read(&eb->refs)); 74 eb->start, eb->len, atomic_read(&eb->refs));
75 list_del(&eb->leak_list); 75 list_del(&eb->leak_list);
@@ -92,7 +92,7 @@ static inline void __btrfs_debug_check_extent_io_range(const char *caller,
92 isize = i_size_read(inode); 92 isize = i_size_read(inode);
93 if (end >= PAGE_SIZE && (end % 2) == 0 && end != isize - 1) { 93 if (end >= PAGE_SIZE && (end % 2) == 0 && end != isize - 1) {
94 printk_ratelimited(KERN_DEBUG 94 printk_ratelimited(KERN_DEBUG
95 "btrfs: %s: ino %llu isize %llu odd range [%llu,%llu]\n", 95 "BTRFS: %s: ino %llu isize %llu odd range [%llu,%llu]\n",
96 caller, btrfs_ino(inode), isize, start, end); 96 caller, btrfs_ino(inode), isize, start, end);
97 } 97 }
98} 98}
@@ -423,7 +423,7 @@ static int insert_state(struct extent_io_tree *tree,
423 struct rb_node *node; 423 struct rb_node *node;
424 424
425 if (end < start) 425 if (end < start)
426 WARN(1, KERN_ERR "btrfs end < start %llu %llu\n", 426 WARN(1, KERN_ERR "BTRFS: end < start %llu %llu\n",
427 end, start); 427 end, start);
428 state->start = start; 428 state->start = start;
429 state->end = end; 429 state->end = end;
@@ -434,7 +434,7 @@ static int insert_state(struct extent_io_tree *tree,
434 if (node) { 434 if (node) {
435 struct extent_state *found; 435 struct extent_state *found;
436 found = rb_entry(node, struct extent_state, rb_node); 436 found = rb_entry(node, struct extent_state, rb_node);
437 printk(KERN_ERR "btrfs found node %llu %llu on insert of " 437 printk(KERN_ERR "BTRFS: found node %llu %llu on insert of "
438 "%llu %llu\n", 438 "%llu %llu\n",
439 found->start, found->end, start, end); 439 found->start, found->end, start, end);
440 return -EEXIST; 440 return -EEXIST;
@@ -2054,9 +2054,10 @@ int repair_io_failure(struct btrfs_fs_info *fs_info, u64 start,
2054 return -EIO; 2054 return -EIO;
2055 } 2055 }
2056 2056
2057 printk_ratelimited_in_rcu(KERN_INFO "btrfs read error corrected: ino %lu off %llu " 2057 printk_ratelimited_in_rcu(KERN_INFO
2058 "(dev %s sector %llu)\n", page->mapping->host->i_ino, 2058 "BTRFS: read error corrected: ino %lu off %llu "
2059 start, rcu_str_deref(dev->name), sector); 2059 "(dev %s sector %llu)\n", page->mapping->host->i_ino,
2060 start, rcu_str_deref(dev->name), sector);
2060 2061
2061 bio_put(bio); 2062 bio_put(bio);
2062 return 0; 2063 return 0;
@@ -2386,11 +2387,17 @@ static void end_bio_extent_writepage(struct bio *bio, int err)
2386 * advance bv_offset and adjust bv_len to compensate. 2387 * advance bv_offset and adjust bv_len to compensate.
2387 * Print a warning for nonzero offsets, and an error 2388 * Print a warning for nonzero offsets, and an error
2388 * if they don't add up to a full page. */ 2389 * if they don't add up to a full page. */
2389 if (bvec->bv_offset || bvec->bv_len != PAGE_CACHE_SIZE) 2390 if (bvec->bv_offset || bvec->bv_len != PAGE_CACHE_SIZE) {
2390 printk("%s page write in btrfs with offset %u and length %u\n", 2391 if (bvec->bv_offset + bvec->bv_len != PAGE_CACHE_SIZE)
2391 bvec->bv_offset + bvec->bv_len != PAGE_CACHE_SIZE 2392 btrfs_err(BTRFS_I(page->mapping->host)->root->fs_info,
2392 ? KERN_ERR "partial" : KERN_INFO "incomplete", 2393 "partial page write in btrfs with offset %u and length %u",
2393 bvec->bv_offset, bvec->bv_len); 2394 bvec->bv_offset, bvec->bv_len);
2395 else
2396 btrfs_info(BTRFS_I(page->mapping->host)->root->fs_info,
2397 "incomplete page write in btrfs with offset %u and "
2398 "length %u",
2399 bvec->bv_offset, bvec->bv_len);
2400 }
2394 2401
2395 start = page_offset(page); 2402 start = page_offset(page);
2396 end = start + bvec->bv_offset + bvec->bv_len - 1; 2403 end = start + bvec->bv_offset + bvec->bv_len - 1;
@@ -2463,11 +2470,17 @@ static void end_bio_extent_readpage(struct bio *bio, int err)
2463 * advance bv_offset and adjust bv_len to compensate. 2470 * advance bv_offset and adjust bv_len to compensate.
2464 * Print a warning for nonzero offsets, and an error 2471 * Print a warning for nonzero offsets, and an error
2465 * if they don't add up to a full page. */ 2472 * if they don't add up to a full page. */
2466 if (bvec->bv_offset || bvec->bv_len != PAGE_CACHE_SIZE) 2473 if (bvec->bv_offset || bvec->bv_len != PAGE_CACHE_SIZE) {
2467 printk("%s page read in btrfs with offset %u and length %u\n", 2474 if (bvec->bv_offset + bvec->bv_len != PAGE_CACHE_SIZE)
2468 bvec->bv_offset + bvec->bv_len != PAGE_CACHE_SIZE 2475 btrfs_err(BTRFS_I(page->mapping->host)->root->fs_info,
2469 ? KERN_ERR "partial" : KERN_INFO "incomplete", 2476 "partial page read in btrfs with offset %u and length %u",
2470 bvec->bv_offset, bvec->bv_len); 2477 bvec->bv_offset, bvec->bv_len);
2478 else
2479 btrfs_info(BTRFS_I(page->mapping->host)->root->fs_info,
2480 "incomplete page read in btrfs with offset %u and "
2481 "length %u",
2482 bvec->bv_offset, bvec->bv_len);
2483 }
2471 2484
2472 start = page_offset(page); 2485 start = page_offset(page);
2473 end = start + bvec->bv_offset + bvec->bv_len - 1; 2486 end = start + bvec->bv_offset + bvec->bv_len - 1;
@@ -3327,8 +3340,8 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc,
3327 3340
3328 set_range_writeback(tree, cur, cur + iosize - 1); 3341 set_range_writeback(tree, cur, cur + iosize - 1);
3329 if (!PageWriteback(page)) { 3342 if (!PageWriteback(page)) {
3330 printk(KERN_ERR "btrfs warning page %lu not " 3343 btrfs_err(BTRFS_I(inode)->root->fs_info,
3331 "writeback, cur %llu end %llu\n", 3344 "page %lu not writeback, cur %llu end %llu",
3332 page->index, cur, end); 3345 page->index, cur, end);
3333 } 3346 }
3334 3347
@@ -5149,12 +5162,12 @@ void memcpy_extent_buffer(struct extent_buffer *dst, unsigned long dst_offset,
5149 unsigned long src_i; 5162 unsigned long src_i;
5150 5163
5151 if (src_offset + len > dst->len) { 5164 if (src_offset + len > dst->len) {
5152 printk(KERN_ERR "btrfs memmove bogus src_offset %lu move " 5165 printk(KERN_ERR "BTRFS: memmove bogus src_offset %lu move "
5153 "len %lu dst len %lu\n", src_offset, len, dst->len); 5166 "len %lu dst len %lu\n", src_offset, len, dst->len);
5154 BUG_ON(1); 5167 BUG_ON(1);
5155 } 5168 }
5156 if (dst_offset + len > dst->len) { 5169 if (dst_offset + len > dst->len) {
5157 printk(KERN_ERR "btrfs memmove bogus dst_offset %lu move " 5170 printk(KERN_ERR "BTRFS: memmove bogus dst_offset %lu move "
5158 "len %lu dst len %lu\n", dst_offset, len, dst->len); 5171 "len %lu dst len %lu\n", dst_offset, len, dst->len);
5159 BUG_ON(1); 5172 BUG_ON(1);
5160 } 5173 }
@@ -5196,12 +5209,12 @@ void memmove_extent_buffer(struct extent_buffer *dst, unsigned long dst_offset,
5196 unsigned long src_i; 5209 unsigned long src_i;
5197 5210
5198 if (src_offset + len > dst->len) { 5211 if (src_offset + len > dst->len) {
5199 printk(KERN_ERR "btrfs memmove bogus src_offset %lu move " 5212 printk(KERN_ERR "BTRFS: memmove bogus src_offset %lu move "
5200 "len %lu len %lu\n", src_offset, len, dst->len); 5213 "len %lu len %lu\n", src_offset, len, dst->len);
5201 BUG_ON(1); 5214 BUG_ON(1);
5202 } 5215 }
5203 if (dst_offset + len > dst->len) { 5216 if (dst_offset + len > dst->len) {
5204 printk(KERN_ERR "btrfs memmove bogus dst_offset %lu move " 5217 printk(KERN_ERR "BTRFS: memmove bogus dst_offset %lu move "
5205 "len %lu len %lu\n", dst_offset, len, dst->len); 5218 "len %lu len %lu\n", dst_offset, len, dst->len);
5206 BUG_ON(1); 5219 BUG_ON(1);
5207 } 5220 }
diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c
index 6f3848860283..9d846588f722 100644
--- a/fs/btrfs/file-item.c
+++ b/fs/btrfs/file-item.c
@@ -246,8 +246,8 @@ static int __btrfs_lookup_bio_sums(struct btrfs_root *root,
246 offset + bvec->bv_len - 1, 246 offset + bvec->bv_len - 1,
247 EXTENT_NODATASUM, GFP_NOFS); 247 EXTENT_NODATASUM, GFP_NOFS);
248 } else { 248 } else {
249 printk(KERN_INFO "btrfs no csum found " 249 btrfs_info(BTRFS_I(inode)->root->fs_info,
250 "for inode %llu start %llu\n", 250 "no csum found for inode %llu start %llu",
251 btrfs_ino(inode), offset); 251 btrfs_ino(inode), offset);
252 } 252 }
253 item = NULL; 253 item = NULL;
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index 332aa33d02f4..73f3de7a083c 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -347,8 +347,8 @@ static int io_ctl_prepare_pages(struct io_ctl *io_ctl, struct inode *inode,
347 btrfs_readpage(NULL, page); 347 btrfs_readpage(NULL, page);
348 lock_page(page); 348 lock_page(page);
349 if (!PageUptodate(page)) { 349 if (!PageUptodate(page)) {
350 printk(KERN_ERR "btrfs: error reading free " 350 btrfs_err(BTRFS_I(inode)->root->fs_info,
351 "space cache\n"); 351 "error reading free space cache");
352 io_ctl_drop_pages(io_ctl); 352 io_ctl_drop_pages(io_ctl);
353 return -EIO; 353 return -EIO;
354 } 354 }
@@ -405,7 +405,7 @@ static int io_ctl_check_generation(struct io_ctl *io_ctl, u64 generation)
405 405
406 gen = io_ctl->cur; 406 gen = io_ctl->cur;
407 if (le64_to_cpu(*gen) != generation) { 407 if (le64_to_cpu(*gen) != generation) {
408 printk_ratelimited(KERN_ERR "btrfs: space cache generation " 408 printk_ratelimited(KERN_ERR "BTRFS: space cache generation "
409 "(%Lu) does not match inode (%Lu)\n", *gen, 409 "(%Lu) does not match inode (%Lu)\n", *gen,
410 generation); 410 generation);
411 io_ctl_unmap_page(io_ctl); 411 io_ctl_unmap_page(io_ctl);
@@ -463,7 +463,7 @@ static int io_ctl_check_crc(struct io_ctl *io_ctl, int index)
463 PAGE_CACHE_SIZE - offset); 463 PAGE_CACHE_SIZE - offset);
464 btrfs_csum_final(crc, (char *)&crc); 464 btrfs_csum_final(crc, (char *)&crc);
465 if (val != crc) { 465 if (val != crc) {
466 printk_ratelimited(KERN_ERR "btrfs: csum mismatch on free " 466 printk_ratelimited(KERN_ERR "BTRFS: csum mismatch on free "
467 "space cache\n"); 467 "space cache\n");
468 io_ctl_unmap_page(io_ctl); 468 io_ctl_unmap_page(io_ctl);
469 return -EIO; 469 return -EIO;
@@ -1902,7 +1902,7 @@ out:
1902 spin_unlock(&ctl->tree_lock); 1902 spin_unlock(&ctl->tree_lock);
1903 1903
1904 if (ret) { 1904 if (ret) {
1905 printk(KERN_CRIT "btrfs: unable to add free space :%d\n", ret); 1905 printk(KERN_CRIT "BTRFS: unable to add free space :%d\n", ret);
1906 ASSERT(ret != -EEXIST); 1906 ASSERT(ret != -EEXIST);
1907 } 1907 }
1908 1908
@@ -2011,14 +2011,15 @@ void btrfs_dump_free_space(struct btrfs_block_group_cache *block_group,
2011 info = rb_entry(n, struct btrfs_free_space, offset_index); 2011 info = rb_entry(n, struct btrfs_free_space, offset_index);
2012 if (info->bytes >= bytes && !block_group->ro) 2012 if (info->bytes >= bytes && !block_group->ro)
2013 count++; 2013 count++;
2014 printk(KERN_CRIT "entry offset %llu, bytes %llu, bitmap %s\n", 2014 btrfs_crit(block_group->fs_info,
2015 info->offset, info->bytes, 2015 "entry offset %llu, bytes %llu, bitmap %s",
2016 info->offset, info->bytes,
2016 (info->bitmap) ? "yes" : "no"); 2017 (info->bitmap) ? "yes" : "no");
2017 } 2018 }
2018 printk(KERN_INFO "block group has cluster?: %s\n", 2019 btrfs_info(block_group->fs_info, "block group has cluster?: %s",
2019 list_empty(&block_group->cluster_list) ? "no" : "yes"); 2020 list_empty(&block_group->cluster_list) ? "no" : "yes");
2020 printk(KERN_INFO "%d blocks of free space at or bigger than bytes is" 2021 btrfs_info(block_group->fs_info,
2021 "\n", count); 2022 "%d blocks of free space at or bigger than bytes is", count);
2022} 2023}
2023 2024
2024void btrfs_init_free_space_ctl(struct btrfs_block_group_cache *block_group) 2025void btrfs_init_free_space_ctl(struct btrfs_block_group_cache *block_group)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 2ccf8e6b1e16..06bcf5b53cb0 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -6966,8 +6966,8 @@ static void btrfs_end_dio_bio(struct bio *bio, int err)
6966 struct btrfs_dio_private *dip = bio->bi_private; 6966 struct btrfs_dio_private *dip = bio->bi_private;
6967 6967
6968 if (err) { 6968 if (err) {
6969 printk(KERN_ERR "btrfs direct IO failed ino %llu rw %lu " 6969 btrfs_err(BTRFS_I(dip->inode)->root->fs_info,
6970 "sector %#Lx len %u err no %d\n", 6970 "direct IO failed ino %llu rw %lu sector %#Lx len %u err no %d",
6971 btrfs_ino(dip->inode), bio->bi_rw, 6971 btrfs_ino(dip->inode), bio->bi_rw,
6972 (unsigned long long)bio->bi_sector, bio->bi_size, err); 6972 (unsigned long long)bio->bi_sector, bio->bi_size, err);
6973 dip->errors = 1; 6973 dip->errors = 1;
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index c0dc05467ce8..edf5f0093f22 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -1262,7 +1262,7 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
1262 break; 1262 break;
1263 1263
1264 if (btrfs_defrag_cancelled(root->fs_info)) { 1264 if (btrfs_defrag_cancelled(root->fs_info)) {
1265 printk(KERN_DEBUG "btrfs: defrag_file cancelled\n"); 1265 printk(KERN_DEBUG "BTRFS: defrag_file cancelled\n");
1266 ret = -EAGAIN; 1266 ret = -EAGAIN;
1267 break; 1267 break;
1268 } 1268 }
@@ -1424,20 +1424,20 @@ static noinline int btrfs_ioctl_resize(struct file *file,
1424 ret = -EINVAL; 1424 ret = -EINVAL;
1425 goto out_free; 1425 goto out_free;
1426 } 1426 }
1427 printk(KERN_INFO "btrfs: resizing devid %llu\n", devid); 1427 btrfs_info(root->fs_info, "resizing devid %llu", devid);
1428 } 1428 }
1429 1429
1430 device = btrfs_find_device(root->fs_info, devid, NULL, NULL); 1430 device = btrfs_find_device(root->fs_info, devid, NULL, NULL);
1431 if (!device) { 1431 if (!device) {
1432 printk(KERN_INFO "btrfs: resizer unable to find device %llu\n", 1432 btrfs_info(root->fs_info, "resizer unable to find device %llu",
1433 devid); 1433 devid);
1434 ret = -ENODEV; 1434 ret = -ENODEV;
1435 goto out_free; 1435 goto out_free;
1436 } 1436 }
1437 1437
1438 if (!device->writeable) { 1438 if (!device->writeable) {
1439 printk(KERN_INFO "btrfs: resizer unable to apply on " 1439 btrfs_info(root->fs_info,
1440 "readonly device %llu\n", 1440 "resizer unable to apply on readonly device %llu",
1441 devid); 1441 devid);
1442 ret = -EPERM; 1442 ret = -EPERM;
1443 goto out_free; 1443 goto out_free;
@@ -1489,7 +1489,7 @@ static noinline int btrfs_ioctl_resize(struct file *file,
1489 do_div(new_size, root->sectorsize); 1489 do_div(new_size, root->sectorsize);
1490 new_size *= root->sectorsize; 1490 new_size *= root->sectorsize;
1491 1491
1492 printk_in_rcu(KERN_INFO "btrfs: new size for %s is %llu\n", 1492 printk_in_rcu(KERN_INFO "BTRFS: new size for %s is %llu\n",
1493 rcu_str_deref(device->name), new_size); 1493 rcu_str_deref(device->name), new_size);
1494 1494
1495 if (new_size > old_size) { 1495 if (new_size > old_size) {
@@ -1550,8 +1550,8 @@ static noinline int btrfs_ioctl_snap_create_transid(struct file *file,
1550 1550
1551 src_inode = file_inode(src.file); 1551 src_inode = file_inode(src.file);
1552 if (src_inode->i_sb != file_inode(file)->i_sb) { 1552 if (src_inode->i_sb != file_inode(file)->i_sb) {
1553 printk(KERN_INFO "btrfs: Snapshot src from " 1553 btrfs_info(BTRFS_I(src_inode)->root->fs_info,
1554 "another FS\n"); 1554 "Snapshot src from another FS");
1555 ret = -EINVAL; 1555 ret = -EINVAL;
1556 } else { 1556 } else {
1557 ret = btrfs_mksubvol(&file->f_path, name, namelen, 1557 ret = btrfs_mksubvol(&file->f_path, name, namelen,
@@ -1934,7 +1934,7 @@ static noinline int search_ioctl(struct inode *inode,
1934 key.offset = (u64)-1; 1934 key.offset = (u64)-1;
1935 root = btrfs_read_fs_root_no_name(info, &key); 1935 root = btrfs_read_fs_root_no_name(info, &key);
1936 if (IS_ERR(root)) { 1936 if (IS_ERR(root)) {
1937 printk(KERN_ERR "could not find root %llu\n", 1937 printk(KERN_ERR "BTRFS: could not find root %llu\n",
1938 sk->tree_id); 1938 sk->tree_id);
1939 btrfs_free_path(path); 1939 btrfs_free_path(path);
1940 return -ENOENT; 1940 return -ENOENT;
@@ -2024,7 +2024,7 @@ static noinline int btrfs_search_path_in_tree(struct btrfs_fs_info *info,
2024 key.offset = (u64)-1; 2024 key.offset = (u64)-1;
2025 root = btrfs_read_fs_root_no_name(info, &key); 2025 root = btrfs_read_fs_root_no_name(info, &key);
2026 if (IS_ERR(root)) { 2026 if (IS_ERR(root)) {
2027 printk(KERN_ERR "could not find root %llu\n", tree_id); 2027 printk(KERN_ERR "BTRFS: could not find root %llu\n", tree_id);
2028 ret = -ENOENT; 2028 ret = -ENOENT;
2029 goto out; 2029 goto out;
2030 } 2030 }
@@ -3367,8 +3367,8 @@ static long btrfs_ioctl_default_subvol(struct file *file, void __user *argp)
3367 if (IS_ERR_OR_NULL(di)) { 3367 if (IS_ERR_OR_NULL(di)) {
3368 btrfs_free_path(path); 3368 btrfs_free_path(path);
3369 btrfs_end_transaction(trans, root); 3369 btrfs_end_transaction(trans, root);
3370 printk(KERN_ERR "Umm, you don't have the default dir item, " 3370 btrfs_err(new_root->fs_info, "Umm, you don't have the default dir"
3371 "this isn't going to work\n"); 3371 "item, this isn't going to work");
3372 ret = -ENOENT; 3372 ret = -ENOENT;
3373 goto out; 3373 goto out;
3374 } 3374 }
@@ -4469,8 +4469,8 @@ static int btrfs_ioctl_get_fslabel(struct file *file, void __user *arg)
4469 len = strnlen(label, BTRFS_LABEL_SIZE); 4469 len = strnlen(label, BTRFS_LABEL_SIZE);
4470 4470
4471 if (len == BTRFS_LABEL_SIZE) { 4471 if (len == BTRFS_LABEL_SIZE) {
4472 pr_warn("btrfs: label is too long, return the first %zu bytes\n", 4472 btrfs_warn(root->fs_info,
4473 --len); 4473 "label is too long, return the first %zu bytes", --len);
4474 } 4474 }
4475 4475
4476 ret = copy_to_user(arg, label, len); 4476 ret = copy_to_user(arg, label, len);
@@ -4493,7 +4493,7 @@ static int btrfs_ioctl_set_fslabel(struct file *file, void __user *arg)
4493 return -EFAULT; 4493 return -EFAULT;
4494 4494
4495 if (strnlen(label, BTRFS_LABEL_SIZE) == BTRFS_LABEL_SIZE) { 4495 if (strnlen(label, BTRFS_LABEL_SIZE) == BTRFS_LABEL_SIZE) {
4496 pr_err("btrfs: unable to set label with more than %d bytes\n", 4496 btrfs_err(root->fs_info, "unable to set label with more than %d bytes",
4497 BTRFS_LABEL_SIZE - 1); 4497 BTRFS_LABEL_SIZE - 1);
4498 return -EINVAL; 4498 return -EINVAL;
4499 } 4499 }
diff --git a/fs/btrfs/lzo.c b/fs/btrfs/lzo.c
index b6a6f07c5ce2..b47f669aca75 100644
--- a/fs/btrfs/lzo.c
+++ b/fs/btrfs/lzo.c
@@ -141,7 +141,7 @@ static int lzo_compress_pages(struct list_head *ws,
141 ret = lzo1x_1_compress(data_in, in_len, workspace->cbuf, 141 ret = lzo1x_1_compress(data_in, in_len, workspace->cbuf,
142 &out_len, workspace->mem); 142 &out_len, workspace->mem);
143 if (ret != LZO_E_OK) { 143 if (ret != LZO_E_OK) {
144 printk(KERN_DEBUG "btrfs deflate in loop returned %d\n", 144 printk(KERN_DEBUG "BTRFS: deflate in loop returned %d\n",
145 ret); 145 ret);
146 ret = -1; 146 ret = -1;
147 goto out; 147 goto out;
@@ -357,7 +357,7 @@ cont:
357 if (need_unmap) 357 if (need_unmap)
358 kunmap(pages_in[page_in_index - 1]); 358 kunmap(pages_in[page_in_index - 1]);
359 if (ret != LZO_E_OK) { 359 if (ret != LZO_E_OK) {
360 printk(KERN_WARNING "btrfs decompress failed\n"); 360 printk(KERN_WARNING "BTRFS: decompress failed\n");
361 ret = -1; 361 ret = -1;
362 break; 362 break;
363 } 363 }
@@ -401,7 +401,7 @@ static int lzo_decompress(struct list_head *ws, unsigned char *data_in,
401 out_len = PAGE_CACHE_SIZE; 401 out_len = PAGE_CACHE_SIZE;
402 ret = lzo1x_decompress_safe(data_in, in_len, workspace->buf, &out_len); 402 ret = lzo1x_decompress_safe(data_in, in_len, workspace->buf, &out_len);
403 if (ret != LZO_E_OK) { 403 if (ret != LZO_E_OK) {
404 printk(KERN_WARNING "btrfs decompress failed!\n"); 404 printk(KERN_WARNING "BTRFS: decompress failed!\n");
405 ret = -1; 405 ret = -1;
406 goto out; 406 goto out;
407 } 407 }
diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c
index b8c2ded75fe2..b16450b840e7 100644
--- a/fs/btrfs/ordered-data.c
+++ b/fs/btrfs/ordered-data.c
@@ -336,13 +336,14 @@ int btrfs_dec_test_first_ordered_pending(struct inode *inode,
336 entry->len); 336 entry->len);
337 *file_offset = dec_end; 337 *file_offset = dec_end;
338 if (dec_start > dec_end) { 338 if (dec_start > dec_end) {
339 printk(KERN_CRIT "bad ordering dec_start %llu end %llu\n", 339 btrfs_crit(BTRFS_I(inode)->root->fs_info,
340 dec_start, dec_end); 340 "bad ordering dec_start %llu end %llu", dec_start, dec_end);
341 } 341 }
342 to_dec = dec_end - dec_start; 342 to_dec = dec_end - dec_start;
343 if (to_dec > entry->bytes_left) { 343 if (to_dec > entry->bytes_left) {
344 printk(KERN_CRIT "bad ordered accounting left %llu size %llu\n", 344 btrfs_crit(BTRFS_I(inode)->root->fs_info,
345 entry->bytes_left, to_dec); 345 "bad ordered accounting left %llu size %llu",
346 entry->bytes_left, to_dec);
346 } 347 }
347 entry->bytes_left -= to_dec; 348 entry->bytes_left -= to_dec;
348 if (!uptodate) 349 if (!uptodate)
@@ -401,7 +402,8 @@ have_entry:
401 } 402 }
402 403
403 if (io_size > entry->bytes_left) { 404 if (io_size > entry->bytes_left) {
404 printk(KERN_CRIT "bad ordered accounting left %llu size %llu\n", 405 btrfs_crit(BTRFS_I(inode)->root->fs_info,
406 "bad ordered accounting left %llu size %llu",
405 entry->bytes_left, io_size); 407 entry->bytes_left, io_size);
406 } 408 }
407 entry->bytes_left -= io_size; 409 entry->bytes_left -= io_size;
diff --git a/fs/btrfs/print-tree.c b/fs/btrfs/print-tree.c
index 417053b17181..4eed002b7cf6 100644
--- a/fs/btrfs/print-tree.c
+++ b/fs/btrfs/print-tree.c
@@ -154,7 +154,7 @@ static void print_uuid_item(struct extent_buffer *l, unsigned long offset,
154 u32 item_size) 154 u32 item_size)
155{ 155{
156 if (!IS_ALIGNED(item_size, sizeof(u64))) { 156 if (!IS_ALIGNED(item_size, sizeof(u64))) {
157 pr_warn("btrfs: uuid item with illegal size %lu!\n", 157 pr_warn("BTRFS: uuid item with illegal size %lu!\n",
158 (unsigned long)item_size); 158 (unsigned long)item_size);
159 return; 159 return;
160 } 160 }
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index bd0b058f2a24..d22e0a14dde2 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -301,16 +301,16 @@ int btrfs_read_qgroup_config(struct btrfs_fs_info *fs_info)
301 301
302 if (btrfs_qgroup_status_version(l, ptr) != 302 if (btrfs_qgroup_status_version(l, ptr) !=
303 BTRFS_QGROUP_STATUS_VERSION) { 303 BTRFS_QGROUP_STATUS_VERSION) {
304 printk(KERN_ERR 304 btrfs_err(fs_info,
305 "btrfs: old qgroup version, quota disabled\n"); 305 "old qgroup version, quota disabled");
306 goto out; 306 goto out;
307 } 307 }
308 if (btrfs_qgroup_status_generation(l, ptr) != 308 if (btrfs_qgroup_status_generation(l, ptr) !=
309 fs_info->generation) { 309 fs_info->generation) {
310 flags |= BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT; 310 flags |= BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT;
311 printk(KERN_ERR 311 btrfs_err(fs_info,
312 "btrfs: qgroup generation mismatch, " 312 "qgroup generation mismatch, "
313 "marked as inconsistent\n"); 313 "marked as inconsistent");
314 } 314 }
315 fs_info->qgroup_flags = btrfs_qgroup_status_flags(l, 315 fs_info->qgroup_flags = btrfs_qgroup_status_flags(l,
316 ptr); 316 ptr);
@@ -325,7 +325,7 @@ int btrfs_read_qgroup_config(struct btrfs_fs_info *fs_info)
325 qgroup = find_qgroup_rb(fs_info, found_key.offset); 325 qgroup = find_qgroup_rb(fs_info, found_key.offset);
326 if ((qgroup && found_key.type == BTRFS_QGROUP_INFO_KEY) || 326 if ((qgroup && found_key.type == BTRFS_QGROUP_INFO_KEY) ||
327 (!qgroup && found_key.type == BTRFS_QGROUP_LIMIT_KEY)) { 327 (!qgroup && found_key.type == BTRFS_QGROUP_LIMIT_KEY)) {
328 printk(KERN_ERR "btrfs: inconsitent qgroup config\n"); 328 btrfs_err(fs_info, "inconsitent qgroup config");
329 flags |= BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT; 329 flags |= BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT;
330 } 330 }
331 if (!qgroup) { 331 if (!qgroup) {
@@ -396,8 +396,8 @@ next1:
396 ret = add_relation_rb(fs_info, found_key.objectid, 396 ret = add_relation_rb(fs_info, found_key.objectid,
397 found_key.offset); 397 found_key.offset);
398 if (ret == -ENOENT) { 398 if (ret == -ENOENT) {
399 printk(KERN_WARNING 399 btrfs_warn(fs_info,
400 "btrfs: orphan qgroup relation 0x%llx->0x%llx\n", 400 "orphan qgroup relation 0x%llx->0x%llx",
401 found_key.objectid, found_key.offset); 401 found_key.objectid, found_key.offset);
402 ret = 0; /* ignore the error */ 402 ret = 0; /* ignore the error */
403 } 403 }
@@ -1159,7 +1159,7 @@ int btrfs_limit_qgroup(struct btrfs_trans_handle *trans,
1159 limit->rsv_excl); 1159 limit->rsv_excl);
1160 if (ret) { 1160 if (ret) {
1161 fs_info->qgroup_flags |= BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT; 1161 fs_info->qgroup_flags |= BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT;
1162 printk(KERN_INFO "unable to update quota limit for %llu\n", 1162 btrfs_info(fs_info, "unable to update quota limit for %llu",
1163 qgroupid); 1163 qgroupid);
1164 } 1164 }
1165 1165
@@ -1833,7 +1833,9 @@ void assert_qgroups_uptodate(struct btrfs_trans_handle *trans)
1833{ 1833{
1834 if (list_empty(&trans->qgroup_ref_list) && !trans->delayed_ref_elem.seq) 1834 if (list_empty(&trans->qgroup_ref_list) && !trans->delayed_ref_elem.seq)
1835 return; 1835 return;
1836 pr_err("btrfs: qgroups not uptodate in trans handle %p: list is%s empty, seq is %#x.%x\n", 1836 btrfs_err(trans->root->fs_info,
1837 "qgroups not uptodate in trans handle %p: list is%s empty, "
1838 "seq is %#x.%x",
1837 trans, list_empty(&trans->qgroup_ref_list) ? "" : " not", 1839 trans, list_empty(&trans->qgroup_ref_list) ? "" : " not",
1838 (u32)(trans->delayed_ref_elem.seq >> 32), 1840 (u32)(trans->delayed_ref_elem.seq >> 32),
1839 (u32)trans->delayed_ref_elem.seq); 1841 (u32)trans->delayed_ref_elem.seq);
@@ -2030,10 +2032,10 @@ out:
2030 mutex_unlock(&fs_info->qgroup_rescan_lock); 2032 mutex_unlock(&fs_info->qgroup_rescan_lock);
2031 2033
2032 if (err >= 0) { 2034 if (err >= 0) {
2033 pr_info("btrfs: qgroup scan completed%s\n", 2035 btrfs_info(fs_info, "qgroup scan completed%s",
2034 err == 2 ? " (inconsistency flag cleared)" : ""); 2036 err == 2 ? " (inconsistency flag cleared)" : "");
2035 } else { 2037 } else {
2036 pr_err("btrfs: qgroup scan failed with %d\n", err); 2038 btrfs_err(fs_info, "qgroup scan failed with %d", err);
2037 } 2039 }
2038 2040
2039 complete_all(&fs_info->qgroup_rescan_completion); 2041 complete_all(&fs_info->qgroup_rescan_completion);
@@ -2089,7 +2091,7 @@ qgroup_rescan_init(struct btrfs_fs_info *fs_info, u64 progress_objectid,
2089 2091
2090 if (ret) { 2092 if (ret) {
2091err: 2093err:
2092 pr_info("btrfs: qgroup_rescan_init failed with %d\n", ret); 2094 btrfs_info(fs_info, "qgroup_rescan_init failed with %d", ret);
2093 return ret; 2095 return ret;
2094 } 2096 }
2095 2097
diff --git a/fs/btrfs/reada.c b/fs/btrfs/reada.c
index 1031b69252c5..31c797c48c3e 100644
--- a/fs/btrfs/reada.c
+++ b/fs/btrfs/reada.c
@@ -189,8 +189,8 @@ static int __readahead_hook(struct btrfs_root *root, struct extent_buffer *eb,
189 */ 189 */
190#ifdef DEBUG 190#ifdef DEBUG
191 if (rec->generation != generation) { 191 if (rec->generation != generation) {
192 printk(KERN_DEBUG "generation mismatch for " 192 btrfs_debug(root->fs_info,
193 "(%llu,%d,%llu) %llu != %llu\n", 193 "generation mismatch for (%llu,%d,%llu) %llu != %llu",
194 key.objectid, key.type, key.offset, 194 key.objectid, key.type, key.offset,
195 rec->generation, generation); 195 rec->generation, generation);
196 } 196 }
@@ -365,8 +365,9 @@ static struct reada_extent *reada_find_extent(struct btrfs_root *root,
365 goto error; 365 goto error;
366 366
367 if (bbio->num_stripes > BTRFS_MAX_MIRRORS) { 367 if (bbio->num_stripes > BTRFS_MAX_MIRRORS) {
368 printk(KERN_ERR "btrfs readahead: more than %d copies not " 368 btrfs_err(root->fs_info,
369 "supported", BTRFS_MAX_MIRRORS); 369 "readahead: more than %d copies not supported",
370 BTRFS_MAX_MIRRORS);
370 goto error; 371 goto error;
371 } 372 }
372 373
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index d8a82b849987..8cf99c496ff3 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -4245,7 +4245,7 @@ int btrfs_relocate_block_group(struct btrfs_root *extent_root, u64 group_start)
4245 goto out; 4245 goto out;
4246 } 4246 }
4247 4247
4248 printk(KERN_INFO "btrfs: relocating block group %llu flags %llu\n", 4248 btrfs_info(extent_root->fs_info, "relocating block group %llu flags %llu",
4249 rc->block_group->key.objectid, rc->block_group->flags); 4249 rc->block_group->key.objectid, rc->block_group->flags);
4250 4250
4251 ret = btrfs_start_delalloc_roots(fs_info, 0); 4251 ret = btrfs_start_delalloc_roots(fs_info, 0);
@@ -4267,7 +4267,7 @@ int btrfs_relocate_block_group(struct btrfs_root *extent_root, u64 group_start)
4267 if (rc->extents_found == 0) 4267 if (rc->extents_found == 0)
4268 break; 4268 break;
4269 4269
4270 printk(KERN_INFO "btrfs: found %llu extents\n", 4270 btrfs_info(extent_root->fs_info, "found %llu extents",
4271 rc->extents_found); 4271 rc->extents_found);
4272 4272
4273 if (rc->stage == MOVE_DATA_EXTENTS && rc->found_file_extent) { 4273 if (rc->stage == MOVE_DATA_EXTENTS && rc->found_file_extent) {
diff --git a/fs/btrfs/root-tree.c b/fs/btrfs/root-tree.c
index fcc10ebb71a0..1389b69059de 100644
--- a/fs/btrfs/root-tree.c
+++ b/fs/btrfs/root-tree.c
@@ -44,7 +44,7 @@ static void btrfs_read_root_item(struct extent_buffer *eb, int slot,
44 if (!need_reset && btrfs_root_generation(item) 44 if (!need_reset && btrfs_root_generation(item)
45 != btrfs_root_generation_v2(item)) { 45 != btrfs_root_generation_v2(item)) {
46 if (btrfs_root_generation_v2(item) != 0) { 46 if (btrfs_root_generation_v2(item) != 0) {
47 printk(KERN_WARNING "btrfs: mismatching " 47 printk(KERN_WARNING "BTRFS: mismatching "
48 "generation and generation_v2 " 48 "generation and generation_v2 "
49 "found in root item. This root " 49 "found in root item. This root "
50 "was probably mounted with an " 50 "was probably mounted with an "
@@ -154,7 +154,7 @@ int btrfs_update_root(struct btrfs_trans_handle *trans, struct btrfs_root
154 154
155 if (ret != 0) { 155 if (ret != 0) {
156 btrfs_print_leaf(root, path->nodes[0]); 156 btrfs_print_leaf(root, path->nodes[0]);
157 printk(KERN_CRIT "unable to update root key %llu %u %llu\n", 157 btrfs_crit(root->fs_info, "unable to update root key %llu %u %llu",
158 key->objectid, key->type, key->offset); 158 key->objectid, key->type, key->offset);
159 BUG_ON(1); 159 BUG_ON(1);
160 } 160 }
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index adebe12e497e..7806e2c47f89 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -505,7 +505,7 @@ static int scrub_print_warning_inode(u64 inum, u64 offset, u64 root,
505 * hold all of the paths here 505 * hold all of the paths here
506 */ 506 */
507 for (i = 0; i < ipath->fspath->elem_cnt; ++i) 507 for (i = 0; i < ipath->fspath->elem_cnt; ++i)
508 printk_in_rcu(KERN_WARNING "btrfs: %s at logical %llu on dev " 508 printk_in_rcu(KERN_WARNING "BTRFS: %s at logical %llu on dev "
509 "%s, sector %llu, root %llu, inode %llu, offset %llu, " 509 "%s, sector %llu, root %llu, inode %llu, offset %llu, "
510 "length %llu, links %u (path: %s)\n", swarn->errstr, 510 "length %llu, links %u (path: %s)\n", swarn->errstr,
511 swarn->logical, rcu_str_deref(swarn->dev->name), 511 swarn->logical, rcu_str_deref(swarn->dev->name),
@@ -517,7 +517,7 @@ static int scrub_print_warning_inode(u64 inum, u64 offset, u64 root,
517 return 0; 517 return 0;
518 518
519err: 519err:
520 printk_in_rcu(KERN_WARNING "btrfs: %s at logical %llu on dev " 520 printk_in_rcu(KERN_WARNING "BTRFS: %s at logical %llu on dev "
521 "%s, sector %llu, root %llu, inode %llu, offset %llu: path " 521 "%s, sector %llu, root %llu, inode %llu, offset %llu: path "
522 "resolving failed with ret=%d\n", swarn->errstr, 522 "resolving failed with ret=%d\n", swarn->errstr,
523 swarn->logical, rcu_str_deref(swarn->dev->name), 523 swarn->logical, rcu_str_deref(swarn->dev->name),
@@ -580,7 +580,7 @@ static void scrub_print_warning(const char *errstr, struct scrub_block *sblock)
580 ret = tree_backref_for_extent(&ptr, eb, ei, item_size, 580 ret = tree_backref_for_extent(&ptr, eb, ei, item_size,
581 &ref_root, &ref_level); 581 &ref_root, &ref_level);
582 printk_in_rcu(KERN_WARNING 582 printk_in_rcu(KERN_WARNING
583 "btrfs: %s at logical %llu on dev %s, " 583 "BTRFS: %s at logical %llu on dev %s, "
584 "sector %llu: metadata %s (level %d) in tree " 584 "sector %llu: metadata %s (level %d) in tree "
585 "%llu\n", errstr, swarn.logical, 585 "%llu\n", errstr, swarn.logical,
586 rcu_str_deref(dev->name), 586 rcu_str_deref(dev->name),
@@ -782,8 +782,8 @@ out:
782 btrfs_dev_replace_stats_inc( 782 btrfs_dev_replace_stats_inc(
783 &sctx->dev_root->fs_info->dev_replace. 783 &sctx->dev_root->fs_info->dev_replace.
784 num_uncorrectable_read_errors); 784 num_uncorrectable_read_errors);
785 printk_ratelimited_in_rcu(KERN_ERR 785 printk_ratelimited_in_rcu(KERN_ERR "BTRFS: "
786 "btrfs: unable to fixup (nodatasum) error at logical %llu on dev %s\n", 786 "unable to fixup (nodatasum) error at logical %llu on dev %s\n",
787 fixup->logical, rcu_str_deref(fixup->dev->name)); 787 fixup->logical, rcu_str_deref(fixup->dev->name));
788 } 788 }
789 789
@@ -1184,7 +1184,7 @@ corrected_error:
1184 sctx->stat.corrected_errors++; 1184 sctx->stat.corrected_errors++;
1185 spin_unlock(&sctx->stat_lock); 1185 spin_unlock(&sctx->stat_lock);
1186 printk_ratelimited_in_rcu(KERN_ERR 1186 printk_ratelimited_in_rcu(KERN_ERR
1187 "btrfs: fixed up error at logical %llu on dev %s\n", 1187 "BTRFS: fixed up error at logical %llu on dev %s\n",
1188 logical, rcu_str_deref(dev->name)); 1188 logical, rcu_str_deref(dev->name));
1189 } 1189 }
1190 } else { 1190 } else {
@@ -1193,7 +1193,7 @@ did_not_correct_error:
1193 sctx->stat.uncorrectable_errors++; 1193 sctx->stat.uncorrectable_errors++;
1194 spin_unlock(&sctx->stat_lock); 1194 spin_unlock(&sctx->stat_lock);
1195 printk_ratelimited_in_rcu(KERN_ERR 1195 printk_ratelimited_in_rcu(KERN_ERR
1196 "btrfs: unable to fixup (regular) error at logical %llu on dev %s\n", 1196 "BTRFS: unable to fixup (regular) error at logical %llu on dev %s\n",
1197 logical, rcu_str_deref(dev->name)); 1197 logical, rcu_str_deref(dev->name));
1198 } 1198 }
1199 1199
@@ -1441,8 +1441,9 @@ static int scrub_repair_page_from_good_copy(struct scrub_block *sblock_bad,
1441 int ret; 1441 int ret;
1442 1442
1443 if (!page_bad->dev->bdev) { 1443 if (!page_bad->dev->bdev) {
1444 printk_ratelimited(KERN_WARNING 1444 printk_ratelimited(KERN_WARNING "BTRFS: "
1445 "btrfs: scrub_repair_page_from_good_copy(bdev == NULL) is unexpected!\n"); 1445 "scrub_repair_page_from_good_copy(bdev == NULL) "
1446 "is unexpected!\n");
1446 return -EIO; 1447 return -EIO;
1447 } 1448 }
1448 1449
@@ -1900,7 +1901,7 @@ static void scrub_submit(struct scrub_ctx *sctx)
1900 * This case is handled correctly (but _very_ slowly). 1901 * This case is handled correctly (but _very_ slowly).
1901 */ 1902 */
1902 printk_ratelimited(KERN_WARNING 1903 printk_ratelimited(KERN_WARNING
1903 "btrfs: scrub_submit(bio bdev == NULL) is unexpected!\n"); 1904 "BTRFS: scrub_submit(bio bdev == NULL) is unexpected!\n");
1904 bio_endio(sbio->bio, -EIO); 1905 bio_endio(sbio->bio, -EIO);
1905 } else { 1906 } else {
1906 btrfsic_submit_bio(READ, sbio->bio); 1907 btrfsic_submit_bio(READ, sbio->bio);
@@ -2440,9 +2441,9 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx,
2440 2441
2441 if (key.objectid < logical && 2442 if (key.objectid < logical &&
2442 (flags & BTRFS_EXTENT_FLAG_TREE_BLOCK)) { 2443 (flags & BTRFS_EXTENT_FLAG_TREE_BLOCK)) {
2443 printk(KERN_ERR 2444 btrfs_err(fs_info,
2444 "btrfs scrub: tree block %llu spanning " 2445 "scrub: tree block %llu spanning "
2445 "stripes, ignored. logical=%llu\n", 2446 "stripes, ignored. logical=%llu",
2446 key.objectid, logical); 2447 key.objectid, logical);
2447 goto next; 2448 goto next;
2448 } 2449 }
@@ -2812,8 +2813,8 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start,
2812 * check some assumptions 2813 * check some assumptions
2813 */ 2814 */
2814 if (fs_info->chunk_root->nodesize != fs_info->chunk_root->leafsize) { 2815 if (fs_info->chunk_root->nodesize != fs_info->chunk_root->leafsize) {
2815 printk(KERN_ERR 2816 btrfs_err(fs_info,
2816 "btrfs_scrub: size assumption nodesize == leafsize (%d == %d) fails\n", 2817 "scrub: size assumption nodesize == leafsize (%d == %d) fails",
2817 fs_info->chunk_root->nodesize, 2818 fs_info->chunk_root->nodesize,
2818 fs_info->chunk_root->leafsize); 2819 fs_info->chunk_root->leafsize);
2819 return -EINVAL; 2820 return -EINVAL;
@@ -2825,16 +2826,17 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start,
2825 * the way scrub is implemented. Do not handle this 2826 * the way scrub is implemented. Do not handle this
2826 * situation at all because it won't ever happen. 2827 * situation at all because it won't ever happen.
2827 */ 2828 */
2828 printk(KERN_ERR 2829 btrfs_err(fs_info,
2829 "btrfs_scrub: size assumption nodesize <= BTRFS_STRIPE_LEN (%d <= %d) fails\n", 2830 "scrub: size assumption nodesize <= BTRFS_STRIPE_LEN (%d <= %d) fails",
2830 fs_info->chunk_root->nodesize, BTRFS_STRIPE_LEN); 2831 fs_info->chunk_root->nodesize, BTRFS_STRIPE_LEN);
2831 return -EINVAL; 2832 return -EINVAL;
2832 } 2833 }
2833 2834
2834 if (fs_info->chunk_root->sectorsize != PAGE_SIZE) { 2835 if (fs_info->chunk_root->sectorsize != PAGE_SIZE) {
2835 /* not supported for data w/o checksums */ 2836 /* not supported for data w/o checksums */
2836 printk(KERN_ERR 2837 btrfs_err(fs_info,
2837 "btrfs_scrub: size assumption sectorsize != PAGE_SIZE (%d != %lu) fails\n", 2838 "scrub: size assumption sectorsize != PAGE_SIZE "
2839 "(%d != %lu) fails",
2838 fs_info->chunk_root->sectorsize, PAGE_SIZE); 2840 fs_info->chunk_root->sectorsize, PAGE_SIZE);
2839 return -EINVAL; 2841 return -EINVAL;
2840 } 2842 }
@@ -2847,7 +2849,8 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start,
2847 * would exhaust the array bounds of pagev member in 2849 * would exhaust the array bounds of pagev member in
2848 * struct scrub_block 2850 * struct scrub_block
2849 */ 2851 */
2850 pr_err("btrfs_scrub: size assumption nodesize and sectorsize <= SCRUB_MAX_PAGES_PER_BLOCK (%d <= %d && %d <= %d) fails\n", 2852 btrfs_err(fs_info, "scrub: size assumption nodesize and sectorsize "
2853 "<= SCRUB_MAX_PAGES_PER_BLOCK (%d <= %d && %d <= %d) fails",
2851 fs_info->chunk_root->nodesize, 2854 fs_info->chunk_root->nodesize,
2852 SCRUB_MAX_PAGES_PER_BLOCK, 2855 SCRUB_MAX_PAGES_PER_BLOCK,
2853 fs_info->chunk_root->sectorsize, 2856 fs_info->chunk_root->sectorsize,
@@ -3163,7 +3166,8 @@ static void copy_nocow_pages_worker(struct btrfs_work *work)
3163 ret = iterate_inodes_from_logical(logical, fs_info, path, 3166 ret = iterate_inodes_from_logical(logical, fs_info, path,
3164 record_inode_for_nocow, nocow_ctx); 3167 record_inode_for_nocow, nocow_ctx);
3165 if (ret != 0 && ret != -ENOENT) { 3168 if (ret != 0 && ret != -ENOENT) {
3166 pr_warn("iterate_inodes_from_logical() failed: log %llu, phys %llu, len %llu, mir %u, ret %d\n", 3169 btrfs_warn(fs_info, "iterate_inodes_from_logical() failed: log %llu, "
3170 "phys %llu, len %llu, mir %u, ret %d",
3167 logical, physical_for_dev_replace, len, mirror_num, 3171 logical, physical_for_dev_replace, len, mirror_num,
3168 ret); 3172 ret);
3169 not_written = 1; 3173 not_written = 1;
@@ -3285,7 +3289,7 @@ static int copy_nocow_pages_for_inode(u64 inum, u64 offset, u64 root,
3285again: 3289again:
3286 page = find_or_create_page(inode->i_mapping, index, GFP_NOFS); 3290 page = find_or_create_page(inode->i_mapping, index, GFP_NOFS);
3287 if (!page) { 3291 if (!page) {
3288 pr_err("find_or_create_page() failed\n"); 3292 btrfs_err(fs_info, "find_or_create_page() failed");
3289 ret = -ENOMEM; 3293 ret = -ENOMEM;
3290 goto out; 3294 goto out;
3291 } 3295 }
@@ -3357,7 +3361,7 @@ static int write_page_nocow(struct scrub_ctx *sctx,
3357 return -EIO; 3361 return -EIO;
3358 if (!dev->bdev) { 3362 if (!dev->bdev) {
3359 printk_ratelimited(KERN_WARNING 3363 printk_ratelimited(KERN_WARNING
3360 "btrfs: scrub write_page_nocow(bdev == NULL) is unexpected!\n"); 3364 "BTRFS: scrub write_page_nocow(bdev == NULL) is unexpected!\n");
3361 return -EIO; 3365 return -EIO;
3362 } 3366 }
3363 bio = btrfs_io_bio_alloc(GFP_NOFS, 1); 3367 bio = btrfs_io_bio_alloc(GFP_NOFS, 1);
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index 8877adc45394..bff0b1ac3be7 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -1234,7 +1234,7 @@ static int find_extent_clone(struct send_ctx *sctx,
1234 if (!backref_ctx->found_itself) { 1234 if (!backref_ctx->found_itself) {
1235 /* found a bug in backref code? */ 1235 /* found a bug in backref code? */
1236 ret = -EIO; 1236 ret = -EIO;
1237 printk(KERN_ERR "btrfs: ERROR did not find backref in " 1237 btrfs_err(sctx->send_root->fs_info, "did not find backref in "
1238 "send_root. inode=%llu, offset=%llu, " 1238 "send_root. inode=%llu, offset=%llu, "
1239 "disk_byte=%llu found extent=%llu\n", 1239 "disk_byte=%llu found extent=%llu\n",
1240 ino, data_offset, disk_byte, found_key.objectid); 1240 ino, data_offset, disk_byte, found_key.objectid);
@@ -4648,7 +4648,7 @@ static int full_send_tree(struct send_ctx *sctx)
4648 spin_unlock(&send_root->root_item_lock); 4648 spin_unlock(&send_root->root_item_lock);
4649 4649
4650 if (ctransid != start_ctransid) { 4650 if (ctransid != start_ctransid) {
4651 WARN(1, KERN_WARNING "btrfs: the root that you're trying to " 4651 WARN(1, KERN_WARNING "BTRFS: the root that you're trying to "
4652 "send was modified in between. This is " 4652 "send was modified in between. This is "
4653 "probably a bug.\n"); 4653 "probably a bug.\n");
4654 ret = -EIO; 4654 ret = -EIO;
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index d71a11d13dfa..15b6a1d4c533 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -152,11 +152,12 @@ void __btrfs_std_error(struct btrfs_fs_info *fs_info, const char *function,
152 vaf.fmt = fmt; 152 vaf.fmt = fmt;
153 vaf.va = &args; 153 vaf.va = &args;
154 154
155 printk(KERN_CRIT "BTRFS error (device %s) in %s:%d: errno=%d %s (%pV)\n", 155 printk(KERN_CRIT
156 "BTRFS: error (device %s) in %s:%d: errno=%d %s (%pV)\n",
156 sb->s_id, function, line, errno, errstr, &vaf); 157 sb->s_id, function, line, errno, errstr, &vaf);
157 va_end(args); 158 va_end(args);
158 } else { 159 } else {
159 printk(KERN_CRIT "BTRFS error (device %s) in %s:%d: errno=%d %s\n", 160 printk(KERN_CRIT "BTRFS: error (device %s) in %s:%d: errno=%d %s\n",
160 sb->s_id, function, line, errno, errstr); 161 sb->s_id, function, line, errno, errstr);
161 } 162 }
162 163
@@ -250,7 +251,7 @@ void __btrfs_abort_transaction(struct btrfs_trans_handle *trans,
250 */ 251 */
251 if (!test_and_set_bit(BTRFS_FS_STATE_TRANS_ABORTED, 252 if (!test_and_set_bit(BTRFS_FS_STATE_TRANS_ABORTED,
252 &root->fs_info->fs_state)) { 253 &root->fs_info->fs_state)) {
253 WARN(1, KERN_DEBUG "btrfs: Transaction aborted (error %d)\n", 254 WARN(1, KERN_DEBUG "BTRFS: Transaction aborted (error %d)\n",
254 errno); 255 errno);
255 } 256 }
256 trans->aborted = errno; 257 trans->aborted = errno;
@@ -294,8 +295,8 @@ void __btrfs_panic(struct btrfs_fs_info *fs_info, const char *function,
294 panic(KERN_CRIT "BTRFS panic (device %s) in %s:%d: %pV (errno=%d %s)\n", 295 panic(KERN_CRIT "BTRFS panic (device %s) in %s:%d: %pV (errno=%d %s)\n",
295 s_id, function, line, &vaf, errno, errstr); 296 s_id, function, line, &vaf, errno, errstr);
296 297
297 printk(KERN_CRIT "BTRFS panic (device %s) in %s:%d: %pV (errno=%d %s)\n", 298 btrfs_crit(fs_info, "panic in %s:%d: %pV (errno=%d %s)",
298 s_id, function, line, &vaf, errno, errstr); 299 function, line, &vaf, errno, errstr);
299 va_end(args); 300 va_end(args);
300 /* Caller calls BUG() */ 301 /* Caller calls BUG() */
301} 302}
@@ -409,7 +410,7 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
409 token = match_token(p, tokens, args); 410 token = match_token(p, tokens, args);
410 switch (token) { 411 switch (token) {
411 case Opt_degraded: 412 case Opt_degraded:
412 printk(KERN_INFO "btrfs: allowing degraded mounts\n"); 413 btrfs_info(root->fs_info, "allowing degraded mounts");
413 btrfs_set_opt(info->mount_opt, DEGRADED); 414 btrfs_set_opt(info->mount_opt, DEGRADED);
414 break; 415 break;
415 case Opt_subvol: 416 case Opt_subvol:
@@ -422,15 +423,16 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
422 */ 423 */
423 break; 424 break;
424 case Opt_nodatasum: 425 case Opt_nodatasum:
425 printk(KERN_INFO "btrfs: setting nodatasum\n"); 426 btrfs_info(root->fs_info, "setting nodatasum");
426 btrfs_set_opt(info->mount_opt, NODATASUM); 427 btrfs_set_opt(info->mount_opt, NODATASUM);
427 break; 428 break;
428 case Opt_nodatacow: 429 case Opt_nodatacow:
429 if (!btrfs_test_opt(root, COMPRESS) || 430 if (!btrfs_test_opt(root, COMPRESS) ||
430 !btrfs_test_opt(root, FORCE_COMPRESS)) { 431 !btrfs_test_opt(root, FORCE_COMPRESS)) {
431 printk(KERN_INFO "btrfs: setting nodatacow, compression disabled\n"); 432 btrfs_info(root->fs_info,
433 "setting nodatacow, compression disabled");
432 } else { 434 } else {
433 printk(KERN_INFO "btrfs: setting nodatacow\n"); 435 btrfs_info(root->fs_info, "setting nodatacow");
434 } 436 }
435 btrfs_clear_opt(info->mount_opt, COMPRESS); 437 btrfs_clear_opt(info->mount_opt, COMPRESS);
436 btrfs_clear_opt(info->mount_opt, FORCE_COMPRESS); 438 btrfs_clear_opt(info->mount_opt, FORCE_COMPRESS);
@@ -470,7 +472,7 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
470 472
471 if (compress_force) { 473 if (compress_force) {
472 btrfs_set_opt(info->mount_opt, FORCE_COMPRESS); 474 btrfs_set_opt(info->mount_opt, FORCE_COMPRESS);
473 pr_info("btrfs: force %s compression\n", 475 btrfs_info(root->fs_info, "force %s compression",
474 compress_type); 476 compress_type);
475 } else if (btrfs_test_opt(root, COMPRESS)) { 477 } else if (btrfs_test_opt(root, COMPRESS)) {
476 pr_info("btrfs: use %s compression\n", 478 pr_info("btrfs: use %s compression\n",
@@ -478,24 +480,22 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
478 } 480 }
479 break; 481 break;
480 case Opt_ssd: 482 case Opt_ssd:
481 printk(KERN_INFO "btrfs: use ssd allocation scheme\n"); 483 btrfs_info(root->fs_info, "use ssd allocation scheme");
482 btrfs_set_opt(info->mount_opt, SSD); 484 btrfs_set_opt(info->mount_opt, SSD);
483 break; 485 break;
484 case Opt_ssd_spread: 486 case Opt_ssd_spread:
485 printk(KERN_INFO "btrfs: use spread ssd " 487 btrfs_info(root->fs_info, "use spread ssd allocation scheme");
486 "allocation scheme\n");
487 btrfs_set_opt(info->mount_opt, SSD); 488 btrfs_set_opt(info->mount_opt, SSD);
488 btrfs_set_opt(info->mount_opt, SSD_SPREAD); 489 btrfs_set_opt(info->mount_opt, SSD_SPREAD);
489 break; 490 break;
490 case Opt_nossd: 491 case Opt_nossd:
491 printk(KERN_INFO "btrfs: not using ssd allocation " 492 btrfs_info(root->fs_info, "not using ssd allocation scheme");
492 "scheme\n");
493 btrfs_set_opt(info->mount_opt, NOSSD); 493 btrfs_set_opt(info->mount_opt, NOSSD);
494 btrfs_clear_opt(info->mount_opt, SSD); 494 btrfs_clear_opt(info->mount_opt, SSD);
495 btrfs_clear_opt(info->mount_opt, SSD_SPREAD); 495 btrfs_clear_opt(info->mount_opt, SSD_SPREAD);
496 break; 496 break;
497 case Opt_nobarrier: 497 case Opt_nobarrier:
498 printk(KERN_INFO "btrfs: turning off barriers\n"); 498 btrfs_info(root->fs_info, "turning off barriers");
499 btrfs_set_opt(info->mount_opt, NOBARRIER); 499 btrfs_set_opt(info->mount_opt, NOBARRIER);
500 break; 500 break;
501 case Opt_thread_pool: 501 case Opt_thread_pool:
@@ -520,7 +520,7 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
520 info->max_inline, 520 info->max_inline,
521 root->sectorsize); 521 root->sectorsize);
522 } 522 }
523 printk(KERN_INFO "btrfs: max_inline at %llu\n", 523 btrfs_info(root->fs_info, "max_inline at %llu",
524 info->max_inline); 524 info->max_inline);
525 } else { 525 } else {
526 ret = -ENOMEM; 526 ret = -ENOMEM;
@@ -534,8 +534,7 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
534 info->alloc_start = memparse(num, NULL); 534 info->alloc_start = memparse(num, NULL);
535 mutex_unlock(&info->chunk_mutex); 535 mutex_unlock(&info->chunk_mutex);
536 kfree(num); 536 kfree(num);
537 printk(KERN_INFO 537 btrfs_info(root->fs_info, "allocations start at %llu",
538 "btrfs: allocations start at %llu\n",
539 info->alloc_start); 538 info->alloc_start);
540 } else { 539 } else {
541 ret = -ENOMEM; 540 ret = -ENOMEM;
@@ -546,11 +545,11 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
546 root->fs_info->sb->s_flags &= ~MS_POSIXACL; 545 root->fs_info->sb->s_flags &= ~MS_POSIXACL;
547 break; 546 break;
548 case Opt_notreelog: 547 case Opt_notreelog:
549 printk(KERN_INFO "btrfs: disabling tree log\n"); 548 btrfs_info(root->fs_info, "disabling tree log");
550 btrfs_set_opt(info->mount_opt, NOTREELOG); 549 btrfs_set_opt(info->mount_opt, NOTREELOG);
551 break; 550 break;
552 case Opt_flushoncommit: 551 case Opt_flushoncommit:
553 printk(KERN_INFO "btrfs: turning on flush-on-commit\n"); 552 btrfs_info(root->fs_info, "turning on flush-on-commit");
554 btrfs_set_opt(info->mount_opt, FLUSHONCOMMIT); 553 btrfs_set_opt(info->mount_opt, FLUSHONCOMMIT);
555 break; 554 break;
556 case Opt_ratio: 555 case Opt_ratio:
@@ -559,7 +558,7 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
559 goto out; 558 goto out;
560 } else if (intarg >= 0) { 559 } else if (intarg >= 0) {
561 info->metadata_ratio = intarg; 560 info->metadata_ratio = intarg;
562 printk(KERN_INFO "btrfs: metadata ratio %d\n", 561 btrfs_info(root->fs_info, "metadata ratio %d",
563 info->metadata_ratio); 562 info->metadata_ratio);
564 } else { 563 } else {
565 ret = -EINVAL; 564 ret = -EINVAL;
@@ -576,15 +575,15 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
576 btrfs_set_opt(info->mount_opt, RESCAN_UUID_TREE); 575 btrfs_set_opt(info->mount_opt, RESCAN_UUID_TREE);
577 break; 576 break;
578 case Opt_no_space_cache: 577 case Opt_no_space_cache:
579 printk(KERN_INFO "btrfs: disabling disk space caching\n"); 578 btrfs_info(root->fs_info, "disabling disk space caching");
580 btrfs_clear_opt(info->mount_opt, SPACE_CACHE); 579 btrfs_clear_opt(info->mount_opt, SPACE_CACHE);
581 break; 580 break;
582 case Opt_inode_cache: 581 case Opt_inode_cache:
583 printk(KERN_INFO "btrfs: enabling inode map caching\n"); 582 btrfs_info(root->fs_info, "enabling inode map caching");
584 btrfs_set_opt(info->mount_opt, INODE_MAP_CACHE); 583 btrfs_set_opt(info->mount_opt, INODE_MAP_CACHE);
585 break; 584 break;
586 case Opt_clear_cache: 585 case Opt_clear_cache:
587 printk(KERN_INFO "btrfs: force clearing of disk cache\n"); 586 btrfs_info(root->fs_info, "force clearing of disk cache");
588 btrfs_set_opt(info->mount_opt, CLEAR_CACHE); 587 btrfs_set_opt(info->mount_opt, CLEAR_CACHE);
589 break; 588 break;
590 case Opt_user_subvol_rm_allowed: 589 case Opt_user_subvol_rm_allowed:
@@ -594,11 +593,11 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
594 btrfs_set_opt(info->mount_opt, ENOSPC_DEBUG); 593 btrfs_set_opt(info->mount_opt, ENOSPC_DEBUG);
595 break; 594 break;
596 case Opt_defrag: 595 case Opt_defrag:
597 printk(KERN_INFO "btrfs: enabling auto defrag\n"); 596 btrfs_info(root->fs_info, "enabling auto defrag");
598 btrfs_set_opt(info->mount_opt, AUTO_DEFRAG); 597 btrfs_set_opt(info->mount_opt, AUTO_DEFRAG);
599 break; 598 break;
600 case Opt_recovery: 599 case Opt_recovery:
601 printk(KERN_INFO "btrfs: enabling auto recovery\n"); 600 btrfs_info(root->fs_info, "enabling auto recovery");
602 btrfs_set_opt(info->mount_opt, RECOVERY); 601 btrfs_set_opt(info->mount_opt, RECOVERY);
603 break; 602 break;
604 case Opt_skip_balance: 603 case Opt_skip_balance:
@@ -606,14 +605,14 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
606 break; 605 break;
607#ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY 606#ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY
608 case Opt_check_integrity_including_extent_data: 607 case Opt_check_integrity_including_extent_data:
609 printk(KERN_INFO "btrfs: enabling check integrity" 608 btrfs_info(root->fs_info,
610 " including extent data\n"); 609 "enabling check integrity including extent data");
611 btrfs_set_opt(info->mount_opt, 610 btrfs_set_opt(info->mount_opt,
612 CHECK_INTEGRITY_INCLUDING_EXTENT_DATA); 611 CHECK_INTEGRITY_INCLUDING_EXTENT_DATA);
613 btrfs_set_opt(info->mount_opt, CHECK_INTEGRITY); 612 btrfs_set_opt(info->mount_opt, CHECK_INTEGRITY);
614 break; 613 break;
615 case Opt_check_integrity: 614 case Opt_check_integrity:
616 printk(KERN_INFO "btrfs: enabling check integrity\n"); 615 btrfs_info(root->fs_info, "enabling check integrity");
617 btrfs_set_opt(info->mount_opt, CHECK_INTEGRITY); 616 btrfs_set_opt(info->mount_opt, CHECK_INTEGRITY);
618 break; 617 break;
619 case Opt_check_integrity_print_mask: 618 case Opt_check_integrity_print_mask:
@@ -622,8 +621,7 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
622 goto out; 621 goto out;
623 } else if (intarg >= 0) { 622 } else if (intarg >= 0) {
624 info->check_integrity_print_mask = intarg; 623 info->check_integrity_print_mask = intarg;
625 printk(KERN_INFO "btrfs:" 624 btrfs_info(root->fs_info, "check_integrity_print_mask 0x%x",
626 " check_integrity_print_mask 0x%x\n",
627 info->check_integrity_print_mask); 625 info->check_integrity_print_mask);
628 } else { 626 } else {
629 ret = -EINVAL; 627 ret = -EINVAL;
@@ -634,8 +632,8 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
634 case Opt_check_integrity_including_extent_data: 632 case Opt_check_integrity_including_extent_data:
635 case Opt_check_integrity: 633 case Opt_check_integrity:
636 case Opt_check_integrity_print_mask: 634 case Opt_check_integrity_print_mask:
637 printk(KERN_ERR "btrfs: support for check_integrity*" 635 btrfs_err(root->fs_info,
638 " not compiled in!\n"); 636 "support for check_integrity* not compiled in!");
639 ret = -EINVAL; 637 ret = -EINVAL;
640 goto out; 638 goto out;
641#endif 639#endif
@@ -655,28 +653,24 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
655 intarg = 0; 653 intarg = 0;
656 ret = match_int(&args[0], &intarg); 654 ret = match_int(&args[0], &intarg);
657 if (ret < 0) { 655 if (ret < 0) {
658 printk(KERN_ERR 656 btrfs_err(root->fs_info, "invalid commit interval");
659 "btrfs: invalid commit interval\n");
660 ret = -EINVAL; 657 ret = -EINVAL;
661 goto out; 658 goto out;
662 } 659 }
663 if (intarg > 0) { 660 if (intarg > 0) {
664 if (intarg > 300) { 661 if (intarg > 300) {
665 printk(KERN_WARNING 662 btrfs_warn(root->fs_info, "excessive commit interval %d",
666 "btrfs: excessive commit interval %d\n",
667 intarg); 663 intarg);
668 } 664 }
669 info->commit_interval = intarg; 665 info->commit_interval = intarg;
670 } else { 666 } else {
671 printk(KERN_INFO 667 btrfs_info(root->fs_info, "using default commit interval %ds",
672 "btrfs: using default commit interval %ds\n",
673 BTRFS_DEFAULT_COMMIT_INTERVAL); 668 BTRFS_DEFAULT_COMMIT_INTERVAL);
674 info->commit_interval = BTRFS_DEFAULT_COMMIT_INTERVAL; 669 info->commit_interval = BTRFS_DEFAULT_COMMIT_INTERVAL;
675 } 670 }
676 break; 671 break;
677 case Opt_err: 672 case Opt_err:
678 printk(KERN_INFO "btrfs: unrecognized mount option " 673 btrfs_info(root->fs_info, "unrecognized mount option '%s'", p);
679 "'%s'\n", p);
680 ret = -EINVAL; 674 ret = -EINVAL;
681 goto out; 675 goto out;
682 default: 676 default:
@@ -685,7 +679,7 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
685 } 679 }
686out: 680out:
687 if (!ret && btrfs_test_opt(root, SPACE_CACHE)) 681 if (!ret && btrfs_test_opt(root, SPACE_CACHE))
688 printk(KERN_INFO "btrfs: disk space caching is enabled\n"); 682 btrfs_info(root->fs_info, "disk space caching is enabled");
689 kfree(orig); 683 kfree(orig);
690 return ret; 684 return ret;
691} 685}
@@ -748,7 +742,8 @@ static int btrfs_parse_early_options(const char *options, fmode_t flags,
748 break; 742 break;
749 case Opt_subvolrootid: 743 case Opt_subvolrootid:
750 printk(KERN_WARNING 744 printk(KERN_WARNING
751 "btrfs: 'subvolrootid' mount option is deprecated and has no effect\n"); 745 "BTRFS: 'subvolrootid' mount option is deprecated and has "
746 "no effect\n");
752 break; 747 break;
753 case Opt_device: 748 case Opt_device:
754 device_name = match_strdup(&args[0]); 749 device_name = match_strdup(&args[0]);
@@ -877,7 +872,7 @@ static int btrfs_fill_super(struct super_block *sb,
877 sb->s_flags |= MS_I_VERSION; 872 sb->s_flags |= MS_I_VERSION;
878 err = open_ctree(sb, fs_devices, (char *)data); 873 err = open_ctree(sb, fs_devices, (char *)data);
879 if (err) { 874 if (err) {
880 printk("btrfs: open_ctree failed\n"); 875 printk(KERN_ERR "BTRFS: open_ctree failed\n");
881 return err; 876 return err;
882 } 877 }
883 878
@@ -1115,7 +1110,7 @@ static struct dentry *mount_subvol(const char *subvol_name, int flags,
1115 dput(root); 1110 dput(root);
1116 root = ERR_PTR(-EINVAL); 1111 root = ERR_PTR(-EINVAL);
1117 deactivate_locked_super(s); 1112 deactivate_locked_super(s);
1118 printk(KERN_ERR "btrfs: '%s' is not a valid subvolume\n", 1113 printk(KERN_ERR "BTRFS: '%s' is not a valid subvolume\n",
1119 subvol_name); 1114 subvol_name);
1120 } 1115 }
1121 1116
@@ -1240,7 +1235,7 @@ static void btrfs_resize_thread_pool(struct btrfs_fs_info *fs_info,
1240 1235
1241 fs_info->thread_pool_size = new_pool_size; 1236 fs_info->thread_pool_size = new_pool_size;
1242 1237
1243 printk(KERN_INFO "btrfs: resize thread pool %d -> %d\n", 1238 btrfs_info(fs_info, "resize thread pool %d -> %d",
1244 old_pool_size, new_pool_size); 1239 old_pool_size, new_pool_size);
1245 1240
1246 btrfs_set_max_workers(&fs_info->generic_worker, new_pool_size); 1241 btrfs_set_max_workers(&fs_info->generic_worker, new_pool_size);
@@ -1346,7 +1341,7 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
1346 } else { 1341 } else {
1347 if (test_bit(BTRFS_FS_STATE_ERROR, &root->fs_info->fs_state)) { 1342 if (test_bit(BTRFS_FS_STATE_ERROR, &root->fs_info->fs_state)) {
1348 btrfs_err(fs_info, 1343 btrfs_err(fs_info,
1349 "Remounting read-write after error is not allowed\n"); 1344 "Remounting read-write after error is not allowed");
1350 ret = -EINVAL; 1345 ret = -EINVAL;
1351 goto restore; 1346 goto restore;
1352 } 1347 }
@@ -1358,8 +1353,8 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
1358 if (fs_info->fs_devices->missing_devices > 1353 if (fs_info->fs_devices->missing_devices >
1359 fs_info->num_tolerated_disk_barrier_failures && 1354 fs_info->num_tolerated_disk_barrier_failures &&
1360 !(*flags & MS_RDONLY)) { 1355 !(*flags & MS_RDONLY)) {
1361 printk(KERN_WARNING 1356 btrfs_warn(fs_info,
1362 "Btrfs: too many missing devices, writeable remount is not allowed\n"); 1357 "too many missing devices, writeable remount is not allowed");
1363 ret = -EACCES; 1358 ret = -EACCES;
1364 goto restore; 1359 goto restore;
1365 } 1360 }
@@ -1384,16 +1379,15 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
1384 1379
1385 ret = btrfs_resume_dev_replace_async(fs_info); 1380 ret = btrfs_resume_dev_replace_async(fs_info);
1386 if (ret) { 1381 if (ret) {
1387 pr_warn("btrfs: failed to resume dev_replace\n"); 1382 btrfs_warn(fs_info, "failed to resume dev_replace");
1388 goto restore; 1383 goto restore;
1389 } 1384 }
1390 1385
1391 if (!fs_info->uuid_root) { 1386 if (!fs_info->uuid_root) {
1392 pr_info("btrfs: creating UUID tree\n"); 1387 btrfs_info(fs_info, "creating UUID tree");
1393 ret = btrfs_create_uuid_tree(fs_info); 1388 ret = btrfs_create_uuid_tree(fs_info);
1394 if (ret) { 1389 if (ret) {
1395 pr_warn("btrfs: failed to create the uuid tree" 1390 btrfs_warn(fs_info, "failed to create the UUID tree %d", ret);
1396 "%d\n", ret);
1397 goto restore; 1391 goto restore;
1398 } 1392 }
1399 } 1393 }
@@ -1773,7 +1767,7 @@ static int btrfs_interface_init(void)
1773static void btrfs_interface_exit(void) 1767static void btrfs_interface_exit(void)
1774{ 1768{
1775 if (misc_deregister(&btrfs_misc) < 0) 1769 if (misc_deregister(&btrfs_misc) < 0)
1776 printk(KERN_INFO "btrfs: misc_deregister failed for control device\n"); 1770 printk(KERN_INFO "BTRFS: misc_deregister failed for control device\n");
1777} 1771}
1778 1772
1779static void btrfs_print_info(void) 1773static void btrfs_print_info(void)
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index f25deb9c132c..ba94b277e98d 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -374,7 +374,7 @@ static ssize_t btrfs_label_store(struct kobject *kobj,
374 int ret; 374 int ret;
375 375
376 if (len >= BTRFS_LABEL_SIZE) { 376 if (len >= BTRFS_LABEL_SIZE) {
377 pr_err("btrfs: unable to set label with more than %d bytes\n", 377 pr_err("BTRFS: unable to set label with more than %d bytes\n",
378 BTRFS_LABEL_SIZE - 1); 378 BTRFS_LABEL_SIZE - 1);
379 return -EINVAL; 379 return -EINVAL;
380 } 380 }
diff --git a/fs/btrfs/tests/btrfs-tests.h b/fs/btrfs/tests/btrfs-tests.h
index b353bc806ca0..312560a9123d 100644
--- a/fs/btrfs/tests/btrfs-tests.h
+++ b/fs/btrfs/tests/btrfs-tests.h
@@ -21,7 +21,7 @@
21 21
22#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS 22#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
23 23
24#define test_msg(fmt, ...) pr_info("btrfs: selftest: " fmt, ##__VA_ARGS__) 24#define test_msg(fmt, ...) pr_info("BTRFS: selftest: " fmt, ##__VA_ARGS__)
25 25
26int btrfs_test_free_space_cache(void); 26int btrfs_test_free_space_cache(void);
27int btrfs_test_extent_buffer_operations(void); 27int btrfs_test_extent_buffer_operations(void);
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 026f1fea963e..46bfd820d91f 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -198,10 +198,10 @@ loop:
198 */ 198 */
199 smp_mb(); 199 smp_mb();
200 if (!list_empty(&fs_info->tree_mod_seq_list)) 200 if (!list_empty(&fs_info->tree_mod_seq_list))
201 WARN(1, KERN_ERR "btrfs: tree_mod_seq_list not empty when " 201 WARN(1, KERN_ERR "BTRFS: tree_mod_seq_list not empty when "
202 "creating a fresh transaction\n"); 202 "creating a fresh transaction\n");
203 if (!RB_EMPTY_ROOT(&fs_info->tree_mod_log)) 203 if (!RB_EMPTY_ROOT(&fs_info->tree_mod_log))
204 WARN(1, KERN_ERR "btrfs: tree_mod_log rb tree not empty when " 204 WARN(1, KERN_ERR "BTRFS: tree_mod_log rb tree not empty when "
205 "creating a fresh transaction\n"); 205 "creating a fresh transaction\n");
206 atomic64_set(&fs_info->tree_mod_seq, 0); 206 atomic64_set(&fs_info->tree_mod_seq, 0);
207 207
@@ -1107,7 +1107,7 @@ int btrfs_defrag_root(struct btrfs_root *root)
1107 break; 1107 break;
1108 1108
1109 if (btrfs_defrag_cancelled(root->fs_info)) { 1109 if (btrfs_defrag_cancelled(root->fs_info)) {
1110 printk(KERN_DEBUG "btrfs: defrag_root cancelled\n"); 1110 pr_debug("BTRFS: defrag_root cancelled\n");
1111 ret = -EAGAIN; 1111 ret = -EAGAIN;
1112 break; 1112 break;
1113 } 1113 }
@@ -1981,7 +1981,7 @@ int btrfs_clean_one_deleted_snapshot(struct btrfs_root *root)
1981 list_del_init(&root->root_list); 1981 list_del_init(&root->root_list);
1982 spin_unlock(&fs_info->trans_lock); 1982 spin_unlock(&fs_info->trans_lock);
1983 1983
1984 pr_debug("btrfs: cleaner removing %llu\n", root->objectid); 1984 pr_debug("BTRFS: cleaner removing %llu\n", root->objectid);
1985 1985
1986 btrfs_kill_all_delayed_nodes(root); 1986 btrfs_kill_all_delayed_nodes(root);
1987 1987
diff --git a/fs/btrfs/uuid-tree.c b/fs/btrfs/uuid-tree.c
index fbda90004fe9..f6a4c03ee7d8 100644
--- a/fs/btrfs/uuid-tree.c
+++ b/fs/btrfs/uuid-tree.c
@@ -69,7 +69,7 @@ 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 pr_warn("btrfs: uuid item with illegal size %lu!\n", 72 btrfs_warn(uuid_root->fs_info, "uuid item with illegal size %lu!",
73 (unsigned long)item_size); 73 (unsigned long)item_size);
74 goto out; 74 goto out;
75 } 75 }
@@ -137,7 +137,8 @@ int btrfs_uuid_tree_add(struct btrfs_trans_handle *trans,
137 offset = btrfs_item_ptr_offset(eb, slot); 137 offset = btrfs_item_ptr_offset(eb, slot);
138 offset += btrfs_item_size_nr(eb, slot) - sizeof(subid_le); 138 offset += btrfs_item_size_nr(eb, slot) - sizeof(subid_le);
139 } else if (ret < 0) { 139 } else if (ret < 0) {
140 pr_warn("btrfs: insert uuid item failed %d (0x%016llx, 0x%016llx) type %u!\n", 140 btrfs_warn(uuid_root->fs_info, "insert uuid item failed %d "
141 "(0x%016llx, 0x%016llx) type %u!",
141 ret, (unsigned long long)key.objectid, 142 ret, (unsigned long long)key.objectid,
142 (unsigned long long)key.offset, type); 143 (unsigned long long)key.offset, type);
143 goto out; 144 goto out;
@@ -183,7 +184,7 @@ int btrfs_uuid_tree_rem(struct btrfs_trans_handle *trans,
183 184
184 ret = btrfs_search_slot(trans, uuid_root, &key, path, -1, 1); 185 ret = btrfs_search_slot(trans, uuid_root, &key, path, -1, 1);
185 if (ret < 0) { 186 if (ret < 0) {
186 pr_warn("btrfs: error %d while searching for uuid item!\n", 187 btrfs_warn(uuid_root->fs_info, "error %d while searching for uuid item!",
187 ret); 188 ret);
188 goto out; 189 goto out;
189 } 190 }
@@ -197,7 +198,7 @@ int btrfs_uuid_tree_rem(struct btrfs_trans_handle *trans,
197 offset = btrfs_item_ptr_offset(eb, slot); 198 offset = btrfs_item_ptr_offset(eb, slot);
198 item_size = btrfs_item_size_nr(eb, slot); 199 item_size = btrfs_item_size_nr(eb, slot);
199 if (!IS_ALIGNED(item_size, sizeof(u64))) { 200 if (!IS_ALIGNED(item_size, sizeof(u64))) {
200 pr_warn("btrfs: uuid item with illegal size %lu!\n", 201 btrfs_warn(uuid_root->fs_info, "uuid item with illegal size %lu!",
201 (unsigned long)item_size); 202 (unsigned long)item_size);
202 ret = -ENOENT; 203 ret = -ENOENT;
203 goto out; 204 goto out;
@@ -299,7 +300,7 @@ again_search_slot:
299 offset = btrfs_item_ptr_offset(leaf, slot); 300 offset = btrfs_item_ptr_offset(leaf, slot);
300 item_size = btrfs_item_size_nr(leaf, slot); 301 item_size = btrfs_item_size_nr(leaf, slot);
301 if (!IS_ALIGNED(item_size, sizeof(u64))) { 302 if (!IS_ALIGNED(item_size, sizeof(u64))) {
302 pr_warn("btrfs: uuid item with illegal size %lu!\n", 303 btrfs_warn(fs_info, "uuid item with illegal size %lu!",
303 (unsigned long)item_size); 304 (unsigned long)item_size);
304 goto skip; 305 goto skip;
305 } 306 }
@@ -349,6 +350,6 @@ skip:
349out: 350out:
350 btrfs_free_path(path); 351 btrfs_free_path(path);
351 if (ret) 352 if (ret)
352 pr_warn("btrfs: btrfs_uuid_tree_iterate failed %d\n", ret); 353 btrfs_warn(fs_info, "btrfs_uuid_tree_iterate failed %d", ret);
353 return 0; 354 return 0;
354} 355}
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 92303f42baaa..b68afe32419f 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -125,7 +125,7 @@ static void btrfs_kobject_uevent(struct block_device *bdev,
125 125
126 ret = kobject_uevent(&disk_to_dev(bdev->bd_disk)->kobj, action); 126 ret = kobject_uevent(&disk_to_dev(bdev->bd_disk)->kobj, action);
127 if (ret) 127 if (ret)
128 pr_warn("Sending event '%d' to kobject: '%s' (%p): failed\n", 128 pr_warn("BTRFS: Sending event '%d' to kobject: '%s' (%p): failed\n",
129 action, 129 action,
130 kobject_name(&disk_to_dev(bdev->bd_disk)->kobj), 130 kobject_name(&disk_to_dev(bdev->bd_disk)->kobj),
131 &disk_to_dev(bdev->bd_disk)->kobj); 131 &disk_to_dev(bdev->bd_disk)->kobj);
@@ -200,7 +200,7 @@ btrfs_get_bdev_and_sb(const char *device_path, fmode_t flags, void *holder,
200 200
201 if (IS_ERR(*bdev)) { 201 if (IS_ERR(*bdev)) {
202 ret = PTR_ERR(*bdev); 202 ret = PTR_ERR(*bdev);
203 printk(KERN_INFO "btrfs: open %s failed\n", device_path); 203 printk(KERN_INFO "BTRFS: open %s failed\n", device_path);
204 goto error; 204 goto error;
205 } 205 }
206 206
@@ -912,9 +912,9 @@ int btrfs_scan_one_device(const char *path, fmode_t flags, void *holder,
912 if (disk_super->label[0]) { 912 if (disk_super->label[0]) {
913 if (disk_super->label[BTRFS_LABEL_SIZE - 1]) 913 if (disk_super->label[BTRFS_LABEL_SIZE - 1])
914 disk_super->label[BTRFS_LABEL_SIZE - 1] = '\0'; 914 disk_super->label[BTRFS_LABEL_SIZE - 1] = '\0';
915 printk(KERN_INFO "btrfs: device label %s ", disk_super->label); 915 printk(KERN_INFO "BTRFS: device label %s ", disk_super->label);
916 } else { 916 } else {
917 printk(KERN_INFO "btrfs: device fsid %pU ", disk_super->fsid); 917 printk(KERN_INFO "BTRFS: device fsid %pU ", disk_super->fsid);
918 } 918 }
919 919
920 printk(KERN_CONT "devid %llu transid %llu %s\n", devid, transid, path); 920 printk(KERN_CONT "devid %llu transid %llu %s\n", devid, transid, path);
@@ -1813,7 +1813,7 @@ int btrfs_find_device_missing_or_by_path(struct btrfs_root *root,
1813 } 1813 }
1814 1814
1815 if (!*device) { 1815 if (!*device) {
1816 pr_err("btrfs: no missing device found\n"); 1816 btrfs_err(root->fs_info, "no missing device found");
1817 return -ENOENT; 1817 return -ENOENT;
1818 } 1818 }
1819 1819
@@ -3052,7 +3052,7 @@ loop:
3052error: 3052error:
3053 btrfs_free_path(path); 3053 btrfs_free_path(path);
3054 if (enospc_errors) { 3054 if (enospc_errors) {
3055 printk(KERN_INFO "btrfs: %d enospc errors during balance\n", 3055 btrfs_info(fs_info, "%d enospc errors during balance",
3056 enospc_errors); 3056 enospc_errors);
3057 if (!ret) 3057 if (!ret)
3058 ret = -ENOSPC; 3058 ret = -ENOSPC;
@@ -3138,8 +3138,8 @@ int btrfs_balance(struct btrfs_balance_control *bctl,
3138 if (!(bctl->flags & BTRFS_BALANCE_DATA) || 3138 if (!(bctl->flags & BTRFS_BALANCE_DATA) ||
3139 !(bctl->flags & BTRFS_BALANCE_METADATA) || 3139 !(bctl->flags & BTRFS_BALANCE_METADATA) ||
3140 memcmp(&bctl->data, &bctl->meta, sizeof(bctl->data))) { 3140 memcmp(&bctl->data, &bctl->meta, sizeof(bctl->data))) {
3141 printk(KERN_ERR "btrfs: with mixed groups data and " 3141 btrfs_err(fs_info, "with mixed groups data and "
3142 "metadata balance options must be the same\n"); 3142 "metadata balance options must be the same");
3143 ret = -EINVAL; 3143 ret = -EINVAL;
3144 goto out; 3144 goto out;
3145 } 3145 }
@@ -3165,8 +3165,8 @@ int btrfs_balance(struct btrfs_balance_control *bctl,
3165 if ((bctl->data.flags & BTRFS_BALANCE_ARGS_CONVERT) && 3165 if ((bctl->data.flags & BTRFS_BALANCE_ARGS_CONVERT) &&
3166 (!alloc_profile_is_valid(bctl->data.target, 1) || 3166 (!alloc_profile_is_valid(bctl->data.target, 1) ||
3167 (bctl->data.target & ~allowed))) { 3167 (bctl->data.target & ~allowed))) {
3168 printk(KERN_ERR "btrfs: unable to start balance with target " 3168 btrfs_err(fs_info, "unable to start balance with target "
3169 "data profile %llu\n", 3169 "data profile %llu",
3170 bctl->data.target); 3170 bctl->data.target);
3171 ret = -EINVAL; 3171 ret = -EINVAL;
3172 goto out; 3172 goto out;
@@ -3174,8 +3174,8 @@ int btrfs_balance(struct btrfs_balance_control *bctl,
3174 if ((bctl->meta.flags & BTRFS_BALANCE_ARGS_CONVERT) && 3174 if ((bctl->meta.flags & BTRFS_BALANCE_ARGS_CONVERT) &&
3175 (!alloc_profile_is_valid(bctl->meta.target, 1) || 3175 (!alloc_profile_is_valid(bctl->meta.target, 1) ||
3176 (bctl->meta.target & ~allowed))) { 3176 (bctl->meta.target & ~allowed))) {
3177 printk(KERN_ERR "btrfs: unable to start balance with target " 3177 btrfs_err(fs_info,
3178 "metadata profile %llu\n", 3178 "unable to start balance with target metadata profile %llu",
3179 bctl->meta.target); 3179 bctl->meta.target);
3180 ret = -EINVAL; 3180 ret = -EINVAL;
3181 goto out; 3181 goto out;
@@ -3183,8 +3183,8 @@ int btrfs_balance(struct btrfs_balance_control *bctl,
3183 if ((bctl->sys.flags & BTRFS_BALANCE_ARGS_CONVERT) && 3183 if ((bctl->sys.flags & BTRFS_BALANCE_ARGS_CONVERT) &&
3184 (!alloc_profile_is_valid(bctl->sys.target, 1) || 3184 (!alloc_profile_is_valid(bctl->sys.target, 1) ||
3185 (bctl->sys.target & ~allowed))) { 3185 (bctl->sys.target & ~allowed))) {
3186 printk(KERN_ERR "btrfs: unable to start balance with target " 3186 btrfs_err(fs_info,
3187 "system profile %llu\n", 3187 "unable to start balance with target system profile %llu",
3188 bctl->sys.target); 3188 bctl->sys.target);
3189 ret = -EINVAL; 3189 ret = -EINVAL;
3190 goto out; 3190 goto out;
@@ -3193,7 +3193,7 @@ int btrfs_balance(struct btrfs_balance_control *bctl,
3193 /* allow dup'ed data chunks only in mixed mode */ 3193 /* allow dup'ed data chunks only in mixed mode */
3194 if (!mixed && (bctl->data.flags & BTRFS_BALANCE_ARGS_CONVERT) && 3194 if (!mixed && (bctl->data.flags & BTRFS_BALANCE_ARGS_CONVERT) &&
3195 (bctl->data.target & BTRFS_BLOCK_GROUP_DUP)) { 3195 (bctl->data.target & BTRFS_BLOCK_GROUP_DUP)) {
3196 printk(KERN_ERR "btrfs: dup for data is not allowed\n"); 3196 btrfs_err(fs_info, "dup for data is not allowed");
3197 ret = -EINVAL; 3197 ret = -EINVAL;
3198 goto out; 3198 goto out;
3199 } 3199 }
@@ -3213,11 +3213,10 @@ int btrfs_balance(struct btrfs_balance_control *bctl,
3213 (fs_info->avail_metadata_alloc_bits & allowed) && 3213 (fs_info->avail_metadata_alloc_bits & allowed) &&
3214 !(bctl->meta.target & allowed))) { 3214 !(bctl->meta.target & allowed))) {
3215 if (bctl->flags & BTRFS_BALANCE_FORCE) { 3215 if (bctl->flags & BTRFS_BALANCE_FORCE) {
3216 printk(KERN_INFO "btrfs: force reducing metadata " 3216 btrfs_info(fs_info, "force reducing metadata integrity");
3217 "integrity\n");
3218 } else { 3217 } else {
3219 printk(KERN_ERR "btrfs: balance will reduce metadata " 3218 btrfs_err(fs_info, "balance will reduce metadata "
3220 "integrity, use force if you want this\n"); 3219 "integrity, use force if you want this");
3221 ret = -EINVAL; 3220 ret = -EINVAL;
3222 goto out; 3221 goto out;
3223 } 3222 }
@@ -3303,7 +3302,7 @@ static int balance_kthread(void *data)
3303 mutex_lock(&fs_info->balance_mutex); 3302 mutex_lock(&fs_info->balance_mutex);
3304 3303
3305 if (fs_info->balance_ctl) { 3304 if (fs_info->balance_ctl) {
3306 printk(KERN_INFO "btrfs: continuing balance\n"); 3305 btrfs_info(fs_info, "continuing balance");
3307 ret = btrfs_balance(fs_info->balance_ctl, NULL); 3306 ret = btrfs_balance(fs_info->balance_ctl, NULL);
3308 } 3307 }
3309 3308
@@ -3325,7 +3324,7 @@ int btrfs_resume_balance_async(struct btrfs_fs_info *fs_info)
3325 spin_unlock(&fs_info->balance_lock); 3324 spin_unlock(&fs_info->balance_lock);
3326 3325
3327 if (btrfs_test_opt(fs_info->tree_root, SKIP_BALANCE)) { 3326 if (btrfs_test_opt(fs_info->tree_root, SKIP_BALANCE)) {
3328 printk(KERN_INFO "btrfs: force skipping balance\n"); 3327 btrfs_info(fs_info, "force skipping balance");
3329 return 0; 3328 return 0;
3330 } 3329 }
3331 3330
@@ -3543,7 +3542,7 @@ update_tree:
3543 BTRFS_UUID_KEY_SUBVOL, 3542 BTRFS_UUID_KEY_SUBVOL,
3544 key.objectid); 3543 key.objectid);
3545 if (ret < 0) { 3544 if (ret < 0) {
3546 pr_warn("btrfs: uuid_tree_add failed %d\n", 3545 btrfs_warn(fs_info, "uuid_tree_add failed %d",
3547 ret); 3546 ret);
3548 break; 3547 break;
3549 } 3548 }
@@ -3555,7 +3554,7 @@ update_tree:
3555 BTRFS_UUID_KEY_RECEIVED_SUBVOL, 3554 BTRFS_UUID_KEY_RECEIVED_SUBVOL,
3556 key.objectid); 3555 key.objectid);
3557 if (ret < 0) { 3556 if (ret < 0) {
3558 pr_warn("btrfs: uuid_tree_add failed %d\n", 3557 btrfs_warn(fs_info, "uuid_tree_add failed %d",
3559 ret); 3558 ret);
3560 break; 3559 break;
3561 } 3560 }
@@ -3590,7 +3589,7 @@ out:
3590 if (trans && !IS_ERR(trans)) 3589 if (trans && !IS_ERR(trans))
3591 btrfs_end_transaction(trans, fs_info->uuid_root); 3590 btrfs_end_transaction(trans, fs_info->uuid_root);
3592 if (ret) 3591 if (ret)
3593 pr_warn("btrfs: btrfs_uuid_scan_kthread failed %d\n", ret); 3592 btrfs_warn(fs_info, "btrfs_uuid_scan_kthread failed %d", ret);
3594 else 3593 else
3595 fs_info->update_uuid_tree_gen = 1; 3594 fs_info->update_uuid_tree_gen = 1;
3596 up(&fs_info->uuid_tree_rescan_sem); 3595 up(&fs_info->uuid_tree_rescan_sem);
@@ -3654,7 +3653,7 @@ static int btrfs_uuid_rescan_kthread(void *data)
3654 */ 3653 */
3655 ret = btrfs_uuid_tree_iterate(fs_info, btrfs_check_uuid_tree_entry); 3654 ret = btrfs_uuid_tree_iterate(fs_info, btrfs_check_uuid_tree_entry);
3656 if (ret < 0) { 3655 if (ret < 0) {
3657 pr_warn("btrfs: iterating uuid_tree failed %d\n", ret); 3656 btrfs_warn(fs_info, "iterating uuid_tree failed %d", ret);
3658 up(&fs_info->uuid_tree_rescan_sem); 3657 up(&fs_info->uuid_tree_rescan_sem);
3659 return ret; 3658 return ret;
3660 } 3659 }
@@ -3695,7 +3694,7 @@ int btrfs_create_uuid_tree(struct btrfs_fs_info *fs_info)
3695 task = kthread_run(btrfs_uuid_scan_kthread, fs_info, "btrfs-uuid"); 3694 task = kthread_run(btrfs_uuid_scan_kthread, fs_info, "btrfs-uuid");
3696 if (IS_ERR(task)) { 3695 if (IS_ERR(task)) {
3697 /* fs_info->update_uuid_tree_gen remains 0 in all error case */ 3696 /* fs_info->update_uuid_tree_gen remains 0 in all error case */
3698 pr_warn("btrfs: failed to start uuid_scan task\n"); 3697 btrfs_warn(fs_info, "failed to start uuid_scan task");
3699 up(&fs_info->uuid_tree_rescan_sem); 3698 up(&fs_info->uuid_tree_rescan_sem);
3700 return PTR_ERR(task); 3699 return PTR_ERR(task);
3701 } 3700 }
@@ -3711,7 +3710,7 @@ int btrfs_check_uuid_tree(struct btrfs_fs_info *fs_info)
3711 task = kthread_run(btrfs_uuid_rescan_kthread, fs_info, "btrfs-uuid"); 3710 task = kthread_run(btrfs_uuid_rescan_kthread, fs_info, "btrfs-uuid");
3712 if (IS_ERR(task)) { 3711 if (IS_ERR(task)) {
3713 /* fs_info->update_uuid_tree_gen remains 0 in all error case */ 3712 /* fs_info->update_uuid_tree_gen remains 0 in all error case */
3714 pr_warn("btrfs: failed to start uuid_rescan task\n"); 3713 btrfs_warn(fs_info, "failed to start uuid_rescan task");
3715 up(&fs_info->uuid_tree_rescan_sem); 3714 up(&fs_info->uuid_tree_rescan_sem);
3716 return PTR_ERR(task); 3715 return PTR_ERR(task);
3717 } 3716 }
@@ -4033,7 +4032,7 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
4033 max_stripe_size = 32 * 1024 * 1024; 4032 max_stripe_size = 32 * 1024 * 1024;
4034 max_chunk_size = 2 * max_stripe_size; 4033 max_chunk_size = 2 * max_stripe_size;
4035 } else { 4034 } else {
4036 printk(KERN_ERR "btrfs: invalid chunk type 0x%llx requested\n", 4035 btrfs_err(info, "invalid chunk type 0x%llx requested\n",
4037 type); 4036 type);
4038 BUG_ON(1); 4037 BUG_ON(1);
4039 } 4038 }
@@ -4065,7 +4064,7 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
4065 4064
4066 if (!device->writeable) { 4065 if (!device->writeable) {
4067 WARN(1, KERN_ERR 4066 WARN(1, KERN_ERR
4068 "btrfs: read-only device in alloc_list\n"); 4067 "BTRFS: read-only device in alloc_list\n");
4069 continue; 4068 continue;
4070 } 4069 }
4071 4070
@@ -5193,13 +5192,13 @@ int btrfs_rmap_block(struct btrfs_mapping_tree *map_tree,
5193 read_unlock(&em_tree->lock); 5192 read_unlock(&em_tree->lock);
5194 5193
5195 if (!em) { 5194 if (!em) {
5196 printk(KERN_ERR "btrfs: couldn't find em for chunk %Lu\n", 5195 printk(KERN_ERR "BTRFS: couldn't find em for chunk %Lu\n",
5197 chunk_start); 5196 chunk_start);
5198 return -EIO; 5197 return -EIO;
5199 } 5198 }
5200 5199
5201 if (em->start != chunk_start) { 5200 if (em->start != chunk_start) {
5202 printk(KERN_ERR "btrfs: bad chunk start, em=%Lu, wanted=%Lu\n", 5201 printk(KERN_ERR "BTRFS: bad chunk start, em=%Lu, wanted=%Lu\n",
5203 em->start, chunk_start); 5202 em->start, chunk_start);
5204 free_extent_map(em); 5203 free_extent_map(em);
5205 return -EIO; 5204 return -EIO;
@@ -6123,7 +6122,8 @@ static int update_dev_stat_item(struct btrfs_trans_handle *trans,
6123 BUG_ON(!path); 6122 BUG_ON(!path);
6124 ret = btrfs_search_slot(trans, dev_root, &key, path, -1, 1); 6123 ret = btrfs_search_slot(trans, dev_root, &key, path, -1, 1);
6125 if (ret < 0) { 6124 if (ret < 0) {
6126 printk_in_rcu(KERN_WARNING "btrfs: error %d while searching for dev_stats item for device %s!\n", 6125 printk_in_rcu(KERN_WARNING "BTRFS: "
6126 "error %d while searching for dev_stats item for device %s!\n",
6127 ret, rcu_str_deref(device->name)); 6127 ret, rcu_str_deref(device->name));
6128 goto out; 6128 goto out;
6129 } 6129 }
@@ -6133,7 +6133,8 @@ static int update_dev_stat_item(struct btrfs_trans_handle *trans,
6133 /* need to delete old one and insert a new one */ 6133 /* need to delete old one and insert a new one */
6134 ret = btrfs_del_item(trans, dev_root, path); 6134 ret = btrfs_del_item(trans, dev_root, path);
6135 if (ret != 0) { 6135 if (ret != 0) {
6136 printk_in_rcu(KERN_WARNING "btrfs: delete too small dev_stats item for device %s failed %d!\n", 6136 printk_in_rcu(KERN_WARNING "BTRFS: "
6137 "delete too small dev_stats item for device %s failed %d!\n",
6137 rcu_str_deref(device->name), ret); 6138 rcu_str_deref(device->name), ret);
6138 goto out; 6139 goto out;
6139 } 6140 }
@@ -6146,7 +6147,8 @@ static int update_dev_stat_item(struct btrfs_trans_handle *trans,
6146 ret = btrfs_insert_empty_item(trans, dev_root, path, 6147 ret = btrfs_insert_empty_item(trans, dev_root, path,
6147 &key, sizeof(*ptr)); 6148 &key, sizeof(*ptr));
6148 if (ret < 0) { 6149 if (ret < 0) {
6149 printk_in_rcu(KERN_WARNING "btrfs: insert dev_stats item for device %s failed %d!\n", 6150 printk_in_rcu(KERN_WARNING "BTRFS: "
6151 "insert dev_stats item for device %s failed %d!\n",
6150 rcu_str_deref(device->name), ret); 6152 rcu_str_deref(device->name), ret);
6151 goto out; 6153 goto out;
6152 } 6154 }
@@ -6199,16 +6201,14 @@ static void btrfs_dev_stat_print_on_error(struct btrfs_device *dev)
6199{ 6201{
6200 if (!dev->dev_stats_valid) 6202 if (!dev->dev_stats_valid)
6201 return; 6203 return;
6202 printk_ratelimited_in_rcu(KERN_ERR 6204 printk_ratelimited_in_rcu(KERN_ERR "BTRFS: "
6203 "btrfs: bdev %s errs: wr %u, rd %u, flush %u, corrupt %u, gen %u\n", 6205 "bdev %s errs: wr %u, rd %u, flush %u, corrupt %u, gen %u\n",
6204 rcu_str_deref(dev->name), 6206 rcu_str_deref(dev->name),
6205 btrfs_dev_stat_read(dev, BTRFS_DEV_STAT_WRITE_ERRS), 6207 btrfs_dev_stat_read(dev, BTRFS_DEV_STAT_WRITE_ERRS),
6206 btrfs_dev_stat_read(dev, BTRFS_DEV_STAT_READ_ERRS), 6208 btrfs_dev_stat_read(dev, BTRFS_DEV_STAT_READ_ERRS),
6207 btrfs_dev_stat_read(dev, BTRFS_DEV_STAT_FLUSH_ERRS), 6209 btrfs_dev_stat_read(dev, BTRFS_DEV_STAT_FLUSH_ERRS),
6208 btrfs_dev_stat_read(dev, 6210 btrfs_dev_stat_read(dev, BTRFS_DEV_STAT_CORRUPTION_ERRS),
6209 BTRFS_DEV_STAT_CORRUPTION_ERRS), 6211 btrfs_dev_stat_read(dev, BTRFS_DEV_STAT_GENERATION_ERRS));
6210 btrfs_dev_stat_read(dev,
6211 BTRFS_DEV_STAT_GENERATION_ERRS));
6212} 6212}
6213 6213
6214static void btrfs_dev_stat_print_on_load(struct btrfs_device *dev) 6214static void btrfs_dev_stat_print_on_load(struct btrfs_device *dev)
@@ -6221,7 +6221,8 @@ static void btrfs_dev_stat_print_on_load(struct btrfs_device *dev)
6221 if (i == BTRFS_DEV_STAT_VALUES_MAX) 6221 if (i == BTRFS_DEV_STAT_VALUES_MAX)
6222 return; /* all values == 0, suppress message */ 6222 return; /* all values == 0, suppress message */
6223 6223
6224 printk_in_rcu(KERN_INFO "btrfs: bdev %s errs: wr %u, rd %u, flush %u, corrupt %u, gen %u\n", 6224 printk_in_rcu(KERN_INFO "BTRFS: "
6225 "bdev %s errs: wr %u, rd %u, flush %u, corrupt %u, gen %u\n",
6225 rcu_str_deref(dev->name), 6226 rcu_str_deref(dev->name),
6226 btrfs_dev_stat_read(dev, BTRFS_DEV_STAT_WRITE_ERRS), 6227 btrfs_dev_stat_read(dev, BTRFS_DEV_STAT_WRITE_ERRS),
6227 btrfs_dev_stat_read(dev, BTRFS_DEV_STAT_READ_ERRS), 6228 btrfs_dev_stat_read(dev, BTRFS_DEV_STAT_READ_ERRS),
@@ -6242,12 +6243,10 @@ int btrfs_get_dev_stats(struct btrfs_root *root,
6242 mutex_unlock(&fs_devices->device_list_mutex); 6243 mutex_unlock(&fs_devices->device_list_mutex);
6243 6244
6244 if (!dev) { 6245 if (!dev) {
6245 printk(KERN_WARNING 6246 btrfs_warn(root->fs_info, "get dev_stats failed, device not found");
6246 "btrfs: get dev_stats failed, device not found\n");
6247 return -ENODEV; 6247 return -ENODEV;
6248 } else if (!dev->dev_stats_valid) { 6248 } else if (!dev->dev_stats_valid) {
6249 printk(KERN_WARNING 6249 btrfs_warn(root->fs_info, "get dev_stats failed, not yet valid");
6250 "btrfs: get dev_stats failed, not yet valid\n");
6251 return -ENODEV; 6250 return -ENODEV;
6252 } else if (stats->flags & BTRFS_DEV_STATS_RESET) { 6251 } else if (stats->flags & BTRFS_DEV_STATS_RESET) {
6253 for (i = 0; i < BTRFS_DEV_STAT_VALUES_MAX; i++) { 6252 for (i = 0; i < BTRFS_DEV_STAT_VALUES_MAX; i++) {
diff --git a/fs/btrfs/zlib.c b/fs/btrfs/zlib.c
index 9acb846c3e7f..8e57191950cb 100644
--- a/fs/btrfs/zlib.c
+++ b/fs/btrfs/zlib.c
@@ -97,7 +97,7 @@ static int zlib_compress_pages(struct list_head *ws,
97 *total_in = 0; 97 *total_in = 0;
98 98
99 if (Z_OK != zlib_deflateInit(&workspace->def_strm, 3)) { 99 if (Z_OK != zlib_deflateInit(&workspace->def_strm, 3)) {
100 printk(KERN_WARNING "btrfs: deflateInit failed\n"); 100 printk(KERN_WARNING "BTRFS: deflateInit failed\n");
101 ret = -1; 101 ret = -1;
102 goto out; 102 goto out;
103 } 103 }
@@ -125,7 +125,7 @@ static int zlib_compress_pages(struct list_head *ws,
125 while (workspace->def_strm.total_in < len) { 125 while (workspace->def_strm.total_in < len) {
126 ret = zlib_deflate(&workspace->def_strm, Z_SYNC_FLUSH); 126 ret = zlib_deflate(&workspace->def_strm, Z_SYNC_FLUSH);
127 if (ret != Z_OK) { 127 if (ret != Z_OK) {
128 printk(KERN_DEBUG "btrfs: deflate in loop returned %d\n", 128 printk(KERN_DEBUG "BTRFS: deflate in loop returned %d\n",
129 ret); 129 ret);
130 zlib_deflateEnd(&workspace->def_strm); 130 zlib_deflateEnd(&workspace->def_strm);
131 ret = -1; 131 ret = -1;
@@ -252,7 +252,7 @@ static int zlib_decompress_biovec(struct list_head *ws, struct page **pages_in,
252 } 252 }
253 253
254 if (Z_OK != zlib_inflateInit2(&workspace->inf_strm, wbits)) { 254 if (Z_OK != zlib_inflateInit2(&workspace->inf_strm, wbits)) {
255 printk(KERN_WARNING "btrfs: inflateInit failed\n"); 255 printk(KERN_WARNING "BTRFS: inflateInit failed\n");
256 return -1; 256 return -1;
257 } 257 }
258 while (workspace->inf_strm.total_in < srclen) { 258 while (workspace->inf_strm.total_in < srclen) {
@@ -336,7 +336,7 @@ static int zlib_decompress(struct list_head *ws, unsigned char *data_in,
336 } 336 }
337 337
338 if (Z_OK != zlib_inflateInit2(&workspace->inf_strm, wbits)) { 338 if (Z_OK != zlib_inflateInit2(&workspace->inf_strm, wbits)) {
339 printk(KERN_WARNING "btrfs: inflateInit failed\n"); 339 printk(KERN_WARNING "BTRFS: inflateInit failed\n");
340 return -1; 340 return -1;
341 } 341 }
342 342