mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-01-18 20:06:12 +07:00
shmem: new export ops
I'm not sure what people were thinking when adding support to export tmpfs, but here's the conversion anyway: Signed-off-by: Christoph Hellwig <hch@lst.de> Cc: Neil Brown <neilb@suse.de> Cc: "J. Bruce Fields" <bfields@fieldses.org> Cc: Hugh Dickins <hugh@veritas.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
905251a02e
commit
480b116c98
35
mm/shmem.c
35
mm/shmem.c
@ -2020,33 +2020,25 @@ static int shmem_match(struct inode *ino, void *vfh)
|
|||||||
return ino->i_ino == inum && fh[0] == ino->i_generation;
|
return ino->i_ino == inum && fh[0] == ino->i_generation;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct dentry *shmem_get_dentry(struct super_block *sb, void *vfh)
|
static struct dentry *shmem_fh_to_dentry(struct super_block *sb,
|
||||||
|
struct fid *fid, int fh_len, int fh_type)
|
||||||
{
|
{
|
||||||
struct dentry *de = NULL;
|
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
__u32 *fh = vfh;
|
struct dentry *dentry = NULL;
|
||||||
__u64 inum = fh[2];
|
u64 inum = fid->raw[2];
|
||||||
inum = (inum << 32) | fh[1];
|
inum = (inum << 32) | fid->raw[1];
|
||||||
|
|
||||||
inode = ilookup5(sb, (unsigned long)(inum+fh[0]), shmem_match, vfh);
|
if (fh_len < 3)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
inode = ilookup5(sb, (unsigned long)(inum + fid->raw[0]),
|
||||||
|
shmem_match, fid->raw);
|
||||||
if (inode) {
|
if (inode) {
|
||||||
de = d_find_alias(inode);
|
dentry = d_find_alias(inode);
|
||||||
iput(inode);
|
iput(inode);
|
||||||
}
|
}
|
||||||
|
|
||||||
return de? de: ERR_PTR(-ESTALE);
|
return dentry;
|
||||||
}
|
|
||||||
|
|
||||||
static struct dentry *shmem_decode_fh(struct super_block *sb, __u32 *fh,
|
|
||||||
int len, int type,
|
|
||||||
int (*acceptable)(void *context, struct dentry *de),
|
|
||||||
void *context)
|
|
||||||
{
|
|
||||||
if (len < 3)
|
|
||||||
return ERR_PTR(-ESTALE);
|
|
||||||
|
|
||||||
return sb->s_export_op->find_exported_dentry(sb, fh, NULL, acceptable,
|
|
||||||
context);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int shmem_encode_fh(struct dentry *dentry, __u32 *fh, int *len,
|
static int shmem_encode_fh(struct dentry *dentry, __u32 *fh, int *len,
|
||||||
@ -2081,9 +2073,8 @@ static int shmem_encode_fh(struct dentry *dentry, __u32 *fh, int *len,
|
|||||||
|
|
||||||
static struct export_operations shmem_export_ops = {
|
static struct export_operations shmem_export_ops = {
|
||||||
.get_parent = shmem_get_parent,
|
.get_parent = shmem_get_parent,
|
||||||
.get_dentry = shmem_get_dentry,
|
|
||||||
.encode_fh = shmem_encode_fh,
|
.encode_fh = shmem_encode_fh,
|
||||||
.decode_fh = shmem_decode_fh,
|
.fh_to_dentry = shmem_fh_to_dentry,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int shmem_parse_options(char *options, int *mode, uid_t *uid,
|
static int shmem_parse_options(char *options, int *mode, uid_t *uid,
|
||||||
|
Loading…
Reference in New Issue
Block a user