diff options
author | Peter Staubach <staubach@redhat.com> | 2007-08-03 15:07:10 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-10-09 17:15:29 -0400 |
commit | 4e769b934e7638038e232c05b64f644e7269a90f (patch) | |
tree | 6508c1d273f22d3704eb849fb90404bade7cb4a7 | |
parent | 50e437d522a6cc34a882b2f740297f1b6b4c3af3 (diff) |
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>
-rw-r--r-- | fs/nfs/dir.c | 15 | ||||
-rw-r--r-- | fs/nfs/inode.c | 4 | ||||
-rw-r--r-- | fs/nfs/nfs4proc.c | 4 |
3 files changed, 13 insertions, 10 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index e4a04d16b8b0..dd02db43cbe6 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -407,7 +407,7 @@ int nfs_do_filldir(nfs_readdir_descriptor_t *desc, void *dirent, | |||
407 | struct file *file = desc->file; | 407 | struct file *file = desc->file; |
408 | struct nfs_entry *entry = desc->entry; | 408 | struct nfs_entry *entry = desc->entry; |
409 | struct dentry *dentry = NULL; | 409 | struct dentry *dentry = NULL; |
410 | unsigned long fileid; | 410 | u64 fileid; |
411 | int loop_count = 0, | 411 | int loop_count = 0, |
412 | res; | 412 | res; |
413 | 413 | ||
@@ -418,7 +418,7 @@ int nfs_do_filldir(nfs_readdir_descriptor_t *desc, void *dirent, | |||
418 | unsigned d_type = DT_UNKNOWN; | 418 | unsigned d_type = DT_UNKNOWN; |
419 | /* Note: entry->prev_cookie contains the cookie for | 419 | /* Note: entry->prev_cookie contains the cookie for |
420 | * retrieving the current dirent on the server */ | 420 | * retrieving the current dirent on the server */ |
421 | fileid = nfs_fileid_to_ino_t(entry->ino); | 421 | fileid = entry->ino; |
422 | 422 | ||
423 | /* Get a dentry if we have one */ | 423 | /* Get a dentry if we have one */ |
424 | if (dentry != NULL) | 424 | if (dentry != NULL) |
@@ -428,7 +428,7 @@ int nfs_do_filldir(nfs_readdir_descriptor_t *desc, void *dirent, | |||
428 | /* Use readdirplus info */ | 428 | /* Use readdirplus info */ |
429 | if (dentry != NULL && dentry->d_inode != NULL) { | 429 | if (dentry != NULL && dentry->d_inode != NULL) { |
430 | d_type = dt_type(dentry->d_inode); | 430 | d_type = dt_type(dentry->d_inode); |
431 | fileid = dentry->d_inode->i_ino; | 431 | fileid = NFS_FILEID(dentry->d_inode); |
432 | } | 432 | } |
433 | 433 | ||
434 | res = filldir(dirent, entry->name, entry->len, | 434 | res = filldir(dirent, entry->name, entry->len, |
@@ -1350,9 +1350,9 @@ static int nfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
1350 | static int nfs_sillyrename(struct inode *dir, struct dentry *dentry) | 1350 | static int nfs_sillyrename(struct inode *dir, struct dentry *dentry) |
1351 | { | 1351 | { |
1352 | static unsigned int sillycounter; | 1352 | static unsigned int sillycounter; |
1353 | const int i_inosize = sizeof(dir->i_ino)*2; | 1353 | const int fileidsize = sizeof(NFS_FILEID(dentry->d_inode))*2; |
1354 | const int countersize = sizeof(sillycounter)*2; | 1354 | const int countersize = sizeof(sillycounter)*2; |
1355 | const int slen = sizeof(".nfs") + i_inosize + countersize - 1; | 1355 | const int slen = sizeof(".nfs")+fileidsize+countersize-1; |
1356 | char silly[slen+1]; | 1356 | char silly[slen+1]; |
1357 | struct qstr qsilly; | 1357 | struct qstr qsilly; |
1358 | struct dentry *sdentry; | 1358 | struct dentry *sdentry; |
@@ -1370,8 +1370,9 @@ static int nfs_sillyrename(struct inode *dir, struct dentry *dentry) | |||
1370 | if (dentry->d_flags & DCACHE_NFSFS_RENAMED) | 1370 | if (dentry->d_flags & DCACHE_NFSFS_RENAMED) |
1371 | goto out; | 1371 | goto out; |
1372 | 1372 | ||
1373 | sprintf(silly, ".nfs%*.*lx", | 1373 | sprintf(silly, ".nfs%*.*Lx", |
1374 | i_inosize, i_inosize, dentry->d_inode->i_ino); | 1374 | fileidsize, fileidsize, |
1375 | (unsigned long long)NFS_FILEID(dentry->d_inode)); | ||
1375 | 1376 | ||
1376 | /* Return delegation in anticipation of the rename */ | 1377 | /* Return delegation in anticipation of the rename */ |
1377 | nfs_inode_return_delegation(dentry->d_inode); | 1378 | nfs_inode_return_delegation(dentry->d_inode); |
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 119fefef13f3..3ad938cecd73 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -450,8 +450,10 @@ int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) | |||
450 | err = __nfs_revalidate_inode(NFS_SERVER(inode), inode); | 450 | err = __nfs_revalidate_inode(NFS_SERVER(inode), inode); |
451 | else | 451 | else |
452 | err = nfs_revalidate_inode(NFS_SERVER(inode), inode); | 452 | err = nfs_revalidate_inode(NFS_SERVER(inode), inode); |
453 | if (!err) | 453 | if (!err) { |
454 | generic_fillattr(inode, stat); | 454 | generic_fillattr(inode, stat); |
455 | stat->ino = NFS_FILEID(inode); | ||
456 | } | ||
455 | return err; | 457 | return err; |
456 | } | 458 | } |
457 | 459 | ||
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 4b90e17555a9..d856e9f5913b 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -177,7 +177,7 @@ static void nfs4_setup_readdir(u64 cookie, __be32 *verifier, struct dentry *dent | |||
177 | *p++ = xdr_one; /* bitmap length */ | 177 | *p++ = xdr_one; /* bitmap length */ |
178 | *p++ = htonl(FATTR4_WORD0_FILEID); /* bitmap */ | 178 | *p++ = htonl(FATTR4_WORD0_FILEID); /* bitmap */ |
179 | *p++ = htonl(8); /* attribute buffer length */ | 179 | *p++ = htonl(8); /* attribute buffer length */ |
180 | p = xdr_encode_hyper(p, dentry->d_inode->i_ino); | 180 | p = xdr_encode_hyper(p, NFS_FILEID(dentry->d_inode)); |
181 | } | 181 | } |
182 | 182 | ||
183 | *p++ = xdr_one; /* next */ | 183 | *p++ = xdr_one; /* next */ |
@@ -189,7 +189,7 @@ static void nfs4_setup_readdir(u64 cookie, __be32 *verifier, struct dentry *dent | |||
189 | *p++ = xdr_one; /* bitmap length */ | 189 | *p++ = xdr_one; /* bitmap length */ |
190 | *p++ = htonl(FATTR4_WORD0_FILEID); /* bitmap */ | 190 | *p++ = htonl(FATTR4_WORD0_FILEID); /* bitmap */ |
191 | *p++ = htonl(8); /* attribute buffer length */ | 191 | *p++ = htonl(8); /* attribute buffer length */ |
192 | p = xdr_encode_hyper(p, dentry->d_parent->d_inode->i_ino); | 192 | p = xdr_encode_hyper(p, NFS_FILEID(dentry->d_parent->d_inode)); |
193 | 193 | ||
194 | readdir->pgbase = (char *)p - (char *)start; | 194 | readdir->pgbase = (char *)p - (char *)start; |
195 | readdir->count -= readdir->pgbase; | 195 | readdir->count -= readdir->pgbase; |