Re: [PATCH] fs: constify inode argument of inode_state_read_once()

From: Jan Kara

Date: Wed Nov 11 2026 - 09:30:52 EST


On Wed 11-11-26 11:01:49, Andrey Albershteyn wrote:
> Constify inode parameter so that callers can pass const inode. Callers
> do not need a change.
>
> Signed-off-by: Andrey Albershteyn <aalbersh@xxxxxxxxxx>

Fine by me. Feel free to add:

Reviewed-by: Jan Kara <jack@xxxxxxx>

Honza

> ---
>
> Notes:
> I will have a user with const inode in fsverity
> https://lore.kernel.org/fsverity/20261105115532.613467-3-aalbersh@xxxxxxxxxx/
>
> include/linux/fs.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 99caef43ff3c..c5ba625c8ae1 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -877,7 +877,7 @@ struct inode {
> *
> * We hide all of it behind helpers so that we can validate consumers.
> */
> -static inline enum inode_state_flags_enum inode_state_read_once(struct inode *inode)
> +static inline enum inode_state_flags_enum inode_state_read_once(const struct inode *inode)
> {
> return READ_ONCE(inode->i_state.__state);
> }
> --
> 2.54.0
>
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR