diff options
| author | David Sterba <dsterba@suse.com> | 2025-07-01 19:23:48 +0200 | 
|---|---|---|
| committer | David Sterba <dsterba@suse.com> | 2025-07-22 00:09:21 +0200 | 
| commit | 00c0cf844465139ee6d9b271549295da3c7822ca (patch) | |
| tree | e61f9a3bc5a8a4fa3e939e98fb631bd3711b1b87 /rust/helpers/rcu.c | |
| parent | c76841362f66915a878c3a13ed74675e0e4af43e (diff) | |
btrfs: accessors: simplify folio bounds checks
As we can a have non-contiguous range in the eb->folios, any item can be
straddling two folios and we need to check if it can be read in one go
or in two parts. For that there's a check which is not implemented in
the simplest way:
  offset in folio + size <= folio size
With a simple expression transformation:
  oil + size <= unit_size
        size <= unit_size - oil
    sizeof() <= part
this can be simplified and reusing existing run-time or compile-time
constants.
Add likely() annotation for this expression as this is the fast path and
compiler sometimes reorders that after the followup block with the
memcpy (observed in practice with other simplifications).
Overall effect on stack consumption:
  btrfs_get_8                                        -8 (80 -> 72)
  btrfs_set_8                                        -8 (88 -> 80)
And .ko size (due to optimizations making use of the direct constants):
     text    data     bss     dec     hex filename
  1456601  115665   16088 1588354  183c82 pre/btrfs.ko
  1456093  115665   16088 1587846  183a86 post/btrfs.ko
  DELTA: -508
Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'rust/helpers/rcu.c')
0 files changed, 0 insertions, 0 deletions
