]> git.ipfire.org Git - thirdparty/linux.git/commit
btrfs: accessors: use type sizeof constants directly
authorDavid Sterba <dsterba@suse.com>
Tue, 1 Jul 2025 17:23:49 +0000 (19:23 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 21 Jul 2025 22:09:21 +0000 (00:09 +0200)
commit378c95c477b4bdc3a8283ebdf3754e308bf65891
treeecf301405ba034937b2f10d60555416b4fff390f
parent00c0cf844465139ee6d9b271549295da3c7822ca
btrfs: accessors: use type sizeof constants directly

Now unit_size is used only once, so use it directly in 'part'
calculation. Don't cache sizeof(type) in a variable. While this is a
compile-time constant, forcing the type 'int' generates worse code as it
leads to additional conversion from 32 to 64 bit type on x86_64.

The sizeof() is used only a few times and it does not make the code that
harder to read, so use it directly and let the compiler utilize the
immediate constants in the context it needs. The .ko code size slightly
increases (+50) but further patches will reduce that again.

Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/accessors.c