diff options
author | David Sterba <dsterba@suse.com> | 2020-04-29 17:45:33 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2020-05-25 11:25:33 +0200 |
commit | 8f9da810ee1fac6b587e3b871ee73696906bcba3 (patch) | |
tree | 1db770a76c511aec88e4e4dcc20d7089ff407ce8 /fs/nsfs.c | |
parent | btrfs: speed up btrfs_get_##bits helpers (diff) | |
download | linux-8f9da810ee1fac6b587e3b871ee73696906bcba3.tar.xz linux-8f9da810ee1fac6b587e3b871ee73696906bcba3.zip |
btrfs: speed up btrfs_get_token_##bits helpers
The set/get token helpers either use the cached address in the token or
unconditionally call map_private_extent_buffer to get the address of
page containing the requested offset plus the mapping start and length.
Depending on the return value, the fast path uses unaligned read to get
data within a page, or fall back to read_extent_buffer that can handle
reads spanning more pages.
This is all wasteful. We know the number of bytes to read, 1/2/4/8 and
can find out the page. Then simply check if it's contained or the
fallback is needed. The token address is updated to the page, or the on
the next index, expecting that the next read will use that.
This saves one function call to map_private_extent_buffer and several
unnecessary temporary variables.
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/nsfs.c')
0 files changed, 0 insertions, 0 deletions