Skip to content

Commit 644f9ab

Browse files
Christoph HellwigLinus Torvalds
authored andcommitted
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>
1 parent 34c0d15 commit 644f9ab

1 file changed

Lines changed: 24 additions & 41 deletions

File tree

‎fs/ocfs2/export.c‎

Lines changed: 24 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ struct ocfs2_inode_handle
4545
u32 ih_generation;
4646
};
4747

48-
static struct dentry *ocfs2_get_dentry(struct super_block *sb, void *vobjp)
48+
static struct dentry *ocfs2_get_dentry(struct super_block *sb,
49+
struct ocfs2_inode_handle *handle)
4950
{
50-
struct ocfs2_inode_handle *handle = vobjp;
5151
struct inode *inode;
5252
struct dentry *result;
5353

@@ -194,54 +194,37 @@ static int ocfs2_encode_fh(struct dentry *dentry, u32 *fh_in, int *max_len,
194194
return type;
195195
}
196196

197-
static struct dentry *ocfs2_decode_fh(struct super_block *sb, u32 *fh_in,
198-
int fh_len, int fileid_type,
199-
int (*acceptable)(void *context,
200-
struct dentry *de),
201-
void *context)
197+
static struct dentry *ocfs2_fh_to_dentry(struct super_block *sb,
198+
struct fid *fid, int fh_len, int fh_type)
202199
{
203-
struct ocfs2_inode_handle handle, parent;
204-
struct dentry *ret = NULL;
205-
__le32 *fh = (__force __le32 *) fh_in;
206-
207-
mlog_entry("(0x%p, 0x%p, %d, %d, 0x%p, 0x%p)\n",
208-
sb, fh, fh_len, fileid_type, acceptable, context);
209-
210-
if (fh_len < 3 || fileid_type > 2)
211-
goto bail;
212-
213-
if (fileid_type == 2) {
214-
if (fh_len < 6)
215-
goto bail;
216-
217-
parent.ih_blkno = (u64)le32_to_cpu(fh[3]) << 32;
218-
parent.ih_blkno |= (u64)le32_to_cpu(fh[4]);
219-
parent.ih_generation = le32_to_cpu(fh[5]);
200+
struct ocfs2_inode_handle handle;
220201

221-
mlog(0, "Decoding parent: blkno: %llu, generation: %u\n",
222-
(unsigned long long)parent.ih_blkno,
223-
parent.ih_generation);
224-
}
202+
if (fh_len < 3 || fh_type > 2)
203+
return NULL;
225204

226-
handle.ih_blkno = (u64)le32_to_cpu(fh[0]) << 32;
227-
handle.ih_blkno |= (u64)le32_to_cpu(fh[1]);
228-
handle.ih_generation = le32_to_cpu(fh[2]);
205+
handle.ih_blkno = (u64)le32_to_cpu(fid->raw[0]) << 32;
206+
handle.ih_blkno |= (u64)le32_to_cpu(fid->raw[1]);
207+
handle.ih_generation = le32_to_cpu(fid->raw[2]);
208+
return ocfs2_get_dentry(sb, &handle);
209+
}
229210

230-
mlog(0, "Encoding fh: blkno: %llu, generation: %u\n",
231-
(unsigned long long)handle.ih_blkno, handle.ih_generation);
211+
static struct dentry *ocfs2_fh_to_parent(struct super_block *sb,
212+
struct fid *fid, int fh_len, int fh_type)
213+
{
214+
struct ocfs2_inode_handle parent;
232215

233-
ret = ocfs2_export_ops.find_exported_dentry(sb, &handle, &parent,
234-
acceptable, context);
216+
if (fh_type != 2 || fh_len < 6)
217+
return NULL;
235218

236-
bail:
237-
mlog_exit_ptr(ret);
238-
return ret;
219+
parent.ih_blkno = (u64)le32_to_cpu(fid->raw[3]) << 32;
220+
parent.ih_blkno |= (u64)le32_to_cpu(fid->raw[4]);
221+
parent.ih_generation = le32_to_cpu(fid->raw[5]);
222+
return ocfs2_get_dentry(sb, &parent);
239223
}
240224

241225
struct export_operations ocfs2_export_ops = {
242-
.decode_fh = ocfs2_decode_fh,
243226
.encode_fh = ocfs2_encode_fh,
244-
227+
.fh_to_dentry = ocfs2_fh_to_dentry,
228+
.fh_to_parent = ocfs2_fh_to_parent,
245229
.get_parent = ocfs2_get_parent,
246-
.get_dentry = ocfs2_get_dentry,
247230
};

0 commit comments

Comments
 (0)