]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
nfs: remove nfs_compat_user_ino64() and deprecate enable_ino64
authorJeff Layton <jlayton@kernel.org>
Tue, 12 May 2026 16:12:43 +0000 (12:12 -0400)
committerAnna Schumaker <anna.schumaker@hammerspace.com>
Mon, 8 Jun 2026 14:21:54 +0000 (10:21 -0400)
Now that inode->i_ino stores the full 64-bit NFS fileid, the
nfs_compat_user_ino64() function is no longer needed.
generic_fillattr() already copies inode->i_ino into stat->ino, so the
explicit override in nfs_getattr() is also redundant.

Also remove the now-unused nfs_fileid_to_ino_t() and
nfs_fattr_to_ino_t() helper functions that were used to XOR-fold
64-bit fileids into the old unsigned long i_ino.

Keep the enable_ino64 module parameter as a deprecated stub that
accepts but ignores the value, logging a notice when set. This avoids
breaking existing configurations that pass nfs.enable_ino64 on the
kernel command line or in modprobe.d.

Assisted-by: Claude:claude-opus-4-6
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
Documentation/admin-guide/kernel-parameters.txt
fs/nfs/dir.c
fs/nfs/inode.c
include/linux/nfs_fs.h

index 97007f4f69d4e8f19acaff81c9af8421a09822bf..2e6a6b8f1d8d26d5b1fd643c91ffdf1dfaea7394 100644 (file)
@@ -4290,13 +4290,6 @@ Kernel parameters
                        Only applies if the softerr mount option is enabled,
                        and the specified value is >= 0.
 
-       nfs.enable_ino64=
-                       [NFS] enable 64-bit inode numbers.
-                       If zero, the NFS client will fake up a 32-bit inode
-                       number for the readdir() and stat() syscalls instead
-                       of returning the full 64-bit number.
-                       The default is to return 64-bit inode numbers.
-
        nfs.idmap_cache_timeout=
                        [NFS] set the maximum lifetime for idmapper cache
                        entries.
index 5f8c3ea0bce37341c713e24a922e6f244738a98d..659e39b1562bc13c7fa9692e29a9d903e19838de 100644 (file)
@@ -1106,7 +1106,7 @@ static void nfs_do_filldir(struct nfs_readdir_descriptor *desc,
 
                ent = &array->array[i];
                if (!dir_emit(desc->ctx, ent->name, ent->name_len,
-                   nfs_compat_user_ino64(ent->ino), ent->d_type)) {
+                   ent->ino, ent->d_type)) {
                        desc->eob = true;
                        break;
                }
index dd9e378c36fb2b4caff413c8f5534fb1fd2a0d75..a21ed1c7f89db4f3e0ace1a34eb72de4851065df 100644 (file)
 
 #define NFSDBG_FACILITY                NFSDBG_VFS
 
-#define NFS_64_BIT_INODE_NUMBERS_ENABLED       1
+static bool enable_ino64;
 
-/* Default is to see 64-bit inode numbers */
-static bool enable_ino64 = NFS_64_BIT_INODE_NUMBERS_ENABLED;
+static int param_set_enable_ino64(const char *val, const struct kernel_param *kp)
+{
+       pr_notice("enable_ino64 is deprecated and has no effect\n");
+       return 0;
+}
+
+static const struct kernel_param_ops param_ops_enable_ino64 = {
+       .set = param_set_enable_ino64,
+       .get = param_get_bool,
+};
 
 static int nfs_update_inode(struct inode *, struct nfs_fattr *);
 
 static struct kmem_cache * nfs_inode_cachep;
 
-static inline u64
-nfs_fattr_to_ino_t(struct nfs_fattr *fattr)
-{
-       return fattr->fileid;
-}
-
 int nfs_wait_bit_killable(struct wait_bit_key *key, int mode)
 {
        if (unlikely(nfs_current_task_exiting()))
@@ -83,29 +85,6 @@ int nfs_wait_bit_killable(struct wait_bit_key *key, int mode)
 }
 EXPORT_SYMBOL_GPL(nfs_wait_bit_killable);
 
