Commit 9d260518 authored by Dave Kleikamp's avatar Dave Kleikamp

JFS: support for kNFSD

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
parent 87ad0ded
......@@ -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 */
......
......@@ -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);
}
return ERR_PTR(0);
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 parent;
}
struct inode_operations jfs_dir_inode_operations = {
......
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment