diff mbox series

[2/3] btrfs: use btrfs_crit at btrfs_mark_buffer_dirty()

Message ID a27eae99c07f016de2d585e42a985307096c2ccb.1694519544.git.fdmanana@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs: some updates to btrfs_mark_buffer_dirty() | expand

Commit Message

Filipe Manana Sept. 12, 2023, 12:04 p.m. UTC
From: Filipe Manana <fdmanana@suse.com>

There's no need to use WARN() at btrfs_mark_buffer_dirty() to print an
error message, as we have the fs_info pointer we can use btrfs_crit()
which prints device information and makes the message have a more uniform
format. As we are already aborting the transaction we already have a stack
trace printed as well. So replace the use of WARN() with btrfs_crit().

Also slightly reword the message to use 'logical' instead of 'block' as
it's what is used in other error/warning messages.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 fs/btrfs/disk-io.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 05282a2f0f5b..d906368a2d3f 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -4404,9 +4404,10 @@  void btrfs_mark_buffer_dirty(struct btrfs_trans_handle *trans,
 	ASSERT(trans->transid == fs_info->generation);
 	btrfs_assert_tree_write_locked(buf);
 	if (transid != fs_info->generation) {
-		WARN(1, KERN_CRIT "btrfs transid mismatch buffer %llu, found %llu running %llu\n",
-			buf->start, transid, fs_info->generation);
 		btrfs_abort_transaction(trans, -EUCLEAN);
+		btrfs_crit(fs_info,
+"dirty buffer transid mismatch, logical %llu found transid %llu running transid %llu",
+			   buf->start, transid, fs_info->generation);
 	}
 	set_extent_buffer_dirty(buf);
 }