From: David Howells Subject: [RHEL5 PATCH 2/2] NFS: Represent 64-bit fileids as 64-bit inode numbers on 32-bit systems [try #2] Date: Tue, 15 Aug 2006 16:26:32 +0100 Message-ID: <20060815152632.29222.66333.stgit@warthog.cambridge.redhat.com> References: <20060815152627.29222.71414.stgit@warthog.cambridge.redhat.com> Content-Type: text/plain; charset=utf-8; format=fixed Content-Transfer-Encoding: quoted-printable Cc: linux-fsdevel@vger.kernel.org, dhowells@redhat.com, nfsv4@linux-nfs.org, linux-kernel@vger.kernel.org Return-path: To: torvalds@osdl.org, akpm@osdl.org, trond.myklebust@fys.uio.no, aviro@redhat.com In-Reply-To: <20060815152627.29222.71414.stgit@warthog.cambridge.redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: nfsv4-bounces@linux-nfs.org Errors-To: nfsv4-bounces@linux-nfs.org List-Id: linux-fsdevel.vger.kernel.org Building on the previous patch that expanded the inode numbers in struct = kstat and filldir_t to an obligate 64-bits, make NFS represent 64-bit fileids a= s 64-bit inode numbers rather than compressing them down to 32-bits. Signed-Off-By: David Howells --- fs/nfs/dir.c | 6 +++--- fs/nfs/inode.c | 21 ++++++++++----------- include/linux/nfs_fs.h | 9 --------- 3 files changed, 13 insertions(+), 23 deletions(-) diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 9b496ef..e746ed1 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -397,7 +397,7 @@ int nfs_do_filldir(nfs_readdir_descripto struct file *file =3D desc->file; struct nfs_entry *entry =3D desc->entry; struct dentry *dentry =3D NULL; - unsigned long fileid; + u64 fileid; int loop_count =3D 0, res; =20 @@ -408,7 +408,7 @@ int nfs_do_filldir(nfs_readdir_descripto unsigned d_type =3D DT_UNKNOWN; /* Note: entry->prev_cookie contains the cookie for * retrieving the current dirent on the server */ - fileid =3D nfs_fileid_to_ino_t(entry->ino); + fileid =3D entry->ino; =20 /* Get a dentry if we have one */ if (dentry !=3D NULL) @@ -418,7 +418,7 @@ int nfs_do_filldir(nfs_readdir_descripto /* Use readdirplus info */ if (dentry !=3D NULL && dentry->d_inode !=3D NULL) { d_type =3D dt_type(dentry->d_inode); - fileid =3D dentry->d_inode->i_ino; + fileid =3D NFS_FILEID(dentry->d_inode); } =20 res =3D filldir(dirent, entry->name, entry->len,=20 diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index eaa254b..a7b1e20 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -57,12 +57,6 @@ static void nfs_zap_acl_cache(struct ino =20 static kmem_cache_t * nfs_inode_cachep; =20 -static inline unsigned long -nfs_fattr_to_ino_t(struct nfs_fattr *fattr) -{ - return nfs_fileid_to_ino_t(fattr->fileid); -} - int nfs_write_inode(struct inode *inode, int sync) { int flags =3D sync ? FLUSH_SYNC : 0; @@ -220,7 +214,9 @@ nfs_fhget(struct super_block *sb, struct goto out_no_inode; } =20 - hash =3D nfs_fattr_to_ino_t(fattr); + hash =3D fattr->fileid; + if (sizeof(hash) < sizeof(u64)) + hash ^=3D fattr->fileid >> (sizeof(u64) - sizeof(ino_t)) * 8; =20 inode =3D iget5_locked(sb, hash, nfs_find_actor, nfs_init_locked, &desc= ); if (inode =3D=3D NULL) { @@ -231,9 +227,10 @@ nfs_fhget(struct super_block *sb, struct if (inode->i_state & I_NEW) { struct nfs_inode *nfsi =3D NFS_I(inode); =20 - /* We set i_ino for the few things that still rely on it, - * such as stat(2) */ - inode->i_ino =3D hash; + /* We set i_ino for the few things that still rely on it, such + * as printing messages; stat and filldir use the fileid + * directly since i_ino may not be large enough */ + inode->i_ino =3D fattr->fileid; =20 /* We can't support update_atime(), since the server will reset it */ inode->i_flags |=3D S_NOATIME|S_NOCMTIME; @@ -442,8 +439,10 @@ int nfs_getattr(struct vfsmount *mnt, st err =3D __nfs_revalidate_inode(NFS_SERVER(inode), inode); else err =3D nfs_revalidate_inode(NFS_SERVER(inode), inode); - if (!err) + if (!err) { generic_fillattr(inode, stat); + stat->ino =3D NFS_FILEID(inode); + } return err; } =20 diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 96d7bd9..b768c43 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h @@ -548,15 +548,6 @@ nfs_size_to_loff_t(__u64 size) return (loff_t) size; } =20 -static inline ino_t -nfs_fileid_to_ino_t(u64 fileid) -{ - ino_t ino =3D (ino_t) fileid; - if (sizeof(ino_t) < sizeof(u64)) - ino ^=3D fileid >> (sizeof(u64)-sizeof(ino_t)) * 8; - return ino; -} - /* NFS root */ =20 extern void * nfs_root_data(void);