[PATCH 13/61] smb: store full 64-bit uniqueid in i_ino

Jeff Layton
2026-02-26T15:59:01Z

With i_ino now u64, CIFS/SMB can store the full 64-bit uniqueid in
i_ino without the XOR-folding hack previously needed on 32-bit
architectures.

- Simplify cifs_uniqueid_to_ino_t() to return u64 directly
- Update hash variable type in cifs_get_inode_info()
- Update format strings from %lu to %llu

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/smb/client/cifsfs.h | 12 +++---------
fs/smb/client/inode.c | 4 ++--
2 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/fs/smb/client/cifsfs.h b/fs/smb/client/cifsfs.h
index e320d39b01f5eca8033cc516f6f1a2f07276676c..4a1f18022c711a7ff5b141d08ec6cac8483a6b6a 100644
--- a/fs/smb/client/cifsfs.h
+++ b/fs/smb/client/cifsfs.h
@@ -14,18 +14,12 @@
#define ROOT_I 2

/*
- * ino_t is 32-bits on 32-bit arch. We have to squash the 64-bit value down
- * so that it will fit. We use hash_64 to convert the value to 31 bits, and
- * then add 1, to ensure that we don't end up with a 0 as the value.
+ * With i_ino being u64, we can store the full 64-bit uniqueid directly.
*/
-static inline ino_t
+static inline u64
cifs_uniqueid_to_ino_t(u64 fileid)
{
- if ((sizeof(ino_t)) < (sizeof(u64)))
- return (ino_t)hash_64(fileid, (sizeof(ino_t) * 8) - 1) + 1;
-
- return (ino_t)fileid;
-
+ return fileid;
}

static inline void cifs_set_time(struct dentry *dentry, unsigned long time)
diff --git a/fs/smb/client/inode.c b/fs/smb/client/inode.c
index d4d3cfeb6c90ee6dc71fcd9a8de31a1785cbb9ef..102e7615b658726551e9b01ba25065d1f0c505ac 100644
--- a/fs/smb/client/inode.c
+++ b/fs/smb/client/inode.c
@@ -1611,13 +1611,13 @@ inode_has_hashed_dentries(struct inode *inode)
struct inode *
cifs_iget(struct super_block *sb, struct cifs_fattr *fattr)
{
- unsigned long hash;
+ u64 hash;
struct inode *inode;

retry_iget5_locked:
cifs_dbg(FYI, "looking for uniqueid=%llu\n", fattr->cf_uniqueid);

- /* hash down to 32-bits on 32-bit arch */
+ /* With u64 i_ino, we can use the full uniqueid */
hash = cifs_uniqueid_to_ino_t(fattr->cf_uniqueid);

inode = iget5_locked(sb, hash, cifs_find_inode, cifs_init_inode, fattr);

--
2.53.0