From: Max Kellermann <max.kellermann@ionos.com>
To: idryomov@gmail.com, amarkuze@redhat.com,
ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Max Kellermann <max.kellermann@ionos.com>
Subject: [PATCH v2 11/18] fs/ceph: use ceph_vino() etc. instead of accessing i_vino directly
Date: Mon, 6 Jul 2026 09:24:42 +0200 [thread overview]
Message-ID: <20260706072450.3920010-12-max.kellermann@ionos.com> (raw)
In-Reply-To: <20260706072450.3920010-1-max.kellermann@ionos.com>
Prepare to remove (optimize) `i_vino`.
Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
---
fs/ceph/addr.c | 5 ++---
fs/ceph/caps.c | 4 ++--
fs/ceph/file.c | 14 +++++++-------
fs/ceph/mds_client.c | 2 +-
fs/ceph/quota.c | 2 +-
fs/ceph/snap.c | 4 ++--
fs/ceph/super.h | 7 +++----
fs/ceph/xattr.c | 4 ++--
8 files changed, 20 insertions(+), 22 deletions(-)
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index d03639525eb8..f627f2e28b9b 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -282,7 +282,6 @@ static bool ceph_netfs_issue_op_inline(struct netfs_io_subrequest *subreq)
struct ceph_mds_reply_info_in *iinfo;
struct ceph_mds_request *req;
struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(inode->i_sb);
- struct ceph_inode_info *ci = ceph_inode(inode);
ssize_t err = 0;
size_t len;
int mode;
@@ -302,7 +301,7 @@ static bool ceph_netfs_issue_op_inline(struct netfs_io_subrequest *subreq)
err = PTR_ERR(req);
goto out;
}
- req->r_ino1 = ci->i_vino;
+ req->r_ino1 = ceph_vino(inode);
req->r_args.getattr.mask = cpu_to_le32(CEPH_STAT_CAP_INLINE_DATA);
req->r_num_caps = 2;
@@ -2466,7 +2465,7 @@ static int __ceph_pool_perm_get(struct ceph_inode_info *ci,
rd_req->r_base_oloc.pool = pool;
if (pool_ns)
rd_req->r_base_oloc.pool_ns = ceph_get_string(pool_ns);
- ceph_oid_printf(&rd_req->r_base_oid, "%llx.00000000", ci->i_vino.ino);
+ ceph_oid_printf(&rd_req->r_base_oid, "%llx.00000000", ceph_ino(&ci->netfs.inode));
err = ceph_osdc_alloc_messages(rd_req, GFP_NOFS);
if (err)
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index 372b239f6a36..00ef37312a79 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -730,7 +730,7 @@ void ceph_add_cap(struct inode *inode,
ceph_change_snap_realm(inode, realm);
else
WARN(1, "%s: couldn't find snap realm 0x%llx (ino 0x%llx oldrealm 0x%llx)\n",
- __func__, realmino, ci->i_vino.ino,
+ __func__, realmino, ceph_ino(inode),
ci->i_snap_realm ? ci->i_snap_realm->ino : 0);
}
@@ -1176,7 +1176,7 @@ void __ceph_remove_cap(struct ceph_cap *cap, bool queue_release)
} else {
cap->queue_release = 0;
}
- cap->cap_ino = ci->i_vino.ino;
+ cap->cap_ino = ceph_ino(inode);
spin_unlock(&session->s_cap_lock);
diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index d8859e4bed8b..7a6bff86b750 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -1118,7 +1118,7 @@ ssize_t __ceph_sync_read(struct inode *inode, loff_t *ki_pos,
read_off, read_len);
req = ceph_osdc_new_request(osdc, &ci->i_layout,
- ci->i_vino, read_off, &read_len, 0, 1,
+ ceph_vino(inode), read_off, &read_len, 0, 1,
sparse ? CEPH_OSD_OP_SPARSE_READ :
CEPH_OSD_OP_READ,
CEPH_OSD_FLAG_READ,
@@ -1824,7 +1824,7 @@ ceph_sync_write(struct kiocb *iocb, struct iov_iter *from, loff_t pos,
rmw = first || last;
doutc(cl, "ino %llx %lld~%llu adjusted %lld~%llu -- %srmw\n",
- ci->i_vino.ino, pos, len, write_pos, write_len,
+ ceph_ino(inode), pos, len, write_pos, write_len,
rmw ? "" : "no ");
/*
@@ -1857,7 +1857,7 @@ ceph_sync_write(struct kiocb *iocb, struct iov_iter *from, loff_t pos,
* depending on how the request was aligned.
*/
req = ceph_osdc_new_request(osdc, &ci->i_layout,
- ci->i_vino, first ? first_pos : last_pos,
+ ceph_vino(inode), first ? first_pos : last_pos,
&read_len, 0, (first && last) ? 2 : 1,
CEPH_OSD_OP_SPARSE_READ, CEPH_OSD_FLAG_READ,
NULL, ci->i_truncate_seq,
@@ -2055,7 +2055,7 @@ ceph_sync_write(struct kiocb *iocb, struct iov_iter *from, loff_t pos,
}
req = ceph_osdc_new_request(osdc, &ci->i_layout,
- ci->i_vino, write_pos, &write_len,
+ ceph_vino(inode), write_pos, &write_len,
rmw ? 1 : 0, rmw ? 2 : 1,
CEPH_OSD_OP_WRITE,
CEPH_OSD_FLAG_WRITE,
@@ -2980,12 +2980,12 @@ static ssize_t ceph_do_objects_copy(struct ceph_inode_info *src_ci, u64 *src_off
&dst_objoff, &dst_objlen);
ceph_oid_init(&src_oid);
ceph_oid_printf(&src_oid, "%llx.%08llx",
- src_ci->i_vino.ino, src_objnum);
+ ceph_ino(&src_ci->netfs.inode), src_objnum);
ceph_oid_init(&dst_oid);
ceph_oid_printf(&dst_oid, "%llx.%08llx",
- dst_ci->i_vino.ino, dst_objnum);
+ ceph_ino(&dst_ci->netfs.inode), dst_objnum);
/* Do an object remote copy */
- req = ceph_alloc_copyfrom_request(osdc, src_ci->i_vino.snap,
+ req = ceph_alloc_copyfrom_request(osdc, ceph_snap(&src_ci->netfs.inode),
&src_oid, &src_oloc,
&dst_oid, &dst_oloc,
dst_ci->i_truncate_seq,
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index 540e1ad9ea77..b4a1c126cbc9 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -1988,7 +1988,7 @@ static void remove_session_caps(struct ceph_mds_session *session)
if (cap == prev)
break;
prev = cap;
- vino = cap->ci->i_vino;
+ vino = ceph_vino(&cap->ci->netfs.inode);
spin_unlock(&session->s_cap_lock);
inode = ceph_find_inode(sb, vino);
diff --git a/fs/ceph/quota.c b/fs/ceph/quota.c
index 08641d578a0b..02d7a3062f2d 100644
--- a/fs/ceph/quota.c
+++ b/fs/ceph/quota.c
@@ -31,7 +31,7 @@ static inline bool ceph_has_realms_with_quotas(struct inode *inode)
if (root && ceph_ino(root) == CEPH_INO_ROOT)
return false;
/* MDS stray dirs have no quota realms */
- if (ceph_vino_is_reserved(ceph_inode(inode)->i_vino))
+ if (ceph_vino_is_reserved(ceph_vino(inode)))
return false;
/* otherwise, we can't know for sure */
return true;
diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c
index 94964e0952bd..f064b5ad3bf4 100644
--- a/fs/ceph/snap.c
+++ b/fs/ceph/snap.c
@@ -985,7 +985,7 @@ void ceph_change_snap_realm(struct inode *inode, struct ceph_snap_realm *realm)
if (oldrealm) {
spin_lock(&oldrealm->inodes_with_caps_lock);
list_del_init(&ci->i_snap_realm_item);
- if (oldrealm->ino == ci->i_vino.ino)
+ if (oldrealm->ino == ceph_ino(inode))
oldrealm->inode = NULL;
spin_unlock(&oldrealm->inodes_with_caps_lock);
ceph_put_snap_realm(mdsc, oldrealm);
@@ -996,7 +996,7 @@ void ceph_change_snap_realm(struct inode *inode, struct ceph_snap_realm *realm)
if (realm) {
spin_lock(&realm->inodes_with_caps_lock);
list_add(&ci->i_snap_realm_item, &realm->inodes_with_caps);
- if (realm->ino == ci->i_vino.ino)
+ if (realm->ino == ceph_ino(inode))
realm->inode = inode;
spin_unlock(&realm->inodes_with_caps_lock);
}
diff --git a/fs/ceph/super.h b/fs/ceph/super.h
index b0b8d04b594f..660125d94f8e 100644
--- a/fs/ceph/super.h
+++ b/fs/ceph/super.h
@@ -596,7 +596,7 @@ static inline ino_t ceph_vino_to_ino_t(const struct ceph_vino vino)
}
/* for printf-style formatting */
-#define ceph_vinop(i) ceph_inode(i)->i_vino.ino, ceph_inode(i)->i_vino.snap
+#define ceph_vinop(i) ceph_ino(i), ceph_snap(i)
static inline u64 ceph_ino(const struct inode *inode)
{
@@ -641,9 +641,8 @@ static inline u64 ceph_present_inode(struct inode *inode)
static inline int ceph_ino_compare(struct inode *inode, void *data)
{
struct ceph_vino *pvino = (struct ceph_vino *)data;
- struct ceph_inode_info *ci = ceph_inode(inode);
- return ci->i_vino.ino == pvino->ino &&
- ci->i_vino.snap == pvino->snap;
+ return ceph_ino(inode) == pvino->ino &&
+ ceph_snap(inode) == pvino->snap;
}
/*
diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c
index af54480d9254..b8416afd4901 100644
--- a/fs/ceph/xattr.c
+++ b/fs/ceph/xattr.c
@@ -272,7 +272,7 @@ static bool ceph_vxattrcb_quota_exists(struct ceph_inode_info *ci)
if ((ci->i_max_files || ci->i_max_bytes) &&
!ceph_in_snap(&ci->netfs.inode) &&
ci->i_snap_realm &&
- ci->i_snap_realm->ino == ci->i_vino.ino)
+ ci->i_snap_realm->ino == ceph_ino(&ci->netfs.inode))
ret = true;
spin_unlock(&ci->i_ceph_lock);
return ret;
@@ -1328,7 +1328,7 @@ int __ceph_setxattr(struct inode *inode, const char *name,
spin_lock(&ci->i_ceph_lock);
if ((ci->i_max_files || ci->i_max_bytes) &&
!(ci->i_snap_realm &&
- ci->i_snap_realm->ino == ci->i_vino.ino))
+ ci->i_snap_realm->ino == ceph_ino(&ci->netfs.inode)))
err = -EOPNOTSUPP;
spin_unlock(&ci->i_ceph_lock);
}
--
2.47.3
next prev parent reply other threads:[~2026-07-06 7:25 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-06 7:24 [PATCH v2 00/18] fs/ceph: optimize struct layouts Max Kellermann
2026-07-06 7:24 ` [PATCH v2 01/18] fs/ceph/super: remove unused field `i_cap_migration_resv` Max Kellermann
2026-07-06 7:24 ` [PATCH v2 02/18] fs/ceph/super: make field `i_truncate_pagecache_size` optional Max Kellermann
2026-07-06 7:24 ` [PATCH v2 03/18] include/ceph/ceph_fs.h: convert `pool_id` to u32 Max Kellermann
2026-07-06 7:24 ` [PATCH v2 04/18] fs/ceph/super.h: convert ceph_inode_xattr fields to `bool` Max Kellermann
2026-07-06 7:24 ` [PATCH v2 05/18] fs/ceph/super.h: convert ceph_cap_snap.writing " Max Kellermann
2026-07-06 7:24 ` [PATCH v2 06/18] fs/ceph: consistently use `u32` for `time_warp_seq` Max Kellermann
2026-07-06 7:24 ` [PATCH v2 07/18] fs/ceph/super: reorder fields to eliminate padding holes Max Kellermann
2026-07-06 7:24 ` [PATCH v2 08/18] fs/ceph: remove i_truncate_mutex, use i_fragtree_mutex for both Max Kellermann
2026-07-06 7:24 ` [PATCH v2 09/18] fs/ceph/super.h: add `const` to helpers Max Kellermann
2026-07-06 7:24 ` [PATCH v2 10/18] fs/ceph/super.h: add helper ceph_in_snap() Max Kellermann
2026-07-06 7:24 ` Max Kellermann [this message]
2026-07-06 7:24 ` [PATCH v2 12/18] fs/ceph: remove redundant inode number from ceph_inode_info Max Kellermann
2026-07-06 7:24 ` [PATCH v2 13/18] fs/ceph: remove unused field `ceph_cap.last_used` Max Kellermann
2026-07-06 7:24 ` [PATCH v2 14/18] fs/ceph: convert ceph_cap.queue_release to bool Max Kellermann
2026-07-06 7:24 ` [PATCH v2 15/18] fs/ceph/super: move `ceph_cap.caps_item` into the union Max Kellermann
2026-07-06 7:24 ` [PATCH v2 16/18] fs/ceph/snap: add a kmem_cache for struct ceph_snap_realm Max Kellermann
2026-07-06 7:24 ` [PATCH v2 17/18] fs/ceph/super: reorder struct ceph_snap_realm fields Max Kellermann
2026-07-06 7:24 ` [PATCH v2 18/18] fs/ceph/super: remove redundant field `ceph_snap_realm.parent_ino` Max Kellermann
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=20260706072450.3920010-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 \
/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.