Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Christoph Hellwig and committed by
Linus Torvalds
644f9ab3 34c0d154

+24 -41
+24 -41
fs/ocfs2/export.c
··· 45 45 u32 ih_generation; 46 46 }; 47 47 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) 49 50 { 50 - struct ocfs2_inode_handle *handle = vobjp; 51 51 struct inode *inode; 52 52 struct dentry *result; 53 53 ··· 194 194 return type; 195 195 } 196 196 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) 202 199 { 203 - struct ocfs2_inode_handle handle, parent; 204 - struct dentry *ret = NULL; 205 - __le32 *fh = (__force __le32 *) fh_in; 200 + struct ocfs2_inode_handle handle; 206 201 207 - mlog_entry("(0x%p, 0x%p, %d, %d, 0x%p, 0x%p)\n", 208 - sb, fh, fh_len, fileid_type, acceptable, context); 202 + if (fh_len < 3 || fh_type > 2) 203 + return NULL; 209 204 210 - if (fh_len < 3 || fileid_type > 2) 211 - goto bail; 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 + } 212 210 213 - if (fileid_type == 2) { 214 - if (fh_len < 6) 215 - goto bail; 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; 216 215 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]); 216 + if (fh_type != 2 || fh_len < 6) 217 + return NULL; 220 218 221 - mlog(0, "Decoding parent: blkno: %llu, generation: %u\n", 222 - (unsigned long long)parent.ih_blkno, 223 - parent.ih_generation); 224 - } 225 - 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]); 229 - 230 - mlog(0, "Encoding fh: blkno: %llu, generation: %u\n", 231 - (unsigned long long)handle.ih_blkno, handle.ih_generation); 232 - 233 - ret = ocfs2_export_ops.find_exported_dentry(sb, &handle, &parent, 234 - acceptable, context); 235 - 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); 239 223 } 240 224 241 225 struct export_operations ocfs2_export_ops = { 242 - .decode_fh = ocfs2_decode_fh, 243 226 .encode_fh = ocfs2_encode_fh, 244 - 227 + .fh_to_dentry = ocfs2_fh_to_dentry, 228 + .fh_to_parent = ocfs2_fh_to_parent, 245 229 .get_parent = ocfs2_get_parent, 246 - .get_dentry = ocfs2_get_dentry, 247 230 };