]> git.neil.brown.name Git - history.git/commitdiff
JFS: support for kNFSD
authorDave Kleikamp <shaggy@kleikamp.austin.ibm.com>
Wed, 29 May 2002 11:09:12 +0000 (06:09 -0500)
committerDave Kleikamp <shaggy@kleikamp.austin.ibm.com>
Wed, 29 May 2002 11:09:12 +0000 (06:09 -0500)
Add support for the get_parent export operation to make nfs exporting
work on 2.5.
Switch to the new iget_locked and eliminate ->read_inode.

Submitted by Christoph Hellwig, and Dave Kleikamp

fs/jfs/inode.c
fs/jfs/namei.c
fs/jfs/super.c

index d381b944837dd36f5f2371af42d454aef3f48c98..159b23895edef24fe02945c3c2f2e903eeb84afc 100644 (file)
@@ -34,17 +34,18 @@ extern struct file_operations jfs_file_operations;
 struct address_space_operations jfs_aops;
 extern int freeZeroLink(struct inode *);
 
-void jfs_put_inode(struct inode *inode)
+struct inode *jfs_iget(struct super_block *sb, ino_t ino)
 {
-       jFYI(1, ("In jfs_put_inode, inode = 0x%p\n", inode));
-}
+       struct inode *inode = iget_locked(sb, ino);
 
-void jfs_read_inode(struct inode *inode)
-{
-       jFYI(1, ("In jfs_read_inode, inode = 0x%p\n", inode));
+       if (!inode || !(inode->i_state & I_NEW))
+               return inode;
 
-       if (diRead(inode))
-               goto bad_inode;
+       if (diRead(inode)) { 
+               make_bad_inode(inode);
+               unlock_new_inode(inode);
+               return NULL;
+       }
 
        if (S_ISREG(inode->i_mode)) {
                inode->i_op = &jfs_file_inode_operations;
@@ -65,11 +66,8 @@ void jfs_read_inode(struct inode *inode)
                init_special_inode(inode, inode->i_mode,
                                   kdev_t_to_nr(inode->i_rdev));
        }
-
-       return;
-
-      bad_inode:
-       make_bad_inode(inode);
+       unlock_new_inode(inode);
+       return inode;
 }
 
 /* This define is from fs/open.c */
index 69beb37da17025e75b0374ec017abf63d99d855f..de0f38f102667de5230cd8e2339030d2fa6f837e 100644 (file)
@@ -32,6 +32,7 @@ extern struct address_space_operations jfs_aops;
 
 extern int jfs_fsync(struct file *, struct dentry *, int);
 extern void jfs_truncate_nolock(struct inode *, loff_t);
+extern struct inode *jfs_iget(struct super_block *, ino_t);
 
 /*
  * forward references
@@ -1410,7 +1411,7 @@ static struct dentry *jfs_lookup(struct inode *dip, struct dentry *dentry)
                }
        }
 
-       ip = iget(dip->i_sb, inum);
+       ip = jfs_iget(dip->i_sb, inum);
        if (ip == NULL) {
                jERROR(1,
                       ("jfs_lookup: iget failed on inum %d\n",
@@ -1418,9 +1419,25 @@ static struct dentry *jfs_lookup(struct inode *dip, struct dentry *dentry)
                return ERR_PTR(-EACCES);
        }
 
-       d_add(dentry, ip);
+       return d_splice_alias(ip, dentry);
+}
+
+struct dentry *jfs_get_parent(struct dentry *dentry)
+{
+       struct super_block *sb = dentry->d_inode->i_sb;
+       struct dentry *parent = ERR_PTR(-EACCES);
+       struct inode *inode;
+
+       inode = jfs_iget(sb, JFS_IP(dentry->d_inode)->i_dtroot.header.idotdot);
+       if (inode) {
+               parent = d_alloc_anon(inode);
+               if (!parent) {
+                       parent = ERR_PTR(-ENOMEM);
+                       iput(inode);
+               }
+       }
 
-       return ERR_PTR(0);
+       return parent;
 }
 
 struct inode_operations jfs_dir_inode_operations = {
index b8a7e26098e199a9c3911ae693c1eb89f932a899..1d37309dd5a3b65d4bf6f32922e8f136a81a7e9d 100644 (file)
@@ -53,6 +53,8 @@ MODULE_PARM_DESC(jfsloglevel, "Specify JFS loglevel (0, 1 or 2)");
 /*
  * External declarations
  */
+extern struct inode *jfs_iget(struct super_block *, ino_t);
+
 extern int jfs_mount(struct super_block *);
 extern int jfs_mount_rw(struct super_block *, int);
 extern int jfs_umount(struct super_block *);
@@ -61,12 +63,13 @@ extern int jfs_umount_rw(struct super_block *);
 extern int jfsIOWait(void *);
 extern int jfs_lazycommit(void *);
 extern int jfs_sync(void *);
-extern void jfs_put_inode(struct inode *inode);
-extern void jfs_read_inode(struct inode *inode);
+
 extern void jfs_dirty_inode(struct inode *inode);
 extern void jfs_delete_inode(struct inode *inode);
 extern void jfs_write_inode(struct inode *inode, int wait);
 
+extern struct dentry *jfs_get_parent(struct dentry *dentry);
+
 #if defined(CONFIG_JFS_DEBUG) && defined(CONFIG_PROC_FS)
 extern void jfs_proc_init(void);
 extern void jfs_proc_clean(void);
@@ -232,19 +235,21 @@ int jfs_remount(struct super_block *sb, int *flags, char *data)
        return 0;
 }
 
-static struct super_operations jfs_sops = {
+static struct super_operations jfs_super_operations = {
        alloc_inode:    jfs_alloc_inode,
        destroy_inode:  jfs_destroy_inode,
-       read_inode:     jfs_read_inode,
        dirty_inode:    jfs_dirty_inode,
        write_inode:    jfs_write_inode,
-       put_inode:      jfs_put_inode,
        delete_inode:   jfs_delete_inode,
        put_super:      jfs_put_super,
        statfs:         jfs_statfs,
        remount_fs:     jfs_remount,
 };
 
+static struct export_operations jfs_export_operations = {
+       get_parent:     jfs_get_parent,
+};
+
 static int jfs_fill_super(struct super_block *sb, void *data, int silent)
 {
        struct jfs_sb_info *sbi;
@@ -268,7 +273,13 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
         * Initialize blocksize to 4K.
         */
        sb_set_blocksize(sb, PSIZE);
-       sb->s_op = &jfs_sops;
+
+       /*
+        * Set method vectors.
+        */
+       sb->s_op = &jfs_super_operations;
+       sb->s_export_op = &jfs_export_operations;
+
        /*
         * Initialize direct-mapping inode/address-space
         */
@@ -309,7 +320,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
 
        sb->s_magic = JFS_SUPER_MAGIC;
 
-       inode = iget(sb, ROOT_I);
+       inode = jfs_iget(sb, ROOT_I);
        if (!inode || is_bad_inode(inode))
                goto out_no_root;
        sb->s_root = d_alloc_root(inode);