aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2007-10-21 19:42:15 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-22 11:13:20 -0400
commit644f9ab3b0aa386820ce709de747d46b4cece16f (patch)
treeb1c77ca7ae6d95c849244c0d5d53b6517e510910 /fs/ocfs2
parent34c0d154243dd913c5690ae6ceb9557017429b9c (diff)
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>
Diffstat (limited to 'fs/ocfs2')
-rw-r--r--fs/ocfs2/export.c65
1 files changed, 24 insertions, 41 deletions
diff --git a/fs/ocfs2/export.c b/fs/ocfs2/export.c
index c3bbc198f9c..3ad83e34dd3 100644
--- a/fs/ocfs2/export.c
+++ b/fs/ocfs2/export.c
@@ -45,9 +45,9 @@ struct ocfs2_inode_handle
45 u32 ih_generation; 45 u32 ih_generation;
46}; 46};
47 47
48static struct dentry *ocfs2_get_dentry(struct super_block *sb, void *vobjp) 48static struct dentry *ocfs2_get_dentry(struct super_block *sb,
49 struct ocfs2_inode_handle *handle)
49{ 50{
50 struct ocfs2_inode_handle *handle = vobjp;
51 struct inode *inode; 51 struct inode *inode;
52 struct dentry *result; 52 struct dentry *result;
53 53
@@ -194,54 +194,37 @@ bail:
194 return type; 194 return type;
195} 195}
196 196
197static struct dentry *ocfs2_decode_fh(struct super_block *sb, u32 *fh_in, 197static struct dentry *ocfs2_fh_to_dentry(struct super_block *sb,
198 int fh_len, int fileid_type, 198 struct fid *fid, int fh_len, int fh_type)
199 int (*acceptable)(void *context,
200 struct dentry *de),
201 void *context)
202{ 199{
203 struct ocfs2_inode_handle handle, parent; 200 struct ocfs2_inode_handle handle;
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]);
220 201
221 mlog(0, "Decoding parent: blkno: %llu, generation: %u\n", 202 if (fh_len < 3 || fh_type > 2)
222 (unsigned long long)parent.ih_blkno, 203 return NULL;
223 parent.ih_generation);
224 }
225 204
226 handle.ih_blkno = (u64)le32_to_cpu(fh[0]) << 32; 205 handle.ih_blkno = (u64)le32_to_cpu(fid->raw[0]) << 32;
227 handle.ih_blkno |= (u64)le32_to_cpu(fh[1]); 206 handle.ih_blkno |= (u64)le32_to_cpu(fid->raw[1]);
228 handle.ih_generation = le32_to_cpu(fh[2]); 207 handle.ih_generation = le32_to_cpu(fid->raw[2]);
208 return ocfs2_get_dentry(sb, &handle);
209}
229 210
230 mlog(0, "Encoding fh: blkno: %llu, generation: %u\n", 211static struct dentry *ocfs2_fh_to_parent(struct super_block *sb,
231 (unsigned long long)handle.ih_blkno, handle.ih_generation); 212 struct fid *fid, int fh_len, int fh_type)
213{
214 struct ocfs2_inode_handle parent;
232 215
233 ret = ocfs2_export_ops.find_exported_dentry(sb, &handle, &parent, 216 if (fh_type != 2 || fh_len < 6)
234 acceptable, context); 217 return NULL;
235 218
236bail: 219 parent.ih_blkno = (u64)le32_to_cpu(fid->raw[3]) << 32;
237 mlog_exit_ptr(ret); 220 parent.ih_blkno |= (u64)le32_to_cpu(fid->raw[4]);
238 return ret; 221 parent.ih_generation = le32_to_cpu(fid->raw[5]);
222 return ocfs2_get_dentry(sb, &parent);
239} 223}
240 224
241struct export_operations ocfs2_export_ops = { 225struct export_operations ocfs2_export_ops = {
242 .decode_fh = ocfs2_decode_fh,
243 .encode_fh = ocfs2_encode_fh, 226 .encode_fh = ocfs2_encode_fh,
244 227 .fh_to_dentry = ocfs2_fh_to_dentry,
228 .fh_to_parent = ocfs2_fh_to_parent,
245 .get_parent = ocfs2_get_parent, 229 .get_parent = ocfs2_get_parent,
246 .get_dentry = ocfs2_get_dentry,
247}; 230};