aboutsummaryrefslogtreecommitdiffstats
path: root/fs/exofs/super.c
diff options
context:
space:
mode:
authorBoaz Harrosh <bharrosh@panasas.com>2009-03-22 06:47:26 -0400
committerBoaz Harrosh <bharrosh@panasas.com>2009-03-31 12:44:36 -0400
commit8cf74b3936f5c65975b68333727f0540ec8350f4 (patch)
tree99eda92b32dc7869d6f3a28215f5b854675db6b1 /fs/exofs/super.c
parentba9e5e98ca2f808fe92b103a8e6ce5271b10cc89 (diff)
exofs: export_operations
implement export_operations and set in superblock. It is now posible to export exofs via nfs Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Diffstat (limited to 'fs/exofs/super.c')
-rw-r--r--fs/exofs/super.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/fs/exofs/super.c b/fs/exofs/super.c
index b736b117a2a4..9f1985e857e2 100644
--- a/fs/exofs/super.c
+++ b/fs/exofs/super.c
@@ -37,6 +37,7 @@
37#include <linux/parser.h> 37#include <linux/parser.h>
38#include <linux/vfs.h> 38#include <linux/vfs.h>
39#include <linux/random.h> 39#include <linux/random.h>
40#include <linux/exportfs.h>
40 41
41#include "exofs.h" 42#include "exofs.h"
42 43
@@ -194,6 +195,7 @@ static void destroy_inodecache(void)
194 * SUPERBLOCK FUNCTIONS 195 * SUPERBLOCK FUNCTIONS
195 *****************************************************************************/ 196 *****************************************************************************/
196static const struct super_operations exofs_sops; 197static const struct super_operations exofs_sops;
198static const struct export_operations exofs_export_ops;
197 199
198/* 200/*
199 * Write the superblock to the OSD 201 * Write the superblock to the OSD
@@ -358,6 +360,7 @@ static int exofs_fill_super(struct super_block *sb, void *data, int silent)
358 360
359 /* set up operation vectors */ 361 /* set up operation vectors */
360 sb->s_op = &exofs_sops; 362 sb->s_op = &exofs_sops;
363 sb->s_export_op = &exofs_export_ops;
361 root = exofs_iget(sb, EXOFS_ROOT_ID - EXOFS_OBJ_OFF); 364 root = exofs_iget(sb, EXOFS_ROOT_ID - EXOFS_OBJ_OFF);
362 if (IS_ERR(root)) { 365 if (IS_ERR(root)) {
363 EXOFS_ERR("ERROR: exofs_iget failed\n"); 366 EXOFS_ERR("ERROR: exofs_iget failed\n");
@@ -485,6 +488,56 @@ static const struct super_operations exofs_sops = {
485}; 488};
486 489
487/****************************************************************************** 490/******************************************************************************
491 * EXPORT OPERATIONS
492 *****************************************************************************/
493
494struct dentry *exofs_get_parent(struct dentry *child)
495{
496 unsigned long ino = exofs_parent_ino(child);
497
498 if (!ino)
499 return NULL;
500
501 return d_obtain_alias(exofs_iget(child->d_inode->i_sb, ino));
502}
503
504static struct inode *exofs_nfs_get_inode(struct super_block *sb,
505 u64 ino, u32 generation)
506{
507 struct inode *inode;
508
509 inode = exofs_iget(sb, ino);
510 if (IS_ERR(inode))
511 return ERR_CAST(inode);
512 if (generation && inode->i_generation != generation) {
513 /* we didn't find the right inode.. */
514 iput(inode);
515 return ERR_PTR(-ESTALE);
516 }
517 return inode;
518}
519
520static struct dentry *exofs_fh_to_dentry(struct super_block *sb,
521 struct fid *fid, int fh_len, int fh_type)
522{
523 return generic_fh_to_dentry(sb, fid, fh_len, fh_type,
524 exofs_nfs_get_inode);
525}
526
527static struct dentry *exofs_fh_to_parent(struct super_block *sb,
528 struct fid *fid, int fh_len, int fh_type)
529{
530 return generic_fh_to_parent(sb, fid, fh_len, fh_type,
531 exofs_nfs_get_inode);
532}
533
534static const struct export_operations exofs_export_ops = {
535 .fh_to_dentry = exofs_fh_to_dentry,
536 .fh_to_parent = exofs_fh_to_parent,
537 .get_parent = exofs_get_parent,
538};
539
540/******************************************************************************
488 * INSMOD/RMMOD 541 * INSMOD/RMMOD
489 *****************************************************************************/ 542 *****************************************************************************/
490 543