]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: add const function attribute
authorDavid Sterba <dsterba@suse.com>
Tue, 1 Oct 2019 17:57:37 +0000 (19:57 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 18 Nov 2019 11:46:52 +0000 (12:46 +0100)
commitbaaeaea7cfb8d066d751c0aa897097b312e4535c
tree6e61a1f2ac756102f27cf4dc9a0ca19359259c81
parent8403eecc48c667d16a39471516b8de14495a1eb1
btrfs: add const function attribute

For some reason the attribute is called __attribute_const__ and not
__const, marks functions that have no observable effects on program
state, IOW not reading pointers, just the arguments and calculating a
value. Allows the compiler to do some optimizations, based on
-Wsuggest-attribute=const . The effects are rather small, though, about
60 bytes decrese of btrfs.ko.

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ctree.h
fs/btrfs/super.c
fs/btrfs/volumes.c
fs/btrfs/volumes.h