aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2007-10-21 19:42:13 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-22 11:13:20 -0400
commitbe55caf177e14bc54d1498d599a78849b0b230bb (patch)
treeca108e80b1c935f939b55d86ee8c5072e5207727 /fs
parent480b116c98344ca246f50aade6eb7aca98151a2f (diff)
reiserfs: new export ops
Another nice little cleanup by using the new methods. Signed-off-by: Christoph Hellwig <hch@lst.de> Cc: Neil Brown <neilb@suse.de> Cc: "J. Bruce Fields" <bfields@fieldses.org> Cc: Chris Mason <mason@suse.com> Cc: Jeff Mahoney <jeffm@suse.com> Cc: "Vladimir V. Saveliev" <vs@namesys.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/reiserfs/inode.c62
-rw-r--r--fs/reiserfs/super.c4
2 files changed, 29 insertions, 37 deletions
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index a991af96f3f0..231fd5ccadc5 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -1515,19 +1515,20 @@ struct inode *reiserfs_iget(struct super_block *s, const struct cpu_key *key)
1515 return inode; 1515 return inode;
1516} 1516}
1517 1517
1518struct dentry *reiserfs_get_dentry(struct super_block *sb, void *vobjp) 1518static struct dentry *reiserfs_get_dentry(struct super_block *sb,
1519 u32 objectid, u32 dir_id, u32 generation)
1520
1519{ 1521{
1520 __u32 *data = vobjp;
1521 struct cpu_key key; 1522 struct cpu_key key;
1522 struct dentry *result; 1523 struct dentry *result;
1523 struct inode *inode; 1524 struct inode *inode;
1524 1525
1525 key.on_disk_key.k_objectid = data[0]; 1526 key.on_disk_key.k_objectid = objectid;
1526 key.on_disk_key.k_dir_id = data[1]; 1527 key.on_disk_key.k_dir_id = dir_id;
1527 reiserfs_write_lock(sb); 1528 reiserfs_write_lock(sb);
1528 inode = reiserfs_iget(sb, &key); 1529 inode = reiserfs_iget(sb, &key);
1529 if (inode && !IS_ERR(inode) && data[2] != 0 && 1530 if (inode && !IS_ERR(inode) && generation != 0 &&
1530 data[2] != inode->i_generation) { 1531 generation != inode->i_generation) {
1531 iput(inode); 1532 iput(inode);
1532 inode = NULL; 1533 inode = NULL;
1533 } 1534 }
@@ -1544,14 +1545,9 @@ struct dentry *reiserfs_get_dentry(struct super_block *sb, void *vobjp)
1544 return result; 1545 return result;
1545} 1546}
1546 1547
1547struct dentry *reiserfs_decode_fh(struct super_block *sb, __u32 * data, 1548struct dentry *reiserfs_fh_to_dentry(struct super_block *sb, struct fid *fid,
1548 int len, int fhtype, 1549 int fh_len, int fh_type)
1549 int (*acceptable) (void *contect,
1550 struct dentry * de),
1551 void *context)
1552{ 1550{
1553 __u32 obj[3], parent[3];
1554
1555 /* fhtype happens to reflect the number of u32s encoded. 1551 /* fhtype happens to reflect the number of u32s encoded.
1556 * due to a bug in earlier code, fhtype might indicate there 1552 * due to a bug in earlier code, fhtype might indicate there
1557 * are more u32s then actually fitted. 1553 * are more u32s then actually fitted.
@@ -1564,32 +1560,28 @@ struct dentry *reiserfs_decode_fh(struct super_block *sb, __u32 * data,
1564 * 6 - as above plus generation of directory 1560 * 6 - as above plus generation of directory
1565 * 6 does not fit in NFSv2 handles 1561 * 6 does not fit in NFSv2 handles
1566 */ 1562 */
1567 if (fhtype > len) { 1563 if (fh_type > fh_len) {
1568 if (fhtype != 6 || len != 5) 1564 if (fh_type != 6 || fh_len != 5)
1569 reiserfs_warning(sb, 1565 reiserfs_warning(sb,
1570 "nfsd/reiserfs, fhtype=%d, len=%d - odd", 1566 "nfsd/reiserfs, fhtype=%d, len=%d - odd",
1571 fhtype, len); 1567 fh_type, fh_len);
1572 fhtype = 5; 1568 fh_type = 5;
1573 } 1569 }
1574 1570
1575 obj[0] = data[0]; 1571 return reiserfs_get_dentry(sb, fid->raw[0], fid->raw[1],
1576 obj[1] = data[1]; 1572 (fh_type == 3 || fh_type >= 5) ? fid->raw[2] : 0);
1577 if (fhtype == 3 || fhtype >= 5) 1573}
1578 obj[2] = data[2];
1579 else
1580 obj[2] = 0; /* generation number */
1581 1574
1582 if (fhtype >= 4) { 1575struct dentry *reiserfs_fh_to_parent(struct super_block *sb, struct fid *fid,
1583 parent[0] = data[fhtype >= 5 ? 3 : 2]; 1576 int fh_len, int fh_type)
1584 parent[1] = data[fhtype >= 5 ? 4 : 3]; 1577{
1585 if (fhtype == 6) 1578 if (fh_type < 4)
1586 parent[2] = data[5]; 1579 return NULL;
1587 else 1580
1588 parent[2] = 0; 1581 return reiserfs_get_dentry(sb,
1589 } 1582 (fh_type >= 5) ? fid->raw[3] : fid->raw[2],
1590 return sb->s_export_op->find_exported_dentry(sb, obj, 1583 (fh_type >= 5) ? fid->raw[4] : fid->raw[3],
1591 fhtype < 4 ? NULL : parent, 1584 (fh_type == 6) ? fid->raw[5] : 0);
1592 acceptable, context);
1593} 1585}
1594 1586
1595int reiserfs_encode_fh(struct dentry *dentry, __u32 * data, int *lenp, 1587int reiserfs_encode_fh(struct dentry *dentry, __u32 * data, int *lenp,
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index 98c3781bc069..708269f75206 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -663,9 +663,9 @@ static struct quotactl_ops reiserfs_qctl_operations = {
663 663
664static struct export_operations reiserfs_export_ops = { 664static struct export_operations reiserfs_export_ops = {
665 .encode_fh = reiserfs_encode_fh, 665 .encode_fh = reiserfs_encode_fh,
666 .decode_fh = reiserfs_decode_fh, 666 .fh_to_dentry = reiserfs_fh_to_dentry,
667 .fh_to_parent = reiserfs_fh_to_parent,
667 .get_parent = reiserfs_get_parent, 668 .get_parent = reiserfs_get_parent,
668 .get_dentry = reiserfs_get_dentry,
669}; 669};
670 670
671/* this struct is used in reiserfs_getopt () for containing the value for those 671/* this struct is used in reiserfs_getopt () for containing the value for those