mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Max Kellermann <max.kellermann@ionos.com>
To: Alexander Viro <viro@zeniv.linux.org.uk>,
	Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>
Cc: Max Kellermann <max.kellermann@ionos.com>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2] fs: pack fields `i_state` and `i_fsnotify_mask`
Date: Fri, 13 Nov 2026 12:44:26 +0100	[thread overview]
Message-ID: <20261113114427.1845888-1-max.kellermann@ionos.com> (raw)

Both were 32 bit fields followed by a 32 bit hole.  This reduces size
of `struct inode` by 8 bytes.

Moving `i_fsnotify_marks` there as well so they can be in the same
cacheline.

Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
---
v1->v2: move `i_fsnotify_marks` up as well because "should better be
  in the same cacheline because these two are accessed on some
  performance sensitive paths" (Jan Kara)
---
 include/linux/fs.h | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/include/linux/fs.h b/include/linux/fs.h
index 5b3a100aba77..fec047cc3327 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -813,7 +813,13 @@ struct inode {
 
 	/* Misc */
 	struct inode_state_flags i_state;
-	/* 32-bit hole */
+
+#ifdef CONFIG_FSNOTIFY
+	__u32			i_fsnotify_mask; /* all events this inode cares about */
+
+	struct fsnotify_mark_connector __rcu	*i_fsnotify_marks;
+#endif
+
 	struct rw_semaphore	i_rwsem;
 
 	/* Timestamp for writeback list ordering and age checks (jiffies). */
@@ -863,13 +869,6 @@ struct inode {
 		unsigned		i_dir_seq;
 	};
 
-
-#ifdef CONFIG_FSNOTIFY
-	__u32			i_fsnotify_mask; /* all events this inode cares about */
-	/* 32-bit hole reserved for expanding i_fsnotify_mask */
-	struct fsnotify_mark_connector __rcu	*i_fsnotify_marks;
-#endif
-
 	void			*i_private; /* fs or device private pointer */
 } __randomize_layout;
 
-- 
2.53.0


                 reply	other threads:[~2026-11-13 11:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261113114427.1845888-1-max.kellermann@ionos.com \
    --to=max.kellermann@ionos.com \
    --cc=brauner@kernel.org \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®