public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: dsterba@suse.cz
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 2/2] btrfs: output more info when duplicated ordered extent is found
Date: Sat, 14 Mar 2026 07:43:11 +1030	[thread overview]
Message-ID: <17eee229-5539-4d61-ac77-0ccc468a1f4b@suse.com> (raw)
In-Reply-To: <20260313193847.GJ5735@twin.jikos.cz>



在 2026/3/14 06:08, David Sterba 写道:
> On Sat, Mar 07, 2026 at 07:43:37PM +1030, Qu Wenruo wrote:
>> During development of a new feature, I triggered that btrfs_panic()
>> inside insert_ordered_extent() and spent quite some unnecessary before
>> noticing I'm passing incorrect flags when creating a new ordered extent.
>>
>> Unfortunately the existing error message is not providing much help.
>>
>> Enhance the output to provide file offset, num bytes and flags of both
>> existing and new ordered extents.
>>
>> Signed-off-by: Qu Wenruo <wqu@suse.com>
>> ---
>>   fs/btrfs/ordered-data.c | 11 ++++++++---
>>   1 file changed, 8 insertions(+), 3 deletions(-)
>>
>> diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c
>> index b34a0df282f3..bc88b904d024 100644
>> --- a/fs/btrfs/ordered-data.c
>> +++ b/fs/btrfs/ordered-data.c
>> @@ -253,10 +253,15 @@ static void insert_ordered_extent(struct btrfs_ordered_extent *entry)
>>   	spin_lock(&inode->ordered_tree_lock);
>>   	node = tree_insert(&inode->ordered_tree, entry->file_offset,
>>   			   &entry->rb_node);
>> -	if (unlikely(node))
>> +	if (unlikely(node)) {
>> +		struct btrfs_ordered_extent *exist =
>> +			rb_entry(node, struct btrfs_ordered_extent, rb_node);
>> +
>>   		btrfs_panic(fs_info, -EEXIST,
>> -				"inconsistency in ordered tree at offset %llu",
>> -				entry->file_offset);
>> +"existing oe file_offset=%llu num_bytes=%llu flags=0x%lx new oe file_offset=%llu num_bytes=%llu flags=0x%lx",
> 
> This uses the "key=value" format while this is an exception in the
> messages. The tracepoints use "=" as it's main purpose is to print just
> a list of values but messages also contain other text. We should keep it
> consistent.

Got it, will go using the existing "key value" style.

Thanks,
Qu

> 
>> +			    exist->file_offset, exist->num_bytes, exist->flags,
>> +			    entry->file_offset, entry->num_bytes, entry->flags);
>> +	}
>>   	spin_unlock(&inode->ordered_tree_lock);
>>   
>>   	spin_lock(&root->ordered_extent_lock);
>> -- 
>> 2.53.0
>>


      reply	other threads:[~2026-03-13 21:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-07  9:13 [PATCH 0/2] btrfs: enhance BTRFS_ORDERED_* flags sanity checks Qu Wenruo
2026-03-07  9:13 ` [PATCH 1/2] btrfs: check type flags in alloc_ordered_extent() Qu Wenruo
2026-03-13 19:36   ` David Sterba
2026-03-07  9:13 ` [PATCH 2/2] btrfs: output more info when duplicated ordered extent is found Qu Wenruo
2026-03-13 19:38   ` David Sterba
2026-03-13 21:13     ` Qu Wenruo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=17eee229-5539-4d61-ac77-0ccc468a1f4b@suse.com \
    --to=wqu@suse.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox