btrfs: rework BTRFS_I as macro to preserve parameter const
authorDavid Sterba <dsterba@suse.com>
Wed, 5 Jun 2024 00:28:30 +0000 (02:28 +0200)
committerDavid Sterba <dsterba@suse.com>
Tue, 10 Sep 2024 14:51:22 +0000 (16:51 +0200)
commit070969f17d82e4220f5800ea63139e513cdb17fd
tree30735ec82446bde0cd8276cea72c5b7392d58219
parent1b6e068a0cc3d3888ddd5e4967357075fd6502da
btrfs: rework BTRFS_I as macro to preserve parameter const

Currently BTRFS_I is a static inline function that takes a const inode
and returns btrfs inode, dropping the 'const' qualifier. This can break
assumptions of compiler though it seems there's no real case.

To make the parameter and return type consistent regardint const we can
use the container_of_const() that preserves it. However this would not
check the parameter type. To fix that use the same _Generic construct
but implement only the two expected types.

Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/btrfs_inode.h