aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/inode.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2007-10-09 12:01:04 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2007-10-09 17:20:52 -0400
commitf43bf0bebed7c33b698a8a25f95812f9e87c3843 (patch)
tree20c527153cde564ca3517cf6f214fa32727542bb /fs/nfs/inode.c
parent2a3f5fd45938bd86ce8faf4cb26be4f7e9ae2941 (diff)
NFS: Add a boot parameter to disable 64 bit inode numbers
This boot parameter will allow legacy 32-bit applications which call stat() to continue to function even if the NFSv3/v4 server uses 64-bit inode numbers. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/inode.c')
-rw-r--r--fs/nfs/inode.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index cad1246bf575..035c769b715e 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -49,6 +49,11 @@
49 49
50#define NFSDBG_FACILITY NFSDBG_VFS 50#define NFSDBG_FACILITY NFSDBG_VFS
51 51
52#define NFS_64_BIT_INODE_NUMBERS_ENABLED 1
53
54/* Default is to see 64-bit inode numbers */
55static int enable_ino64 = NFS_64_BIT_INODE_NUMBERS_ENABLED;
56
52static void nfs_invalidate_inode(struct inode *); 57static void nfs_invalidate_inode(struct inode *);
53static int nfs_update_inode(struct inode *, struct nfs_fattr *); 58static int nfs_update_inode(struct inode *, struct nfs_fattr *);
54 59
@@ -62,6 +67,25 @@ nfs_fattr_to_ino_t(struct nfs_fattr *fattr)
62 return nfs_fileid_to_ino_t(fattr->fileid); 67 return nfs_fileid_to_ino_t(fattr->fileid);
63} 68}
64 69
70/**
71 * nfs_compat_user_ino64 - returns the user-visible inode number
72 * @fileid: 64-bit fileid
73 *
74 * This function returns a 32-bit inode number if the boot parameter
75 * nfs.enable_ino64 is zero.
76 */
77u64 nfs_compat_user_ino64(u64 fileid)
78{
79 int ino;
80
81 if (enable_ino64)
82 return fileid;
83 ino = fileid;
84 if (sizeof(ino) < sizeof(fileid))
85 ino ^= fileid >> (sizeof(fileid)-sizeof(ino)) * 8;
86 return ino;
87}
88
65int nfs_write_inode(struct inode *inode, int sync) 89int nfs_write_inode(struct inode *inode, int sync)
66{ 90{
67 int ret; 91 int ret;
@@ -456,7 +480,7 @@ int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
456 err = nfs_revalidate_inode(NFS_SERVER(inode), inode); 480 err = nfs_revalidate_inode(NFS_SERVER(inode), inode);
457 if (!err) { 481 if (!err) {
458 generic_fillattr(inode, stat); 482 generic_fillattr(inode, stat);
459 stat->ino = NFS_FILEID(inode); 483 stat->ino = nfs_compat_user_ino64(NFS_FILEID(inode));
460 } 484 }
461 return err; 485 return err;
462} 486}
@@ -1235,6 +1259,7 @@ static void __exit exit_nfs_fs(void)
1235/* Not quite true; I just maintain it */ 1259/* Not quite true; I just maintain it */
1236MODULE_AUTHOR("Olaf Kirch <okir@monad.swb.de>"); 1260MODULE_AUTHOR("Olaf Kirch <okir@monad.swb.de>");
1237MODULE_LICENSE("GPL"); 1261MODULE_LICENSE("GPL");
1262module_param(enable_ino64, bool, 0644);
1238 1263
1239module_init(init_nfs_fs) 1264module_init(init_nfs_fs)
1240module_exit(exit_nfs_fs) 1265module_exit(exit_nfs_fs)