Re: [PATCH v3 2/4] fs: hide ->i_state handling behind accessors

From: Christian Brauner

Date: Mon Sep 15 2025 - 09:41:07 EST


On Mon, Sep 15, 2025 at 03:27:16PM +0200, Mateusz Guzik wrote:
> On Mon, Sep 15, 2025 at 2:41 PM Christian Brauner <brauner@xxxxxxxxxx> wrote:
> >
> > On Thu, Sep 11, 2025 at 06:55:55AM +0200, Mateusz Guzik wrote:
> > > Signed-off-by: Mateusz Guzik <mjguzik@xxxxxxxxx>
> > > ---
> >
> > I would do:
> >
> > inode_state()
> > inode_state_raw()
> >
> > Similar to
> >
> > rcu_derefence()
> > rcu_dereference_raw()
> >
>
> I don't follow how to fit this in here.
>
> Here is the complete list:
> inode_state_read
> inode_state_read_unstable
>
> first is a plain read + lockdep assert, second is a READ_ONCE
>
> inode_state_add
> inode_state_add_unchecked
> inode_state_del
> inode_state_del_unchecked
> inode_state_set_unchecked
>
> Routine with _unchecked forego asserts, otherwise the op checks lockdep.
>
> I guess _unchecked could be _raw, but I don't see how to fit this into
> the read thing.

_raw() is adapted from rcu which is why I'm very familiar with what it
means: rcu_dereference() performs checks and rcu_dereference_raw()
doesn't. It's just a naming convention that we already have and are
accustomed to.

>
> Can you just spell out the names you want for all of these?

just use _raw() imho

>
> > But you need some actual commit messages etc...
> >
>
> Ye and I need to runtime test at least with xfs and btrfs.

Something I plan to do soon is more automated testing as soon as patch
series are pulled into one of the VFS trees. And by that I mean visible
to the author of the series. It'll be a while though unless we get
manpower for that.