-/**
- * nfs_compat_user_ino64 - returns the user-visible inode number
- * @fileid: 64-bit fileid
- *
- * This function returns a 32-bit inode number if the boot parameter
- * nfs.enable_ino64 is zero.
- */
-u64 nfs_compat_user_ino64(u64 fileid)
-{
-#ifdef CONFIG_COMPAT
-       compat_ulong_t ino;
-#else  
-       unsigned long ino;
-#endif
-
-       if (enable_ino64)
-               return fileid;
-       ino = fileid;
-       if (sizeof(ino) < sizeof(fileid))
-               ino ^= fileid >> (sizeof(fileid)-sizeof(ino)) * 8;
-       return ino;
-}
-
 int nfs_drop_inode(struct inode *inode)
 {
        return NFS_STALE(inode) || inode_generic_drop(inode);
@@ -418,7 +397,7 @@ nfs_ilookup(struct super_block *sb, struct nfs_fattr *fattr, struct nfs_fh *fh)
            !(fattr->valid & NFS_ATTR_FATTR_TYPE))
                return NULL;
 
-       hash = nfs_fattr_to_ino_t(fattr);
+       hash = fattr->fileid;
        inode = ilookup5(sb, hash, nfs_find_actor, &desc);
 
        dprintk("%s: returning %p\n", __func__, inode);
@@ -466,7 +445,7 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr)
        if ((fattr->valid & NFS_ATTR_FATTR_TYPE) == 0)
                goto out_no_inode;
 
-       hash = nfs_fattr_to_ino_t(fattr);
+       hash = fattr->fileid;
 
        inode = iget5_locked(sb, hash, nfs_find_actor, nfs_init_locked, &desc);
        if (inode == NULL) {
@@ -1061,7 +1040,6 @@ out_no_revalidate:
        stat->result_mask = nfs_get_valid_attrmask(inode) | request_mask;
 
        generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat);
-       stat->ino = nfs_compat_user_ino64(NFS_FILEID(inode));
        stat->change_cookie = inode_peek_iversion_raw(inode);
        stat->attributes_mask |= STATX_ATTR_CHANGE_MONOTONIC;
        if (server->change_attr_type != NFS4_CHANGE_TYPE_IS_UNDEFINED)
@@ -2793,7 +2771,7 @@ static void __exit exit_nfs_fs(void)
 MODULE_AUTHOR("Olaf Kirch <okir@monad.swb.de>");
 MODULE_DESCRIPTION("NFS client support");
 MODULE_LICENSE("GPL");
-module_param(enable_ino64, bool, 0644);
+module_param_cb(enable_ino64, &param_ops_enable_ino64, &enable_ino64, 0644);
 
 module_init(init_nfs_fs)
 module_exit(exit_nfs_fs)
index 8e48053b3069dbbb3afe0eb9a2b5c315b9ac06fe..6d6fa62ede10d3fb9b727ef614433050aa70908d 100644 (file)
@@ -473,7 +473,6 @@ extern void nfs_file_set_open_context(struct file *filp, struct nfs_open_context
 extern void nfs_file_clear_open_context(struct file *flip);
 extern struct nfs_lock_context *nfs_get_lock_context(struct nfs_open_context *ctx);
 extern void nfs_put_lock_context(struct nfs_lock_context *l_ctx);
-extern u64 nfs_compat_user_ino64(u64 fileid);
 extern void nfs_fattr_init(struct nfs_fattr *fattr);
 extern void nfs_fattr_set_barrier(struct nfs_fattr *fattr);
 extern unsigned long nfs_inc_attr_generation_counter(void);
@@ -668,15 +667,6 @@ static inline loff_t nfs_size_to_loff_t(__u64 size)
        return min_t(u64, size, OFFSET_MAX);
 }
 
-static inline ino_t
-nfs_fileid_to_ino_t(u64 fileid)
-{
-       ino_t ino = (ino_t) fileid;
-       if (sizeof(ino_t) < sizeof(u64))
-               ino ^= fileid >> (sizeof(u64)-sizeof(ino_t)) * 8;
-       return ino;
-}
-
 static inline void nfs_ooo_clear(struct nfs_inode *nfsi)
 {
        nfsi->cache_validity &= ~NFS_INO_DATA_INVAL_DEFER;