64 bit ino support for NFS client
Hi. Attached is a patch to modify the NFS client code to support 64 bit ino's, as appropriate for the system and the NFS protocol version. The code basically just expand the NFS interfaces for routines which handle ino's from using ino_t to u64 and then uses the fileid in the nfs_inode instead of i_ino in the inode. The code paths that were updated are in the getattr method and the readdir methods. This should be no real change on 64 bit platforms. Since the ino_t is an unsigned long, it would already be 64 bits wide. Thanx... ps Signed-off-by: Peter Staubach <staubach@redhat.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
parent
50e437d522
commit
4e769b934e
15
fs/nfs/dir.c
15
fs/nfs/dir.c
|
@ -407,7 +407,7 @@ int nfs_do_filldir(nfs_readdir_descriptor_t *desc, void *dirent,
|
||||||
struct file *file = desc->file;
|
struct file *file = desc->file;
|
||||||
struct nfs_entry *entry = desc->entry;
|
struct nfs_entry *entry = desc->entry;
|
||||||
struct dentry *dentry = NULL;
|
struct dentry *dentry = NULL;
|
||||||
unsigned long fileid;
|
u64 fileid;
|
||||||
int loop_count = 0,
|
int loop_count = 0,
|
||||||
res;
|
res;
|
||||||
|
|
||||||
|
@ -418,7 +418,7 @@ int nfs_do_filldir(nfs_readdir_descriptor_t *desc, void *dirent,
|
||||||
unsigned d_type = DT_UNKNOWN;
|
unsigned d_type = DT_UNKNOWN;
|
||||||
/* Note: entry->prev_cookie contains the cookie for
|
/* Note: entry->prev_cookie contains the cookie for
|
||||||
* retrieving the current dirent on the server */
|
* retrieving the current dirent on the server */
|
||||||
fileid = nfs_fileid_to_ino_t(entry->ino);
|
fileid = entry->ino;
|
||||||
|
|
||||||
/* Get a dentry if we have one */
|
/* Get a dentry if we have one */
|
||||||
if (dentry != NULL)
|
if (dentry != NULL)
|
||||||
|
@ -428,7 +428,7 @@ int nfs_do_filldir(nfs_readdir_descriptor_t *desc, void *dirent,
|
||||||
/* Use readdirplus info */
|
/* Use readdirplus info */
|
||||||
if (dentry != NULL && dentry->d_inode != NULL) {
|
if (dentry != NULL && dentry->d_inode != NULL) {
|
||||||
d_type = dt_type(dentry->d_inode);
|
d_type = dt_type(dentry->d_inode);
|
||||||
fileid = dentry->d_inode->i_ino;
|
fileid = NFS_FILEID(dentry->d_inode);
|
||||||
}
|
}
|
||||||
|
|
||||||
res = filldir(dirent, entry->name, entry->len,
|
res = filldir(dirent, entry->name, entry->len,
|
||||||
|
@ -1350,9 +1350,9 @@ static int nfs_rmdir(struct inode *dir, struct dentry *dentry)
|
||||||
static int nfs_sillyrename(struct inode *dir, struct dentry *dentry)
|
static int nfs_sillyrename(struct inode *dir, struct dentry *dentry)
|
||||||
{
|
{
|
||||||
static unsigned int sillycounter;
|
static unsigned int sillycounter;
|
||||||
const int i_inosize = sizeof(dir->i_ino)*2;
|
const int fileidsize = sizeof(NFS_FILEID(dentry->d_inode))*2;
|
||||||
const int countersize = sizeof(sillycounter)*2;
|
const int countersize = sizeof(sillycounter)*2;
|
||||||
const int slen = sizeof(".nfs") + i_inosize + countersize - 1;
|
const int slen = sizeof(".nfs")+fileidsize+countersize-1;
|
||||||
char silly[slen+1];
|
char silly[slen+1];
|
||||||
struct qstr qsilly;
|
struct qstr qsilly;
|
||||||
struct dentry *sdentry;
|
struct dentry *sdentry;
|
||||||
|
@ -1370,8 +1370,9 @@ static int nfs_sillyrename(struct inode *dir, struct dentry *dentry)
|
||||||
if (dentry->d_flags & DCACHE_NFSFS_RENAMED)
|
if (dentry->d_flags & DCACHE_NFSFS_RENAMED)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
sprintf(silly, ".nfs%*.*lx",
|
sprintf(silly, ".nfs%*.*Lx",
|
||||||
i_inosize, i_inosize, dentry->d_inode->i_ino);
|
fileidsize, fileidsize,
|
||||||
|
(unsigned long long)NFS_FILEID(dentry->d_inode));
|
||||||
|
|
||||||
/* Return delegation in anticipation of the rename */
|
/* Return delegation in anticipation of the rename */
|
||||||
nfs_inode_return_delegation(dentry->d_inode);
|
nfs_inode_return_delegation(dentry->d_inode);
|
||||||
|
|
|
@ -450,8 +450,10 @@ int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
|
||||||
err = __nfs_revalidate_inode(NFS_SERVER(inode), inode);
|
err = __nfs_revalidate_inode(NFS_SERVER(inode), inode);
|
||||||
else
|
else
|
||||||
err = nfs_revalidate_inode(NFS_SERVER(inode), inode);
|
err = nfs_revalidate_inode(NFS_SERVER(inode), inode);
|
||||||
if (!err)
|
if (!err) {
|
||||||
generic_fillattr(inode, stat);
|
generic_fillattr(inode, stat);
|
||||||
|
stat->ino = NFS_FILEID(inode);
|
||||||
|
}
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -177,7 +177,7 @@ static void nfs4_setup_readdir(u64 cookie, __be32 *verifier, struct dentry *dent
|
||||||
*p++ = xdr_one; /* bitmap length */
|
*p++ = xdr_one; /* bitmap length */
|
||||||
*p++ = htonl(FATTR4_WORD0_FILEID); /* bitmap */
|
*p++ = htonl(FATTR4_WORD0_FILEID); /* bitmap */
|
||||||
*p++ = htonl(8); /* attribute buffer length */
|
*p++ = htonl(8); /* attribute buffer length */
|
||||||
p = xdr_encode_hyper(p, dentry->d_inode->i_ino);
|
p = xdr_encode_hyper(p, NFS_FILEID(dentry->d_inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
*p++ = xdr_one; /* next */
|
*p++ = xdr_one; /* next */
|
||||||
|
@ -189,7 +189,7 @@ static void nfs4_setup_readdir(u64 cookie, __be32 *verifier, struct dentry *dent
|
||||||
*p++ = xdr_one; /* bitmap length */
|
*p++ = xdr_one; /* bitmap length */
|
||||||
*p++ = htonl(FATTR4_WORD0_FILEID); /* bitmap */
|
*p++ = htonl(FATTR4_WORD0_FILEID); /* bitmap */
|
||||||
*p++ = htonl(8); /* attribute buffer length */
|
*p++ = htonl(8); /* attribute buffer length */
|
||||||
p = xdr_encode_hyper(p, dentry->d_parent->d_inode->i_ino);
|
p = xdr_encode_hyper(p, NFS_FILEID(dentry->d_parent->d_inode));
|
||||||
|
|
||||||
readdir->pgbase = (char *)p - (char *)start;
|
readdir->pgbase = (char *)p - (char *)start;
|
||||||
readdir->count -= readdir->pgbase;
|
readdir->count -= readdir->pgbase;
|
||||||
|
|
Loading…
Reference in New Issue