]> www.infradead.org Git - users/hch/misc.git/commitdiff
btrfs: print-tree: print correct inline extent data size
authorFilipe Manana <fdmanana@suse.com>
Mon, 15 Sep 2025 10:37:34 +0000 (11:37 +0100)
committerDavid Sterba <dsterba@suse.com>
Tue, 23 Sep 2025 06:49:22 +0000 (08:49 +0200)
We are advertising the ram_bytes of an inline extent as its data size, but
that is not true for compressed extents. The ram_bytes corresponds to the
uncompressed data size while the data size (compressed data) is given by
btrfs_file_extent_inline_item_len(). So fix this and print both values in
the same format as in btrfs-progs.

Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/print-tree.c

index c2898fa6d4ba4441079933bd830f33e9e343c176..835b41874a7aa88997627e8a921687290d232908 100644 (file)
@@ -6,6 +6,7 @@
 #include "messages.h"
 #include "ctree.h"
 #include "disk-io.h"
+#include "file-item.h"
 #include "print-tree.h"
 #include "accessors.h"
 #include "tree-checker.h"
@@ -423,8 +424,9 @@ void btrfs_print_leaf(const struct extent_buffer *l)
                                btrfs_file_extent_type(l, fi));
                        if (btrfs_file_extent_type(l, fi) ==
                            BTRFS_FILE_EXTENT_INLINE) {
-                               pr_info("\t\tinline extent data size %llu\n",
-                                      btrfs_file_extent_ram_bytes(l, fi));
+                               pr_info("\t\tinline extent data size %u ram_bytes %llu\n",
+                                       btrfs_file_extent_inline_item_len(l, i),
+                                       btrfs_file_extent_ram_bytes(l, fi));
                                break;
                        }
                        pr_info("\t\textent data disk bytenr %llu nr %llu\n",