ocfs2: new export ops

OCFS2 has it's own 64bit-firendly filehandle format so we can't use the
generic helpers here.  I'll add a struct for the types later.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: Neil Brown <neilb@suse.de>
Cc: "J. Bruce Fields" <bfields@fieldses.org>
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>
This commit is contained in:
Christoph Hellwig 2007-10-21 16:42:15 -07:00 committed by Linus Torvalds
parent 34c0d15424
commit 644f9ab3b0

View File

@ -45,9 +45,9 @@ struct ocfs2_inode_handle
u32 ih_generation; u32 ih_generation;
}; };
static struct dentry *ocfs2_get_dentry(struct super_block *sb, void *vobjp) static struct dentry *ocfs2_get_dentry(struct super_block *sb,
struct ocfs2_inode_handle *handle)
{ {
struct ocfs2_inode_handle *handle = vobjp;
struct inode *inode; struct inode *inode;
struct dentry *result; struct dentry *result;
@ -194,54 +194,37 @@ static int ocfs2_encode_fh(struct dentry *dentry, u32 *fh_in, int *max_len,
return type; return type;
} }
static struct dentry *ocfs2_decode_fh(struct super_block *sb, u32 *fh_in, static struct dentry *ocfs2_fh_to_dentry(struct super_block *sb,
int fh_len, int fileid_type, struct fid *fid, int fh_len, int fh_type)
int (*acceptable)(void *context,
struct dentry *de),
void *context)
{ {
struct ocfs2_inode_handle handle, parent; struct ocfs2_inode_handle handle;
struct dentry *ret = NULL;
__le32 *fh = (__force __le32 *) fh_in;
mlog_entry("(0x%p, 0x%p, %d, %d, 0x%p, 0x%p)\n", if (fh_len < 3 || fh_type > 2)
sb, fh, fh_len, fileid_type, acceptable, context); return NULL;
if (fh_len < 3 || fileid_type > 2) handle.ih_blkno = (u64)le32_to_cpu(fid->raw[0]) << 32;
goto bail; handle.ih_blkno |= (u64)le32_to_cpu(fid->raw[1]);
handle.ih_generation = le32_to_cpu(fid->raw[2]);
return ocfs2_get_dentry(sb, &handle);
}
if (fileid_type == 2) { static struct dentry *ocfs2_fh_to_parent(struct super_block *sb,
if (fh_len < 6) struct fid *fid, int fh_len, int fh_type)
goto bail; {
struct ocfs2_inode_handle parent;
parent.ih_blkno = (u64)le32_to_cpu(fh[3]) << 32; if (fh_type != 2 || fh_len < 6)
parent.ih_blkno |= (u64)le32_to_cpu(fh[4]); return NULL;
parent.ih_generation = le32_to_cpu(fh[5]);
mlog(0, "Decoding parent: blkno: %llu, generation: %u\n", parent.ih_blkno = (u64)le32_to_cpu(fid->raw[3]) << 32;
(unsigned long long)parent.ih_blkno, parent.ih_blkno |= (u64)le32_to_cpu(fid->raw[4]);
parent.ih_generation); parent.ih_generation = le32_to_cpu(fid->raw[5]);
} return ocfs2_get_dentry(sb, &parent);
handle.ih_blkno = (u64)le32_to_cpu(fh[0]) << 32;
handle.ih_blkno |= (u64)le32_to_cpu(fh[1]);
handle.ih_generation = le32_to_cpu(fh[2]);
mlog(0, "Encoding fh: blkno: %llu, generation: %u\n",
(unsigned long long)handle.ih_blkno, handle.ih_generation);
ret = ocfs2_export_ops.find_exported_dentry(sb, &handle, &parent,
acceptable, context);
bail:
mlog_exit_ptr(ret);
return ret;
} }
struct export_operations ocfs2_export_ops = { struct export_operations ocfs2_export_ops = {
.decode_fh = ocfs2_decode_fh,
.encode_fh = ocfs2_encode_fh, .encode_fh = ocfs2_encode_fh,
.fh_to_dentry = ocfs2_fh_to_dentry,
.fh_to_parent = ocfs2_fh_to_parent,
.get_parent = ocfs2_get_parent, .get_parent = ocfs2_get_parent,
.get_dentry = ocfs2_get_dentry,
}; };