Commit 9f2121d
btrfs-progs: print-tree: enhance btrfs_print_leaf() to handle NULL fs_info
For mkfs and convert, we need to create a temporary fs without an
fs_info.
This makes debugging much harder that we cannot use btrfs_print_leaf()
to print the temporary tree blocks.
There are only two things causing problems for btrfs_print_leaf() if
eb->fs_info is NULL:
- print_header_info()
Which needs to grab the checksum type from eb->fs_info.
This can be avoided by completely skipping checksum output if
eb->fs_info is NULL.
- btrfs_leaf_free_space()
Which have two BUG_ON()s checking eb->fs_info, and finally calling
BTRFS_LEAF_DATA_SIZE().
Which can be avoided by removing the two BUG_ON()s, and use
__BTRFS_LEAF_DATA_SIZE(eb->len) to grab the same leaf data size.
Thankfully all call sites inside mkfs and convert are setting eb->len
to nodesize correctly.
- __btrfs_print_leaf()
Which calls BTRFS_LEAF_DATA_SIZE(eb->fs_info).
Can be avoided by the same method above.
With those changes, we can call btrfs_print_leaf() inside a debugger
for temporary fses created by mkfs and convert.
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>1 parent 7ce22a2 commit 9f2121d
File tree
2 files changed
+19
-20
lines changed2 files changed
+19
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1887 | 1887 | | |
1888 | 1888 | | |
1889 | 1889 | | |
1890 | | - | |
1891 | | - | |
1892 | | - | |
| 1890 | + | |
1893 | 1891 | | |
1894 | 1892 | | |
1895 | 1893 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1344 | 1344 | | |
1345 | 1345 | | |
1346 | 1346 | | |
1347 | | - | |
1348 | | - | |
| 1347 | + | |
1349 | 1348 | | |
1350 | 1349 | | |
1351 | 1350 | | |
| |||
1372 | 1371 | | |
1373 | 1372 | | |
1374 | 1373 | | |
1375 | | - | |
| 1374 | + | |
1376 | 1375 | | |
1377 | 1376 | | |
1378 | 1377 | | |
| |||
1387 | 1386 | | |
1388 | 1387 | | |
1389 | 1388 | | |
1390 | | - | |
1391 | | - | |
1392 | | - | |
1393 | | - | |
1394 | | - | |
1395 | | - | |
1396 | | - | |
1397 | | - | |
1398 | | - | |
1399 | | - | |
1400 | | - | |
1401 | | - | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
1402 | 1403 | | |
1403 | 1404 | | |
1404 | 1405 | | |
| |||
1478 | 1479 | | |
1479 | 1480 | | |
1480 | 1481 | | |
1481 | | - | |
| 1482 | + | |
1482 | 1483 | | |
1483 | 1484 | | |
1484 | | - | |
| 1485 | + | |
1485 | 1486 | | |
1486 | 1487 | | |
1487 | 1488 | | |
| |||
0 commit comments