Re: [RFC] NFS Support

Christoph Hellwig
2008-06-30T18:46:00Z

On Sun, Jun 29, 2008 at 05:05:31AM +0530, Balaji Rao wrote:
> len = 5;
> fh[0] = cpu_to_le32((u32)(objectid >> 32));
> fh[1] = cpu_to_le32((u32)(objectid & 0xffffffff));
> fh[2] = cpu_to_le32((u32)(root_objectid >> 32));
> fh[3] = cpu_to_le32((u32)(root_objectid & 0xffffffff));
> fh[4] = cpu_to_le32(generation);

Please use C struct types for the file handles. Take a look at
fs/xfs/linux-2.6/xfs_export.[ch] for an example.

> static struct dentry * btrfs_get_dentry(struct super_block *sb,
> u64 objectid, u64 root_objectid, u32 generation)
> {
> struct inode *inode;
> struct dentry *result;
>
> inode = btrfs_ilookup(sb, objectid, root_objectid);
> if (IS_ERR(inode))
> return (void *)inode;

This one will only find inodes when they already are in memory. You
need to something similar to btrfs_lookup minus the btrfs_inode_by_name
call here. In fact it would make a lot of sense to factor that part
of btrfs_lookup out into a btrfs_iget helper that takes a struct
btrfs_key pointer and returns the inode for you.