]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
btrfs: output more info when duplicated ordered extent is found
authorQu Wenruo <wqu@suse.com>
Sat, 14 Mar 2026 00:00:39 +0000 (10:30 +1030)
committerDavid Sterba <dsterba@suse.com>
Tue, 7 Apr 2026 16:56:02 +0000 (18:56 +0200)
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>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ordered-data.c

index de6b60c522929fd75b7f14a4d2bfd870697a264f..d39f1c49d1cf8f08ea640b003b1e20820026b20d 100644 (file)
@@ -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);
+"overlapping ordered extents, existing oe file_offset %llu num_bytes %llu flags 0x%lx, new oe file_offset %llu num_bytes %llu flags 0x%lx",
+                           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);