Skip to contentSkip to conversation

Btrfs: Include the device in most error printk()s

PATCH Superseded Simon Kirby 2 participants 4 messages Feb 13, 2013 – Mar 3, 2013 Btrfs file system

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Btrfs: Include the device in most error printk()s

With more than one btrfs volume mounted, it can be very difficult to find out which volume is hitting an error. btrfs_error() will print this, but it is currently rigged as more of a fatal error handler, while many of the printk()s are currently for debugging and yet-unhandled cases.

This may introduce some confusion with volumes backed by multiple devices emitting errors referring to the primary device in the set instead of the one on which the error occurred.

This patch just changes the functions where the device information is already available. Some cases remain where the root or fs_info is not passed to the function emitting the error.

---
 fs/btrfs/extent-tree.c      |   49 +++++++++++++++++++++++++++----------------
 fs/btrfs/free-space-cache.c |   28 +++++++++++++++----------
 fs/btrfs/inode.c            |   49 ++++++++++++++++++++++++++-----------------
 fs/btrfs/print-tree.c       |    8 ++++---
 fs/btrfs/volumes.c          |    8 ++++---
 5 files changed, 88 insertions(+), 54 deletions(-)
fs/btrfs/extent-tree.c +31 -18
index 5a3327b..6e9ebbe 100644
@@ -2300,7 +2300,10 @@ static noinline int run_clustered_refs(struct btrfs_trans_handle *trans,
 					list_del_init(&locked_ref->cluster);
 					mutex_unlock(&locked_ref->mutex);
 
-					printk(KERN_DEBUG "btrfs: run_delayed_extent_op returned %d\n", ret);
+					printk(KERN_DEBUG "btrfs %s: "
+					       "run_delayed_extent_op "
+					       "returned %d\n",
+					       fs_info->sb->s_id, ret);
 					spin_lock(&delayed_refs->lock);
 					return ret;
 				}
@@ -2346,7 +2349,8 @@ static noinline int run_clustered_refs(struct btrfs_trans_handle *trans,
 				list_del_init(&locked_ref->cluster);
 				mutex_unlock(&locked_ref->mutex);
 			}
-			printk(KERN_DEBUG "btrfs: run_one_delayed_ref returned %d\n", ret);
+			printk(KERN_DEBUG "btrfs %s: run_one_delayed_ref "
+			       "returned %d\n", fs_info->sb->s_id, ret);
 			spin_lock(&delayed_refs->lock);
 			return ret;
 		}
