diff mbox series

[RFC,v2,6/6] inode: make i_state a u32

Message ID 20240821-work-i_state-v2-6-67244769f102@kernel.org (mailing list archive)
State New
Headers show
Series inode: turn i_state into u32 | expand

Commit Message

Christian Brauner Aug. 21, 2024, 3:47 p.m. UTC
Now that we use the wait var event mechanism make i_state a u32 and free
up 4 bytes. This means we currently have two 4 byte holes in struct
inode which we can pack.

Signed-off-by: Christian Brauner <brauner@kernel.org>
---
 include/linux/fs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andreas Dilger Aug. 21, 2024, 9:03 p.m. UTC | #1
On Aug 21, 2024, at 9:47 AM, Christian Brauner <brauner@kernel.org> wrote:
> 
> Now that we use the wait var event mechanism make i_state a u32 and free
> up 4 bytes. This means we currently have two 4 byte holes in struct
> inode which we can pack.
> 
> Signed-off-by: Christian Brauner <brauner@kernel.org>
> ---
> 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 8525f8bfd7b9..a673173b6896 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -681,7 +681,7 @@ struct inode {
> #endif
> 
> 	/* Misc */
> -	unsigned long		i_state;
> +	u32			i_state;

Is it worthwhile to add a comment that there is a hole here, instead
of leaving it for future re-discovery?

        /* 32-bit hole */

> 	struct rw_semaphore	i_rwsem;
> 
> 	unsigned long		dirtied_when; /* jiffies of first dirtying */

Normally this would be excess noise, but since struct inode is
micro-optimized (like struct page) it probably makes sense to
document this case.

Cheers, Andreas
Christian Brauner Aug. 22, 2024, 8:31 a.m. UTC | #2
On Wed, Aug 21, 2024 at 03:03:01PM GMT, Andreas Dilger wrote:
> On Aug 21, 2024, at 9:47 AM, Christian Brauner <brauner@kernel.org> wrote:
> > 
> > Now that we use the wait var event mechanism make i_state a u32 and free
> > up 4 bytes. This means we currently have two 4 byte holes in struct
> > inode which we can pack.
> > 
> > Signed-off-by: Christian Brauner <brauner@kernel.org>
> > ---
> > 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 8525f8bfd7b9..a673173b6896 100644
> > --- a/include/linux/fs.h
> > +++ b/include/linux/fs.h
> > @@ -681,7 +681,7 @@ struct inode {
> > #endif
> > 
> > 	/* Misc */
> > -	unsigned long		i_state;
> > +	u32			i_state;
> 
> Is it worthwhile to add a comment that there is a hole here, instead
> of leaving it for future re-discovery?
> 
>         /* 32-bit hole */
> 
> > 	struct rw_semaphore	i_rwsem;
> > 
> > 	unsigned long		dirtied_when; /* jiffies of first dirtying */
> 
> Normally this would be excess noise, but since struct inode is
> micro-optimized (like struct page) it probably makes sense to
> document this case.

Good idea. Added now!
diff mbox series

Patch

diff --git a/include/linux/fs.h b/include/linux/fs.h
index 8525f8bfd7b9..a673173b6896 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -681,7 +681,7 @@  struct inode {
 #endif
 
 	/* Misc */
-	unsigned long		i_state;
+	u32			i_state;
 	struct rw_semaphore	i_rwsem;
 
 	unsigned long		dirtied_when;	/* jiffies of first dirtying */