[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aNKdy1vYsWoMvU3c@dread.disaster.area>
Date: Tue, 23 Sep 2025 23:16:59 +1000
From: Dave Chinner <david@...morbit.com>
To: Mateusz Guzik <mjguzik@...il.com>
Cc: brauner@...nel.org, viro@...iv.linux.org.uk, jack@...e.cz,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
josef@...icpanda.com, kernel-team@...com, amir73il@...il.com,
linux-btrfs@...r.kernel.org, linux-ext4@...r.kernel.org,
linux-xfs@...r.kernel.org, ceph-devel@...r.kernel.org,
linux-unionfs@...r.kernel.org
Subject: Re: [PATCH v6 0/4] hide ->i_state behind accessors
On Tue, Sep 23, 2025 at 12:47:06PM +0200, Mateusz Guzik wrote:
> First commit message quoted verbatim with rationable + API:
>
> [quote]
> Open-coded accesses prevent asserting they are done correctly. One
> obvious aspect is locking, but significantly more can checked. For
> example it can be detected when the code is clearing flags which are
> already missing, or is setting flags when it is illegal (e.g., I_FREEING
> when ->i_count > 0).
>
> Given the late stage of the release cycle this patchset only aims to
> hide access, it does not provide any of the checks.
>
> Consumers can be trivially converted. Suppose flags I_A and I_B are to
> be handled, then:
>
> state = inode->i_state => state = inode_state_read(inode)
> inode->i_state |= (I_A | I_B) => inode_state_set(inode, I_A | I_B)
> inode->i_state &= ~(I_A | I_B) => inode_state_clear(inode, I_A | I_B)
> inode->i_state = I_A | I_B => inode_state_assign(inode, I_A | I_B)
> [/quote]
>
> Right now this is one big NOP, except for READ_ONCE/WRITE_ONCE for every access.
>
> Given this, I decided to not submit any per-fs patches. Instead, the
> conversion is done in 2 parts: coccinelle and whatever which was missed.
>
> Generated against:
> https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git/commit/?h=vfs-6.18.inode.refcount.preliminaries
Much simpler and nicer than the earlier versions. Looks good.
Reviewed-by: Dave Chinner <dchinner@...hat.com>
--
Dave Chinner
david@...morbit.com
Powered by blists - more mailing lists