diff options
| author | Sun YangKai <[email protected]> | 2025-06-12 08:32:23 +0000 |
|---|---|---|
| committer | David Sterba <[email protected]> | 2025-07-21 21:58:04 +0000 |
| commit | 27260dd1904bb409cf84709928ba9bc5506fbe8e (patch) | |
| tree | cd8ee0d0c6ebabf2ebc6753d01ad417e14447d97 /fs/btrfs/print-tree.c | |
| parent | btrfs: use folio_next_index() helper in check_range_has_page() (diff) | |
| download | kernel-27260dd1904bb409cf84709928ba9bc5506fbe8e.tar.gz kernel-27260dd1904bb409cf84709928ba9bc5506fbe8e.zip | |
btrfs: remove partial support for lowest level from btrfs_search_forward()
Commit 323ac95bce44 ("Btrfs: don't read leaf blocks containing only
checksums during truncate") changed the condition from `level == 0` to
`level == path->lowest_level`, while its original purpose was just to do
some leaf node handling (calling btrfs_item_key_to_cpu()) and skip some
code that doesn't fit leaf nodes.
After changing the condition, the code path:
1. Also handles the non-leaf nodes when path->lowest_level is nonzero,
which is wrong. However btrfs_search_forward() is never called with a
nonzero path->lowest_level, which makes this bug not found before.
2. Makes the later if block with the same condition, which was originally
used to handle non-leaf node (calling btrfs_node_key_to_cpu()) when
lowest_level is not zero, dead code.
Since btrfs_search_forward() is never called for a path with a
lowest_level different from zero, just completely remove the partial
support for a non-zero lowest_level, simplifying a bit the code, and
assert that lowest_level is zero at the start of the function.
Suggested-by: Qu Wenruo <[email protected]>
Fixes: 323ac95bce44 ("Btrfs: don't read leaf blocks containing only checksums during truncate")
Reviewed-by: Filipe Manana <[email protected]>
Signed-off-by: Sun YangKai <[email protected]>
Signed-off-by: David Sterba <[email protected]>
Diffstat (limited to 'fs/btrfs/print-tree.c')
0 files changed, 0 insertions, 0 deletions
