aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nilfs2
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-04-02 14:34:06 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-05-29 23:28:33 -0400
commitb0b0382bb4904965a9e9fca77ad87514dfda0d1c (patch)
treedc46873fa74e0d194e4a2571b16f0767e1919ae8 /fs/nilfs2
parent6d42e7e9f6d86ed4dfacde75a6cf515068f9749c (diff)
->encode_fh() API change
pass inode + parent's inode or NULL instead of dentry + bool saying whether we want the parent or not. NOTE: that needs ceph fix folded in. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/nilfs2')
-rw-r--r--fs/nilfs2/namei.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/fs/nilfs2/namei.c b/fs/nilfs2/namei.c
index 0bb2c2010b95..b72847988b78 100644
--- a/fs/nilfs2/namei.c
+++ b/fs/nilfs2/namei.c
@@ -508,31 +508,29 @@ static struct dentry *nilfs_fh_to_parent(struct super_block *sb, struct fid *fh,
508 return nilfs_get_dentry(sb, fid->cno, fid->parent_ino, fid->parent_gen); 508 return nilfs_get_dentry(sb, fid->cno, fid->parent_ino, fid->parent_gen);
509} 509}
510 510
511static int nilfs_encode_fh(struct dentry *dentry, __u32 *fh, int *lenp, 511static int nilfs_encode_fh(struct inode *inode, __u32 *fh, int *lenp,
512 int connectable) 512 struct inode *parent)
513{ 513{
514 struct nilfs_fid *fid = (struct nilfs_fid *)fh; 514 struct nilfs_fid *fid = (struct nilfs_fid *)fh;
515 struct inode *inode = dentry->d_inode;
516 struct nilfs_root *root = NILFS_I(inode)->i_root; 515 struct nilfs_root *root = NILFS_I(inode)->i_root;
517 int type; 516 int type;
518 517
519 if (*lenp < NILFS_FID_SIZE_NON_CONNECTABLE || 518 if (parent && *lenp < NILFS_FID_SIZE_CONNECTABLE) {
520 (connectable && *lenp < NILFS_FID_SIZE_CONNECTABLE)) 519 *lenp = NILFS_FID_SIZE_CONNECTABLE;
520 return 255;
521 }
522 if (*lenp < NILFS_FID_SIZE_NON_CONNECTABLE) {
523 *lenp = NILFS_FID_SIZE_NON_CONNECTABLE;
521 return 255; 524 return 255;
525 }
522 526
523 fid->cno = root->cno; 527 fid->cno = root->cno;
524 fid->ino = inode->i_ino; 528 fid->ino = inode->i_ino;
525 fid->gen = inode->i_generation; 529 fid->gen = inode->i_generation;
526 530
527 if (connectable && !S_ISDIR(inode->i_mode)) { 531 if (parent) {
528 struct inode *parent;
529
530 spin_lock(&dentry->d_lock);
531 parent = dentry->d_parent->d_inode;
532 fid->parent_ino = parent->i_ino; 532 fid->parent_ino = parent->i_ino;
533 fid->parent_gen = parent->i_generation; 533 fid->parent_gen = parent->i_generation;
534 spin_unlock(&dentry->d_lock);
535
536 type = FILEID_NILFS_WITH_PARENT; 534 type = FILEID_NILFS_WITH_PARENT;
537 *lenp = NILFS_FID_SIZE_CONNECTABLE; 535 *lenp = NILFS_FID_SIZE_CONNECTABLE;
538 } else { 536 } else {