aboutsummaryrefslogtreecommitdiffstats
path: root/fs/exportfs
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2007-10-21 19:42:03 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-22 11:13:19 -0400
commit6e91ea2bb0b6a3ddf6d4faeb54a9c20d4e20bc42 (patch)
tree3f20a72d6c36620d071c485206b39e2e32546fc6 /fs/exportfs
parent00bf4098beb15ca174b54f3af1f1e1908d7d18a3 (diff)
exportfs: add fid type
This patchset is a medium scale rewrite of the export operations interface. The goal is to make the interface less complex, and easier to understand from the filesystem side, aswell as preparing generic support for exporting of 64bit inode numbers. This touches all nfs exporting filesystems, and I've done testing on all of the filesystems I have here locally (xfs, ext2, ext3, reiserfs, jfs) This patch: Add a structured fid type so that we don't have to pass an array of u32 values around everywhere. It's a union of possible layouts. As a start there's only the u32 array and the traditional 32bit inode format, but there will be more in one of my next patchset when I start to document the various filehandle formats we have in lowlevel filesystems better. Also add an enum that gives the various filehandle types human- readable names. Note: Some people might think the struct containing an anonymous union is ugly, but I didn't want to pass around a raw union type. Signed-off-by: Christoph Hellwig <hch@lst.de> Cc: Neil Brown <neilb@suse.de> Cc: "J. Bruce Fields" <bfields@fieldses.org> Cc: <linux-ext4@vger.kernel.org> Cc: Dave Kleikamp <shaggy@austin.ibm.com> Cc: Anton Altaparmakov <aia21@cantab.net> Cc: David Chinner <dgc@sgi.com> Cc: Timothy Shimmin <tes@sgi.com> Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> Cc: Hugh Dickins <hugh@veritas.com> Cc: Chris Mason <mason@suse.com> Cc: Jeff Mahoney <jeffm@suse.com> Cc: "Vladimir V. Saveliev" <vs@namesys.com> Cc: Steven Whitehouse <swhiteho@redhat.com> Cc: Mark Fasheh <mark.fasheh@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/exportfs')
-rw-r--r--fs/exportfs/expfs.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c
index 8adb32a9387a..813011aad700 100644
--- a/fs/exportfs/expfs.c
+++ b/fs/exportfs/expfs.c
@@ -434,29 +434,29 @@ out:
434 * can be used to check that it is still valid. It places them in the 434 * can be used to check that it is still valid. It places them in the
435 * filehandle fragment where export_decode_fh expects to find them. 435 * filehandle fragment where export_decode_fh expects to find them.
436 */ 436 */
437static int export_encode_fh(struct dentry *dentry, __u32 *fh, int *max_len, 437static int export_encode_fh(struct dentry *dentry, struct fid *fid,
438 int connectable) 438 int *max_len, int connectable)
439{ 439{
440 struct inode * inode = dentry->d_inode; 440 struct inode * inode = dentry->d_inode;
441 int len = *max_len; 441 int len = *max_len;
442 int type = 1; 442 int type = FILEID_INO32_GEN;
443 443
444 if (len < 2 || (connectable && len < 4)) 444 if (len < 2 || (connectable && len < 4))
445 return 255; 445 return 255;
446 446
447 len = 2; 447 len = 2;
448 fh[0] = inode->i_ino; 448 fid->i32.ino = inode->i_ino;
449 fh[1] = inode->i_generation; 449 fid->i32.gen = inode->i_generation;
450 if (connectable && !S_ISDIR(inode->i_mode)) { 450 if (connectable && !S_ISDIR(inode->i_mode)) {
451 struct inode *parent; 451 struct inode *parent;
452 452
453 spin_lock(&dentry->d_lock); 453 spin_lock(&dentry->d_lock);
454 parent = dentry->d_parent->d_inode; 454 parent = dentry->d_parent->d_inode;
455 fh[2] = parent->i_ino; 455 fid->i32.parent_ino = parent->i_ino;
456 fh[3] = parent->i_generation; 456 fid->i32.parent_gen = parent->i_generation;
457 spin_unlock(&dentry->d_lock); 457 spin_unlock(&dentry->d_lock);
458 len = 4; 458 len = 4;
459 type = 2; 459 type = FILEID_INO32_GEN_PARENT;
460 } 460 }
461 *max_len = len; 461 *max_len = len;
462 return type; 462 return type;
@@ -494,34 +494,34 @@ static struct dentry *export_decode_fh(struct super_block *sb, __u32 *fh, int fh
494 acceptable, context); 494 acceptable, context);
495} 495}
496 496
497int exportfs_encode_fh(struct dentry *dentry, __u32 *fh, int *max_len, 497int exportfs_encode_fh(struct dentry *dentry, struct fid *fid, int *max_len,
498 int connectable) 498 int connectable)
499{ 499{
500 struct export_operations *nop = dentry->d_sb->s_export_op; 500 struct export_operations *nop = dentry->d_sb->s_export_op;
501 int error; 501 int error;
502 502
503 if (nop->encode_fh) 503 if (nop->encode_fh)
504 error = nop->encode_fh(dentry, fh, max_len, connectable); 504 error = nop->encode_fh(dentry, fid->raw, max_len, connectable);
505 else 505 else
506 error = export_encode_fh(dentry, fh, max_len, connectable); 506 error = export_encode_fh(dentry, fid, max_len, connectable);
507 507
508 return error; 508 return error;
509} 509}
510EXPORT_SYMBOL_GPL(exportfs_encode_fh); 510EXPORT_SYMBOL_GPL(exportfs_encode_fh);
511 511
512struct dentry *exportfs_decode_fh(struct vfsmount *mnt, __u32 *fh, int fh_len, 512struct dentry *exportfs_decode_fh(struct vfsmount *mnt, struct fid *fid,
513 int fileid_type, int (*acceptable)(void *, struct dentry *), 513 int fh_len, int fileid_type,
514 void *context) 514 int (*acceptable)(void *, struct dentry *), void *context)
515{ 515{
516 struct export_operations *nop = mnt->mnt_sb->s_export_op; 516 struct export_operations *nop = mnt->mnt_sb->s_export_op;
517 struct dentry *result; 517 struct dentry *result;
518 518
519 if (nop->decode_fh) { 519 if (nop->decode_fh) {
520 result = nop->decode_fh(mnt->mnt_sb, fh, fh_len, fileid_type, 520 result = nop->decode_fh(mnt->mnt_sb, fid->raw, fh_len,
521 acceptable, context); 521 fileid_type, acceptable, context);
522 } else { 522 } else {
523 result = export_decode_fh(mnt->mnt_sb, fh, fh_len, fileid_type, 523 result = export_decode_fh(mnt->mnt_sb, fid->raw, fh_len,
524 acceptable, context); 524 fileid_type, acceptable, context);
525 } 525 }
526 526
527 return result; 527 return result;