]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
btrfs: accessors: delete token versions of set/get helpers
authorDavid Sterba <dsterba@suse.com>
Fri, 27 Jun 2025 14:03:53 +0000 (16:03 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 21 Jul 2025 22:05:00 +0000 (00:05 +0200)
commitb37eb352c4c6ecd8e6aa62d08dbf3f5d3ce8afd7
tree5a3aa545a26a55b5e728d5f61b353f859c8de90e
parentc418a1504540c6678279b965ea73fe61621faa65
btrfs: accessors: delete token versions of set/get helpers

Once upon a time there was a need to cache address of extent buffer
pages, as it was a costly operation (map_private_extent_buffer(),
cfed81a04eb555 ("Btrfs: add the ability to cache a pointer into the
eb")).  This was not even due to use of HIGHMEM, this had been removed
before that due to possible locking issues (a65917156e3459 ("Btrfs:
stop using highmem for extent_buffers")).

Over time the amount of work in the set/get helpers got reduced and
became quite straightforward bounds checking with an unaligned
read/write, commit db3756c879773c ("btrfs: remove unused
map_private_extent_buffer").

The actual caching of the page_address()/folio_address() in the token
was more work for very little gain. This depended on subsequent access
into the same page/folio, otherwise the cached pointer had to be
updated.

For metadata-heavy operations this showed up in the 'perf top' profile
where the btrfs_get_token_32() calls were at the top, on my testing
machine consuming about 2-3%. The other generic 32/64 bit helpers also
appeared in the profile with similar fraction.

After removing use of the token helpers we can remove them completely,
this leads to reduction of btrfs.ko by 6.7KiB on release config.

   text    data     bss     dec     hex filename
1463289  115665   16088 1595042  1856a2 pre/btrfs.ko
1456601  115665   16088 1588354  183c82 post/btrfs.ko

DELTA: -6688

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/accessors.c
fs/btrfs/accessors.h