@@ -2410,7 +2414,8 @@ int btrfs_delayed_refs_qgroup_accounting(struct btrfs_trans_handle *trans,
 	if (list_empty(&trans->qgroup_ref_list) !=
 	    !trans->delayed_ref_elem.seq) {
 		/* list without seq or seq without list */
-		printk(KERN_ERR "btrfs: qgroup accounting update error, list is%s empty, seq is %llu\n",
+		printk(KERN_ERR "btrfs %s: qgroup accounting update error, "
+			"list is%s empty, seq is %llu\n", fs_info->sb->s_id,
 			list_empty(&trans->qgroup_ref_list) ? "" : " not",
 			trans->delayed_ref_elem.seq);
 		BUG();
@@ -3543,8 +3548,8 @@ static void check_system_chunk(struct btrfs_trans_handle *trans,
 
 	thresh = get_system_chunk_thresh(root, type);
 	if (left < thresh && btrfs_test_opt(root, ENOSPC_DEBUG)) {
-		printk(KERN_INFO "left=%llu, need=%llu, flags=%llu\n",
-		       left, thresh, type);
+		printk(KERN_INFO "btrfs %s: left=%llu, need=%llu, flags=%llu\n",
+		       root->fs_info->sb->s_id, left, thresh, type);
 		dump_space_info(info, 0, 0);
 	}
 
@@ -5155,8 +5160,9 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans,
 			ret = btrfs_search_slot(trans, extent_root,
 						&key, path, -1, 1);
 			if (ret) {
-				printk(KERN_ERR "umm, got %d back from search"
-				       ", was looking for %llu\n", ret,
+				printk(KERN_ERR "btrfs %s: umm, got %d back "
+				       "from search, was looking for %llu\n",
+				       info->sb->s_id, ret,
 				       (unsigned long long)bytenr);
 				if (ret > 0)
 					btrfs_print_leaf(extent_root,
@@ -5171,8 +5177,9 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans,
 	} else if (ret == -ENOENT) {
 		btrfs_print_leaf(extent_root, path->nodes[0]);
 		WARN_ON(1);
-		printk(KERN_ERR "btrfs unable to find ref byte nr %llu "
+		printk(KERN_ERR "btrfs %s: unable to find ref byte nr %llu "
 		       "parent %llu root %llu  owner %llu offset %llu\n",
+		       info->sb->s_id,
 		       (unsigned long long)bytenr,
 		       (unsigned long long)parent,
 		       (unsigned long long)root_objectid,
@@ -5205,8 +5212,8 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans,
 		ret = btrfs_search_slot(trans, extent_root, &key, path,
 					-1, 1);
 		if (ret) {
-			printk(KERN_ERR "umm, got %d back from search"
-			       ", was looking for %llu\n", ret,
+			printk(KERN_ERR "btrfs %s: umm, got %d back from search"
+			       ", was looking for %llu\n", info->sb->s_id, ret,
 			       (unsigned long long)bytenr);
 			btrfs_print_leaf(extent_root, path->nodes[0]);
 		}
@@ -5576,7 +5583,8 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans,
 
 	space_info = __find_space_info(root->fs_info, data);
 	if (!space_info) {
-		printk(KERN_ERR "No space info for %llu\n", data);
+		printk(KERN_ERR "btrfs %s: No space info for %llu\n",
+			root->fs_info->sb->s_id, data);
 		return -ENOSPC;
 	}
 
@@ -5993,8 +6001,10 @@ again:
 			struct btrfs_space_info *sinfo;
 
 			sinfo = __find_space_info(root->fs_info, data);
-			printk(KERN_ERR "btrfs allocation failed flags %llu, "
-			       "wanted %llu\n", (unsigned long long)data,
+			printk(KERN_ERR "btrfs %s: allocation failed "
+			       "flags %llu, wanted %llu\n",
+			       root->fs_info->sb->s_id,
+			       (unsigned long long)data,
 			       (unsigned long long)num_bytes);
 			if (sinfo)
 				dump_space_info(sinfo, num_bytes, 1);
@@ -6014,7 +6024,8 @@ static int __btrfs_free_reserved_extent(struct btrfs_root *root,
 
 	cache = btrfs_lookup_block_group(root->fs_info, start);
 	if (!cache) {
-		printk(KERN_ERR "Unable to find block group for %llu\n",
+		printk(KERN_ERR "btrfs %s: Unable to find block group "
+		       "for %llu\n", root->fs_info->sb->s_id,
 		       (unsigned long long)start);
 		return -ENOSPC;
 	}
@@ -6110,8 +6121,9 @@ static int alloc_reserved_file_extent(struct btrfs_trans_handle *trans,
 
 	ret = update_block_group(trans, root, ins->objectid, ins->offset, 1);
 	if (ret) { /* -ENOENT, logic error */
-		printk(KERN_ERR "btrfs update block group failed for %llu "
-		       "%llu\n", (unsigned long long)ins->objectid,
+		printk(KERN_ERR "btrfs %s: update block group failed for "
+		       "%llu %llu\n", fs_info->sb->s_id,
+		       (unsigned long long)ins->objectid,
 		       (unsigned long long)ins->offset);
 		BUG();
 	}
@@ -6174,8 +6186,9 @@ static int alloc_reserved_tree_block(struct btrfs_trans_handle *trans,
 
 	ret = update_block_group(trans, root, ins->objectid, ins->offset, 1);
 	if (ret) { /* -ENOENT, logic error */
-		printk(KERN_ERR "btrfs update block group failed for %llu "
-		       "%llu\n", (unsigned long long)ins->objectid,
+		printk(KERN_ERR "btrfs %s: update block group failed for "
+		       "%llu %llu\n", fs_info->sb->s_id,
+		       (unsigned long long)ins->objectid,
 		       (unsigned long long)ins->offset);
 		BUG();
 	}
fs/btrfs/free-space-cache.c +17 -11
index 0be7a87..ce7c502 100644
@@ -104,7 +104,8 @@ struct inode *lookup_free_space_inode(struct btrfs_root *root,
 
 	spin_lock(&block_group->lock);
 	if (!((BTRFS_I(inode)->flags & flags) == flags)) {
-		printk(KERN_INFO "Old style space inode found, converting.\n");
+		printk(KERN_INFO "btrfs %s: Old style space inode found, "
+		       "converting.\n", root->fs_info->sb->s_id);
 		BTRFS_I(inode)->flags |= BTRFS_INODE_NODATASUM |
 			BTRFS_INODE_NODATACOW;
 		block_group->disk_cache_state = BTRFS_DC_CLEAR;
@@ -833,8 +834,9 @@ int load_free_space_cache(struct btrfs_fs_info *fs_info,
 
 	if (!matched) {
 		__btrfs_remove_free_space_cache(ctl);
-		printk(KERN_ERR "block group %llu has an wrong amount of free "
-		       "space\n", block_group->key.objectid);
+		printk(KERN_ERR "btrfs %s: block group %llu has wrong amount "
+		       "of free space\n", fs_info->sb->s_id,
+		       block_group->key.objectid);
 		ret = -1;
 	}
 out:
@@ -845,8 +847,9 @@ out:
 		spin_unlock(&block_group->lock);
 		ret = 0;
 
-		printk(KERN_ERR "btrfs: failed to load free space cache "
-		       "for block group %llu\n", block_group->key.objectid);
+		printk(KERN_ERR "btrfs %s: failed to load free space cache "
+		       "for block group %llu\n", fs_info->sb->s_id,
+		       block_group->key.objectid);
 	}
 
 	iput(inode);
@@ -1104,8 +1107,9 @@ int btrfs_write_out_cache(struct btrfs_root *root,
 		spin_unlock(&block_group->lock);
 		ret = 0;
 #ifdef DEBUG
-		printk(KERN_ERR "btrfs: failed to write free space cache "
-		       "for block group %llu\n", block_group->key.objectid);
+		printk(KERN_ERR "btrfs %s: failed to write free space cache "
+		       "for block group %llu\n", root->fs_info->sb->s_id,
+		       block_group->key.objectid);
 #endif
 	}
 
@@ -2891,8 +2895,9 @@ int load_free_ino_cache(struct btrfs_fs_info *fs_info, struct btrfs_root *root)
 	ret = __load_free_space_cache(root, inode, ctl, path, 0);
 
 	if (ret < 0)
-		printk(KERN_ERR "btrfs: failed to load free ino cache for "
-		       "root %llu\n", root->root_key.objectid);
+		printk(KERN_ERR "btrfs %s: failed to load free ino cache for "
+		       "root %llu\n", fs_info->sb->s_id,
+		       root->root_key.objectid);
 out_put:
 	iput(inode);
 out:
@@ -2919,8 +2924,9 @@ int btrfs_write_out_ino_cache(struct btrfs_root *root,
 	if (ret) {
 		btrfs_delalloc_release_metadata(inode, inode->i_size);
 #ifdef DEBUG
-		printk(KERN_ERR "btrfs: failed to write free ino cache "
-		       "for root %llu\n", root->root_key.objectid);
+		printk(KERN_ERR "btrfs %s: failed to write free ino cache "
+		       "for root %llu\n", root->fs_info->sb->s_id,
+		       root->root_key.objectid);
 #endif
 	}
 
fs/btrfs/inode.c +30 -19

114 lines not on this page · raw message

fs/btrfs/print-tree.c +5 -3
index 50d95fd..9d70a0b 100644
@@ -176,7 +176,8 @@ void btrfs_print_leaf(struct btrfs_root *root, struct extent_buffer *l)
 
 	nr = btrfs_header_nritems(l);
 
-	printk(KERN_INFO "leaf %llu total ptrs %d free space %d\n",
+	printk(KERN_INFO "btrfs %s: leaf %llu total ptrs %d free space %d\n",
+		root->fs_info->sb->s_id,
 		(unsigned long long)btrfs_header_bytenr(l), nr,
 		btrfs_leaf_free_space(root, l));
 	for (i = 0 ; i < nr ; i++) {
@@ -318,9 +319,10 @@ void btrfs_print_tree(struct btrfs_root *root, struct extent_buffer *c)
 		btrfs_print_leaf(root, c);
 		return;
 	}
-	printk(KERN_INFO "node %llu level %d total ptrs %d free spc %u\n",
+	printk(KERN_INFO "btrfs %s: node %llu level %d total ptrs %d free spc %u\n",
+	       root->fs_info->sb->s_id,
 	       (unsigned long long)btrfs_header_bytenr(c),
-	      level, nr,
+	       level, nr,
 	       (u32)BTRFS_NODEPTRS_PER_BLOCK(root) - nr);
 	for (i = 0; i < nr; i++) {
 		btrfs_node_key_to_cpu(c, &key, i);
fs/btrfs/volumes.c +5 -3
index 5cbb7f4..1b4ef28 100644
@@ -4095,7 +4095,8 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw,
 	read_unlock(&em_tree->lock);
 
 	if (!em) {
-		printk(KERN_CRIT "btrfs: unable to find logical %llu len %llu\n",
+		printk(KERN_CRIT "btrfs %s: unable to find logical %llu "
+		       "len %llu\n", fs_info->sb->s_id,
 		       (unsigned long long)logical,
 		       (unsigned long long)*length);
 		BUG();
@@ -4846,8 +4847,9 @@ int btrfs_map_bio(struct btrfs_root *root, int rw, struct bio *bio,
 
 	total_devs = bbio->num_stripes;
 	if (map_length < length) {
-		printk(KERN_CRIT "btrfs: mapping failed logical %llu bio len %llu "
-		       "len %llu\n", (unsigned long long)logical,
+		printk(KERN_CRIT "btrfs %s: mapping failed logical %llu "
+		       "bio len %llu len %llu\n", root->fs_info->sb->s_id,
+		       (unsigned long long)logical,
 		       (unsigned long long)length,
 		       (unsigned long long)map_length);
 		BUG();
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 4 lines · Simon Kirby

With more than one btrfs volume mounted, it can be very difficult to find out which volume is hitting an error. btrfs_error() will print this, but it is currently rigged as more of a fatal error handler, while many of the printk()s are currently for debugging and yet-unhandled cases.

Please use btrfs_printk(fs_info, format, ...) for that purpose. That way we can tune the message output format at one place. Also please do not split format strings to more lines, this breaks grep when looking for error messages in the sources.

david

#2 lore raw

PATCH v2 1/1 Btrfs: Include the device in most error printk()s

With more than one btrfs volume mounted, it can be very difficult to find out which volume is hitting an error. btrfs_error() will print this, but it is currently rigged as more of a fatal error handler, while many of the printk()s are currently for debugging and yet-unhandled cases.

This patch just changes the functions where the device information is already available. Some cases remain where the root or fs_info is not passed to the function emitting the error.

This may introduce some confusion with volumes backed by multiple devices emitting errors referring to the primary device in the set instead of the one on which the error occurred.

Use btrfs_printk(fs_info, format, ...) rather than writing the device string every time, and introduce macro wrappers ala XFS for brevity. Since the function already cannot be used for continuations, print a newline as part of the btrfs_printk() message rather than at each caller.

As suggested by David Sterba, unsplit strings to improve searchability.

---
 fs/btrfs/ctree.h            |   21 +++++++++++--
 fs/btrfs/extent-tree.c      |   64 ++++++++++++++++++++-------------------
 fs/btrfs/free-space-cache.c |   43 +++++++++++++++------------
 fs/btrfs/inode.c            |   69 ++++++++++++++++++++++---------------------
 fs/btrfs/print-tree.c       |    9 +++---
 fs/btrfs/super.c            |   12 ++++----
 fs/btrfs/transaction.c      |    2 +-
 fs/btrfs/volumes.c          |   18 +++++------
 8 files changed, 132 insertions(+), 106 deletions(-)
fs/btrfs/ctree.h +19 -2
index 547b7b0..426f8d5 100644
@@ -3558,14 +3558,31 @@ int btrfs_sync_fs(struct super_block *sb, int wait);
 
 #ifdef CONFIG_PRINTK
 __printf(2, 3)
-void btrfs_printk(struct btrfs_fs_info *fs_info, const char *fmt, ...);
+void btrfs_printk(const struct btrfs_fs_info *fs_info, const char *fmt, ...);
 #else
 static inline __printf(2, 3)
-void btrfs_printk(struct btrfs_fs_info *fs_info, const char *fmt, ...)
+void btrfs_printk(const struct btrfs_fs_info *fs_info, const char *fmt, ...)
 {
 }
 #endif
 
+#define btrfs_emerg(fs_info, fmt, args...) \
+	btrfs_printk(fs_info, KERN_EMERG fmt, ##args)
+#define btrfs_alert(fs_info, fmt, args...) \
+	btrfs_printk(fs_info, KERN_ALERT fmt, ##args)
+#define btrfs_crit(fs_info, fmt, args...) \
+	btrfs_printk(fs_info, KERN_CRIT fmt, ##args)
+#define btrfs_err(fs_info, fmt, args...) \
+	btrfs_printk(fs_info, KERN_ERR fmt, ##args)
+#define btrfs_warn(fs_info, fmt, args...) \
+	btrfs_printk(fs_info, KERN_WARNING fmt, ##args)
+#define btrfs_notice(fs_info, fmt, args...) \
+	btrfs_printk(fs_info, KERN_NOTICE fmt, ##args)
+#define btrfs_info(fs_info, fmt, args...) \
+	btrfs_printk(fs_info, KERN_INFO fmt, ##args)
+#define btrfs_debug(fs_info, fmt, args...) \
+	btrfs_printk(fs_info, KERN_DEBUG fmt, ##args)
+
 __printf(5, 6)
 void __btrfs_std_error(struct btrfs_fs_info *fs_info, const char *function,
 		     unsigned int line, int errno, const char *fmt, ...);
fs/btrfs/extent-tree.c +33 -31

142 lines not on this page · raw message

fs/btrfs/free-space-cache.c +24 -19

97 lines not on this page · raw message

fs/btrfs/inode.c +36 -33

139 lines not on this page · raw message

fs/btrfs/print-tree.c +4 -5
index 50d95fd..fe35225 100644
@@ -176,7 +176,7 @@ void btrfs_print_leaf(struct btrfs_root *root, struct extent_buffer *l)
 
 	nr = btrfs_header_nritems(l);
 
-	printk(KERN_INFO "leaf %llu total ptrs %d free space %d\n",
+	btrfs_info(root->fs_info, "leaf %llu total ptrs %d free space %d",
 		(unsigned long long)btrfs_header_bytenr(l), nr,
 		btrfs_leaf_free_space(root, l));
 	for (i = 0 ; i < nr ; i++) {
@@ -318,10 +318,9 @@ void btrfs_print_tree(struct btrfs_root *root, struct extent_buffer *c)
 		btrfs_print_leaf(root, c);
 		return;
 	}
-	printk(KERN_INFO "node %llu level %d total ptrs %d free spc %u\n",
-	       (unsigned long long)btrfs_header_bytenr(c),
-	      level, nr,
-	       (u32)BTRFS_NODEPTRS_PER_BLOCK(root) - nr);
+	btrfs_info(root->fs_info, "node %llu level %d total ptrs %d free spc %u",
+		(unsigned long long)btrfs_header_bytenr(c),
+		level, nr, (u32)BTRFS_NODEPTRS_PER_BLOCK(root) - nr);
 	for (i = 0; i < nr; i++) {
 		btrfs_node_key_to_cpu(c, &key, i);
 		printk(KERN_INFO "\tkey %d (%llu %u %llu) block %llu\n",
fs/btrfs/super.c +6 -6
index d8982e9..4124b72 100644
@@ -116,7 +116,7 @@ static void btrfs_handle_error(struct btrfs_fs_info *fs_info)
 
 	if (fs_info->fs_state & BTRFS_SUPER_FLAG_ERROR) {
 		sb->s_flags |= MS_RDONLY;
-		printk(KERN_INFO "btrfs is forced readonly\n");
+		btrfs_info(fs_info, "forced readonly");
 		/*
 		 * Note that a running device replace operation is not
 		 * canceled here although there is no way to update
@@ -185,7 +185,7 @@ static const char * const logtypes[] = {
 	"debug",
 };
 
-void btrfs_printk(struct btrfs_fs_info *fs_info, const char *fmt, ...)
+void btrfs_printk(const struct btrfs_fs_info *fs_info, const char *fmt, ...)
 {
 	struct super_block *sb = fs_info->sb;
 	char lvl[4];
@@ -209,7 +209,7 @@ void btrfs_printk(struct btrfs_fs_info *fs_info, const char *fmt, ...)
 	vaf.fmt = fmt;
 	vaf.va = &args;
 
-	printk("%sBTRFS %s (device %s): %pV", lvl, type, sb->s_id, &vaf);
+	printk("%sBTRFS %s (device %s): %pV\n", lvl, type, sb->s_id, &vaf);
 
 	va_end(args);
 }
@@ -262,9 +262,9 @@ void __btrfs_abort_transaction(struct btrfs_trans_handle *trans,
 		const char *errstr;
 
 		errstr = btrfs_decode_error(root->fs_info, errno, nbuf);
-		btrfs_printk(root->fs_info,
-			     "%s:%d: Aborting unused transaction(%s).\n",
-			     function, line, errstr);
+		btrfs_warn(root->fs_info,
+		           "%s:%d: Aborting unused transaction(%s).",
+		           function, line, errstr);
 		return;
 	}
 	ACCESS_ONCE(trans->transaction->aborted) = errno;
fs/btrfs/transaction.c +1 -1
index fc03aa6..ccd686c 100644
@@ -1772,7 +1772,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
 cleanup_transaction:
 	btrfs_trans_release_metadata(trans, root);
 	trans->block_rsv = NULL;
-	btrfs_printk(root->fs_info, "Skipping commit of aborted transaction.\n");
+	btrfs_warn(root->fs_info, "Skipping commit of aborted transaction.");
 //	WARN_ON(1);
 	if (current->journal_info == trans)
 		current->journal_info = NULL;
fs/btrfs/volumes.c +9 -9
index 5cbb7f4..d7de380 100644
@@ -4095,9 +4095,9 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw,
 	read_unlock(&em_tree->lock);
 
 	if (!em) {
-		printk(KERN_CRIT "btrfs: unable to find logical %llu len %llu\n",
-		       (unsigned long long)logical,
-		       (unsigned long long)*length);
+		btrfs_crit(fs_info, "unable to find logical %llu len %llu",
+			(unsigned long long)logical,
+			(unsigned long long)*length);
 		BUG();
 	}
 
@@ -4846,10 +4846,10 @@ int btrfs_map_bio(struct btrfs_root *root, int rw, struct bio *bio,
 
 	total_devs = bbio->num_stripes;
 	if (map_length < length) {
-		printk(KERN_CRIT "btrfs: mapping failed logical %llu bio len %llu "
-		       "len %llu\n", (unsigned long long)logical,
-		       (unsigned long long)length,
-		       (unsigned long long)map_length);
+		btrfs_crit(root->fs_info, "mapping failed logical %llu bio len %llu len %llu",
+			(unsigned long long)logical,
+			(unsigned long long)length,
+			(unsigned long long)map_length);
 		BUG();
 	}
 
@@ -5126,8 +5126,8 @@ static int read_one_dev(struct btrfs_root *root,
 			return -EIO;
 
 		if (!device) {
-			printk(KERN_WARNING "warning devid %llu missing\n",
-			       (unsigned long long)devid);
+			btrfs_warn(root->fs_info, "devid %llu missing",
+				(unsigned long long)devid);
 			device = add_missing_dev(root, devid, dev_uuid);
 			if (!device)
 				return -ENOMEM;
Signature · 6 lines
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo
Reviewed-by on v2 1/1
#3 lore raw

On Fri, Feb 15, 2013 at 05:12:37PM -0600, Simon Kirby wrote:
[...]

Quoted 1 line

Thanks! 2 comments below.

fs/btrfs/free-space-cache.c int btrfs_write_out_ino_cache(struct btrfs_root *root, · line 2928

Quoted 9 lines
fs/btrfs/free-space-cache.c +3 -2
@@ -2919,8 +2923,9 @@ int btrfs_write_out_ino_cache(struct btrfs_root *root,
 	if (ret) {
 		btrfs_delalloc_release_metadata(inode, inode->i_size);
 #ifdef DEBUG
-		printk(KERN_ERR "btrfs: failed to write free ino cache "
-		       "for root %llu\n", root->root_key.objectid);
+		btrfs_err(root->fs_info,
+			"btrfs %s: failed to write free ino cache for root %llu",
+			root->root_key.objectid);

"failed to write free ino cache for root %llu",

fs/btrfs/inode.c int btrfs_orphan_cleanup(struct btrfs_root *root) · line 2460

Quoted 11 lines
fs/btrfs/inode.c +2 -2
 #endif
 	}
 
@@ -2454,8 +2456,8 @@ int btrfs_orphan_cleanup(struct btrfs_root *root)
 				ret = PTR_ERR(trans);
 				goto out;
 			}
-			printk(KERN_ERR "auto deleting %Lu\n",
-			       found_key.objectid);
+			btrfs_err(root->fs_info, "auto deleting %Lu",
+				found_key.objectid);

That's probably only a debugging message, so btrfs_debug would be more appropriate here.

Quoted 3 lines
fs/btrfs/inode.c +0 -0
 			ret = btrfs_del_orphan_item(trans, root,
 						    found_key.objectid);
 			BUG_ON(ret); /* -ENOMEM or corruption (JDM: Recheck) */