Skip to content

btrfs: btrfs_get_extent() cleanup for inline extents

Qu Wenruo linux-btrfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest5 patches 3 repliesIn review

Changes in v2 from the cover letter

- Do better patch split for bisection with better reason

- Put the selftest to the first to help bisection
Or we may hit ASSERT() during selftest.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5btrfs: selftests: remove impossible inline extent at non-zero file offsetfs/btrfs/extent_map.c fs/btrfs/tests/inode-tests.c+25 -380 replies
2/5btrfs: make inline extent read calculation much simplerfs/btrfs/inode.c+20 -180 replies
3/5btrfs: do not reset extent map members for inline extents readfs/btrfs/inode.c+9 -40 replies
4/5btrfs: remove the @new_inline argument from btrfs_extent_item_to_extent_map()fs/btrfs/ctree.h fs/btrfs/file-item.c fs/btrfs/inode.c +1 more+4 -70 replies
5/5btrfs: extract the inline extent read code into its own functionfs/btrfs/inode.c+38 -351 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/5] btrfs: btrfs_get_extent() cleanup for inline extents

Currently we have some very confusing (and harder to explain) code inside btrfs_get_extent() for inline extents.

The TL;DR is, those mess is to support inline extents at non-zero file offset.

This is completely impossible now, as tree-checker will reject any inline file extents at non-zero offset.

So this series will:

- Update the selftest to get rid of the impossible case

- Simplify the inline extent read

Since we no longer need to support inline extents at non-zero file offset, some variables can be removed.

- Don't reset the inline extent map members

Those resets are either doing nothing (setting the member to the same value), or making no difference (the member is not utilized anyway)

- Remove @new_inline argument for btrfs_extent_item_to_extent_map()

That argument makes btrfs_get_extent() to skip certain member update. Previously it makes a difference only for fiemap.

But now since fiemap no longer relies on extent_map, the remaining use cases won't bother those members anyway.

Thus we can remove the bool argument and make btrfs_extent_item_to_extent_map() to have a consistent behavior.

- Introduce a helper to do inline extents read

Now the function is so simple that, extracting the helper can only reduce indents.

[CHANGELOG]
v2:
- Do better patch split for bisection with better reason

- Put the selftest to the first to help bisection
Or we may hit ASSERT() during selftest.

Qu Wenruo (5):
btrfs: selftests: remove impossible inline extent at non-zero file
offset
btrfs: make inline extent read calculation much simpler
btrfs: do not reset extent map members for inline extents read
btrfs: remove the @new_inline argument from
btrfs_extent_item_to_extent_map()
btrfs: extract the inline extent read code into its own function

 fs/btrfs/ctree.h             |   1 -
 fs/btrfs/extent_map.c        |   7 +++
 fs/btrfs/file-item.c         |   6 +--
 fs/btrfs/inode.c             | 100 +++++++++++++++++++----------------
 fs/btrfs/ioctl.c             |   2 +-
 fs/btrfs/tests/inode-tests.c |  56 +++++++-------------
 6 files changed, 83 insertions(+), 89 deletions(-)
Signature · 1 line
2.37.3