From: Max Kellermann <max.kellermann@ionos.com>
To: idryomov@gmail.com, amarkuze@redhat.com, xiubo.li@clyso.com,
ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Max Kellermann <max.kellermann@ionos.com>
Subject: [PATCH v5 11/11] fs/ceph: remove redundant inode number from ceph_inode_info
Date: Mon, 24 Aug 2026 20:41:59 +0200 [thread overview]
Message-ID: <20260824184159.240821-12-max.kellermann@ionos.com> (raw)
In-Reply-To: <20260824184159.240821-1-max.kellermann@ionos.com>
On 64 bit systems, ceph_vino_to_ino_t() is a no-op, and inode.i_ino is
the same as ceph_vino.ino.
This reduces the size of `struct ceph_inode_info` by 8 bytes.
Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
---
fs/ceph/cache.c | 4 +++-
fs/ceph/inode.c | 9 +++++++++
fs/ceph/super.h | 23 +++++++++++++++++++++++
3 files changed, 35 insertions(+), 1 deletion(-)
diff --git a/fs/ceph/cache.c b/fs/ceph/cache.c
index f678bab189d8..289615e58196 100644
--- a/fs/ceph/cache.c
+++ b/fs/ceph/cache.c
@@ -16,6 +16,7 @@ void ceph_fscache_register_inode_cookie(struct inode *inode)
{
struct ceph_inode_info *ci = ceph_inode(inode);
struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
+ struct ceph_vino vino;
/* No caching for filesystem? */
if (!fsc->fscache)
@@ -31,9 +32,10 @@ void ceph_fscache_register_inode_cookie(struct inode *inode)
WARN_ON_ONCE(ci->netfs.cache);
+ vino = ceph_vino(inode);
ci->netfs.cache =
fscache_acquire_cookie(fsc->fscache, 0,
- &ci->i_vino, sizeof(ci->i_vino),
+ &vino, sizeof(vino),
&ci->i_version, sizeof(ci->i_version),
i_size_read(inode));
if (ci->netfs.cache)
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index 62399361821a..acc600e0024c 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -44,11 +44,20 @@ static void ceph_inode_work(struct work_struct *work);
*/
static int ceph_set_ino_cb(struct inode *inode, void *data)
{
+#if BITS_PER_LONG >= 64
+ const struct ceph_vino *vino = data;
+#endif
struct ceph_inode_info *ci = ceph_inode(inode);
struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(inode->i_sb);
+#if BITS_PER_LONG >= 64
+ inode->i_ino = vino->ino;
+ ci->i_snap = vino->snap;
+#else
ci->i_vino = *(struct ceph_vino *)data;
inode->i_ino = ceph_vino_to_ino_t(ci->i_vino);
+#endif
+
inode_set_iversion_raw(inode, 0);
percpu_counter_inc(&mdsc->metric.total_inodes);
diff --git a/fs/ceph/super.h b/fs/ceph/super.h
index 15fa433c9485..79917adccda2 100644
--- a/fs/ceph/super.h
+++ b/fs/ceph/super.h
@@ -378,7 +378,15 @@ struct ceph_inode_xattrs_info {
*/
struct ceph_inode_info {
struct netfs_inode netfs; /* Netfslib context and vfs inode */
+
+#if BITS_PER_LONG >= 64
+ /* on 64 bit systems, the full Ceph inode number is stored in
+ * netfs.inode.i_ino
+ */
+ u64 i_snap;
+#else
struct ceph_vino i_vino; /* ceph ino + snap */
+#endif
spinlock_t i_ceph_lock;
@@ -571,7 +579,14 @@ ceph_inode_to_client(const struct inode *inode)
static inline struct ceph_vino
ceph_vino(const struct inode *inode)
{
+#if BITS_PER_LONG >= 64
+ return (struct ceph_vino){
+ .ino = inode->i_ino,
+ .snap = ceph_inode(inode)->i_snap,
+ };
+#else
return ceph_inode(inode)->i_vino;
+#endif
}
static inline u32 ceph_ino_to_ino32(u64 vino)
@@ -601,12 +616,20 @@ static inline ino_t ceph_vino_to_ino_t(const struct ceph_vino vino)
static inline u64 ceph_ino(const struct inode *inode)
{
+#if BITS_PER_LONG >= 64
+ return inode->i_ino;
+#else
return ceph_inode(inode)->i_vino.ino;
+#endif
}
static inline u64 ceph_snap(const struct inode *inode)
{
+#if BITS_PER_LONG >= 64
+ return ceph_inode(inode)->i_snap;
+#else
return ceph_inode(inode)->i_vino.snap;
+#endif
}
/**
--
2.47.3
next prev parent reply other threads:[~2026-08-24 18:42 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-24 18:41 [PATCH v5 00/11] fs/ceph: optimize struct layouts Max Kellermann
2026-08-24 18:41 ` [PATCH v5 01/11] fs/ceph/super: remove unused field `i_cap_migration_resv` Max Kellermann
2026-08-24 18:41 ` [PATCH v5 02/11] fs/ceph/super: make field `i_truncate_pagecache_size` optional Max Kellermann
2026-08-24 18:41 ` [PATCH v5 03/11] fs/ceph/super.h: convert ceph_inode_xattr fields to `bool` Max Kellermann
2026-08-24 18:41 ` [PATCH v5 04/11] fs/ceph/super.h: convert ceph_cap_snap.writing " Max Kellermann
2026-08-24 18:41 ` [PATCH v5 05/11] fs/ceph: consistently use `u32` for `time_warp_seq` Max Kellermann
2026-08-24 18:41 ` [PATCH v5 06/11] fs/ceph/super: reorder fields to eliminate padding holes Max Kellermann
2026-08-24 18:41 ` [PATCH v5 07/11] fs/ceph: remove i_truncate_mutex, use i_fragtree_mutex for both Max Kellermann
2026-08-24 18:41 ` [PATCH v5 08/11] fs/ceph/super.h: add `const` to helpers Max Kellermann
2026-08-24 18:41 ` [PATCH v5 09/11] fs/ceph/super.h: add helper ceph_in_snap() Max Kellermann
2026-08-24 18:41 ` [PATCH v5 10/11] fs/ceph: use ceph_vino() etc. instead of accessing i_vino directly Max Kellermann
2026-08-24 18:41 ` Max Kellermann [this message]
2026-08-25 12:16 ` [PATCH v5 00/11] fs/ceph: optimize struct layouts Alex Markuze
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=20260824184159.240821-12-max.kellermann@ionos.com \
--to=max.kellermann@ionos.com \
--cc=amarkuze@redhat.com \
--cc=ceph-devel@vger.kernel.org \
--cc=idryomov@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=xiubo.li@clyso.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.