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>
This commit is contained in:
parent
480b116c98
commit
be55caf177
|
@ -1515,19 +1515,20 @@ struct inode *reiserfs_iget(struct super_block *s, const struct cpu_key *key)
|
||||||
return inode;
|
return inode;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct dentry *reiserfs_get_dentry(struct super_block *sb, void *vobjp)
|
static struct dentry *reiserfs_get_dentry(struct super_block *sb,
|
||||||
|
u32 objectid, u32 dir_id, u32 generation)
|
||||||
|
|
||||||
{
|
{
|
||||||
__u32 *data = vobjp;
|
|
||||||
struct cpu_key key;
|
struct cpu_key key;
|
||||||
struct dentry *result;
|
struct dentry *result;
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
|
|
||||||
key.on_disk_key.k_objectid = data[0];
|
key.on_disk_key.k_objectid = objectid;
|
||||||
key.on_disk_key.k_dir_id = data[1];
|
key.on_disk_key.k_dir_id = dir_id;
|
||||||
reiserfs_write_lock(sb);
|
reiserfs_write_lock(sb);
|
||||||
inode = reiserfs_iget(sb, &key);
|
inode = reiserfs_iget(sb, &key);
|
||||||
if (inode && !IS_ERR(inode) && data[2] != 0 &&
|
if (inode && !IS_ERR(inode) && generation != 0 &&
|
||||||
data[2] != inode->i_generation) {
|
generation != inode->i_generation) {
|
||||||
iput(inode);
|
iput(inode);
|
||||||
inode = NULL;
|
inode = NULL;
|
||||||
}
|
}
|
||||||
|
@ -1544,14 +1545,9 @@ struct dentry *reiserfs_get_dentry(struct super_block *sb, void *vobjp)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct dentry *reiserfs_decode_fh(struct super_block *sb, __u32 * data,
|
struct dentry *reiserfs_fh_to_dentry(struct super_block *sb, struct fid *fid,
|
||||||
int len, int fhtype,
|
int fh_len, int fh_type)
|
||||||
int (*acceptable) (void *contect,
|
|
||||||
struct dentry * de),
|
|
||||||
void *context)
|
|
||||||
{
|
{
|
||||||
__u32 obj[3], parent[3];
|
|
||||||
|
|
||||||
/* fhtype happens to reflect the number of u32s encoded.
|
/* fhtype happens to reflect the number of u32s encoded.
|
||||||
* due to a bug in earlier code, fhtype might indicate there
|
* due to a bug in earlier code, fhtype might indicate there
|
||||||
* are more u32s then actually fitted.
|
* are more u32s then actually fitted.
|
||||||
|
@ -1564,32 +1560,28 @@ struct dentry *reiserfs_decode_fh(struct super_block *sb, __u32 * data,
|
||||||
* 6 - as above plus generation of directory
|
* 6 - as above plus generation of directory
|
||||||
* 6 does not fit in NFSv2 handles
|
* 6 does not fit in NFSv2 handles
|
||||||
*/
|
*/
|
||||||
if (fhtype > len) {
|
if (fh_type > fh_len) {
|
||||||
if (fhtype != 6 || len != 5)
|
if (fh_type != 6 || fh_len != 5)
|
||||||
reiserfs_warning(sb,
|
reiserfs_warning(sb,
|
||||||
"nfsd/reiserfs, fhtype=%d, len=%d - odd",
|
"nfsd/reiserfs, fhtype=%d, len=%d - odd",
|
||||||
fhtype, len);
|
fh_type, fh_len);
|
||||||
fhtype = 5;
|
fh_type = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
obj[0] = data[0];
|
return reiserfs_get_dentry(sb, fid->raw[0], fid->raw[1],
|
||||||
obj[1] = data[1];
|
(fh_type == 3 || fh_type >= 5) ? fid->raw[2] : 0);
|
||||||
if (fhtype == 3 || fhtype >= 5)
|
}
|
||||||
obj[2] = data[2];
|
|
||||||
else
|
|
||||||
obj[2] = 0; /* generation number */
|
|
||||||
|
|
||||||
if (fhtype >= 4) {
|
struct dentry *reiserfs_fh_to_parent(struct super_block *sb, struct fid *fid,
|
||||||
parent[0] = data[fhtype >= 5 ? 3 : 2];
|
int fh_len, int fh_type)
|
||||||
parent[1] = data[fhtype >= 5 ? 4 : 3];
|
{
|
||||||
if (fhtype == 6)
|
if (fh_type < 4)
|
||||||
parent[2] = data[5];
|
return NULL;
|
||||||
else
|
|
||||||
parent[2] = 0;
|
return reiserfs_get_dentry(sb,
|
||||||
}
|
(fh_type >= 5) ? fid->raw[3] : fid->raw[2],
|
||||||
return sb->s_export_op->find_exported_dentry(sb, obj,
|
(fh_type >= 5) ? fid->raw[4] : fid->raw[3],
|
||||||
fhtype < 4 ? NULL : parent,
|
(fh_type == 6) ? fid->raw[5] : 0);
|
||||||
acceptable, context);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int reiserfs_encode_fh(struct dentry *dentry, __u32 * data, int *lenp,
|
int reiserfs_encode_fh(struct dentry *dentry, __u32 * data, int *lenp,
|
||||||
|
|
|
@ -663,9 +663,9 @@ static struct quotactl_ops reiserfs_qctl_operations = {
|
||||||
|
|
||||||
static struct export_operations reiserfs_export_ops = {
|
static struct export_operations reiserfs_export_ops = {
|
||||||
.encode_fh = reiserfs_encode_fh,
|
.encode_fh = reiserfs_encode_fh,
|
||||||
.decode_fh = reiserfs_decode_fh,
|
.fh_to_dentry = reiserfs_fh_to_dentry,
|
||||||
|
.fh_to_parent = reiserfs_fh_to_parent,
|
||||||
.get_parent = reiserfs_get_parent,
|
.get_parent = reiserfs_get_parent,
|
||||||
.get_dentry = reiserfs_get_dentry,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* this struct is used in reiserfs_getopt () for containing the value for those
|
/* this struct is used in reiserfs_getopt () for containing the value for those
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
#include <linux/reiserfs_fs_sb.h>
|
#include <linux/reiserfs_fs_sb.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
struct fid;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* include/linux/reiser_fs.h
|
* include/linux/reiser_fs.h
|
||||||
*
|
*
|
||||||
|
@ -1877,12 +1879,10 @@ void reiserfs_delete_inode(struct inode *inode);
|
||||||
int reiserfs_write_inode(struct inode *inode, int);
|
int reiserfs_write_inode(struct inode *inode, int);
|
||||||
int reiserfs_get_block(struct inode *inode, sector_t block,
|
int reiserfs_get_block(struct inode *inode, sector_t block,
|
||||||
struct buffer_head *bh_result, int create);
|
struct buffer_head *bh_result, int create);
|
||||||
struct dentry *reiserfs_get_dentry(struct super_block *, void *);
|
struct dentry *reiserfs_fh_to_dentry(struct super_block *sb, struct fid *fid,
|
||||||
struct dentry *reiserfs_decode_fh(struct super_block *sb, __u32 * data,
|
int fh_len, int fh_type);
|
||||||
int len, int fhtype,
|
struct dentry *reiserfs_fh_to_parent(struct super_block *sb, struct fid *fid,
|
||||||
int (*acceptable) (void *contect,
|
int fh_len, int fh_type);
|
||||||
struct dentry * de),
|
|
||||||
void *context);
|
|
||||||
int reiserfs_encode_fh(struct dentry *dentry, __u32 * data, int *lenp,
|
int reiserfs_encode_fh(struct dentry *dentry, __u32 * data, int *lenp,
|
||||||
int connectable);
|
int connectable);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue