Skip to content

Set/get helpers speedups and cleanups

David Sterba linux-btrfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest19 patches 24 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/19btrfs: use the token::eb for all set/get helpersfs/btrfs/struct-funcs.c+4 -41 reply
2/19btrfs: drop eb parameter from set/get token helpersfs/btrfs/ctree.c fs/btrfs/ctree.h fs/btrfs/inode.c +2 more+130 -1583 replies
3/19btrfs: don't use set/get token for single assignment in overwrite_itemfs/btrfs/tree-log.c+2 -71 reply
4/19btrfs: don't use set/get token in leaf_space_usedfs/btrfs/ctree.c+3 -51 reply
5/19btrfs: preset set/get token with first page and drop conditionfs/btrfs/ctree.h fs/btrfs/struct-funcs.c+6 -51 reply
6/19btrfs: add separate bounds checker for set/get helpersfs/btrfs/struct-funcs.c+25 -01 reply
7/19btrfs: speed up btrfs_get_##bits helpersfs/btrfs/struct-funcs.c+10 -191 reply
8/19btrfs: speed up btrfs_get_token_##bits helpersfs/btrfs/struct-funcs.c+16 -271 reply
9/19btrfs: speed up btrfs_set_##bits helpersfs/btrfs/struct-funcs.c+10 -171 reply
10/19btrfs: speed up btrfs_set_token_##bits helpersfs/btrfs/struct-funcs.c+16 -242 replies
11/19btrfs: speed up and simplify generic_bin_searchfs/btrfs/ctree.c+15 -281 reply
12/19btrfs: remove unused map_private_extent_bufferfs/btrfs/extent_io.c fs/btrfs/extent_io.h+0 -461 reply
13/19btrfs: constify extent_buffer in the API functionsfs/btrfs/ctree.h fs/btrfs/extent_io.c fs/btrfs/extent_io.h +1 more+63 -551 reply
14/19btrfs: drop unnecessary offset_in_page in extent buffer helpersfs/btrfs/extent_io.c+21 -301 reply
15/19btrfs: optimize split page read in btrfs_get_##bitsfs/btrfs/struct-funcs.c+10 -71 reply
16/19btrfs: optimize split page read in btrfs_get_token_##bitsfs/btrfs/struct-funcs.c+9 -71 reply
17/19btrfs: optimize split page write in btrfs_set_##bitsfs/btrfs/struct-funcs.c+9 -51 reply
18/19btrfs: optimize split page write in btrfs_set_token_##bitsfs/btrfs/struct-funcs.c+7 -51 reply
19/19btrfs: update documentation of set/get helpersfs/btrfs/struct-funcs.c+16 -133 replies

Reviews trailers per patch

18 of 19 patches have a Reviewed-by or Acked-by.

PatchJohannes Thumshirn
1/19R-b
2/19R-b
3/19R-b
4/19R-b
5/19R-b
6/19R-b
7/19R-b
8/19R-b
9/19R-b
10/19R-b
11/19R-b
12/19R-b
13/19R-b
14/19R-b
15/19R-b
16/19R-b
17/19R-b
18/19R-b
19/19

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 00/19] Set/get helpers speedups and cleanups

Set/get helpers are all the functions that read or write b-tree item members, like btrfs_device_type, btrfs_set_device_type, or the variants with token btrfs_token_device_type, defined in ctree.h with BTRFS_SETGET_FUNCS. Most of them are implemented by btrfs_get_8/16/32/64 and btrfs_set_8/16/32/64 functions.

The helpers are used all over the place and can be seen in perf top results quite often, though it's about 0.5-1.5%. This series simplifies the helpers and removes function calls that do the translation from/to the input buffers to/from the extent buffer pages.

I don't have exact number to show the speedup, watching perf top and the same workload at least does not point to a drop, the functions are still in the overall range 0.5-1.5%. The code cleanups result in a straightforward code, also map_private_extent_buffer is gone!!!

David Sterba (19):
btrfs: use the token::eb for all set/get helpers
btrfs: drop eb parameter from set/get token helpers
btrfs: don't use set/get token for single assignment in overwrite_item
btrfs: don't use set/get token in leaf_space_used
btrfs: preset set/get token with first page and drop condition
btrfs: add separate bounds checker for set/get helpers
btrfs: speed up btrfs_get_##bits helpers
btrfs: speed up btrfs_get_token_##bits helpers
btrfs: speed up btrfs_set_##bits helpers
btrfs: speed up btrfs_set_token_##bits helpers
btrfs: speed up and simplify generic_bin_search
btrfs: remove unused map_private_extent_buffer
btrfs: constify extent_buffer in the API functions
btrfs: drop unnecessary offset_in_page in extent buffer helpers
btrfs: optimize split page read in btrfs_get_##bits
btrfs: optimize split page read in btrfs_get_token_##bits
btrfs: optimize split page write in btrfs_set_##bits
btrfs: optimize split page write in btrfs_set_token_##bits
btrfs: update documentation of set/get helpers

 fs/btrfs/ctree.c        |  98 +++++++-----------
 fs/btrfs/ctree.h        |  58 +++++------
 fs/btrfs/extent_io.c    | 137 ++++++++-----------------
 fs/btrfs/extent_io.h    |  48 ++++-----
 fs/btrfs/inode.c        |  71 ++++++-------
 fs/btrfs/struct-funcs.c | 222 ++++++++++++++++++++--------------------
 fs/btrfs/tree-log.c     | 130 +++++++++++------------
 7 files changed, 337 insertions(+), 427 deletions(-)
Signature · 1 line
2.25.0