mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 04:20:53 +07:00
ceph: switch to use of ->d_init()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
18fc8abdb7
commit
ad5cb123fd
@ -32,33 +32,19 @@ const struct dentry_operations ceph_dentry_ops;
|
||||
/*
|
||||
* Initialize ceph dentry state.
|
||||
*/
|
||||
int ceph_init_dentry(struct dentry *dentry)
|
||||
static int ceph_d_init(struct dentry *dentry)
|
||||
{
|
||||
struct ceph_dentry_info *di;
|
||||
|
||||
if (dentry->d_fsdata)
|
||||
return 0;
|
||||
|
||||
di = kmem_cache_zalloc(ceph_dentry_cachep, GFP_KERNEL);
|
||||
if (!di)
|
||||
return -ENOMEM; /* oh well */
|
||||
|
||||
spin_lock(&dentry->d_lock);
|
||||
if (dentry->d_fsdata) {
|
||||
/* lost a race */
|
||||
kmem_cache_free(ceph_dentry_cachep, di);
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
di->dentry = dentry;
|
||||
di->lease_session = NULL;
|
||||
di->time = jiffies;
|
||||
/* avoid reordering d_fsdata setup so that the check above is safe */
|
||||
smp_mb();
|
||||
dentry->d_fsdata = di;
|
||||
ceph_dentry_lru_add(dentry);
|
||||
out_unlock:
|
||||
spin_unlock(&dentry->d_lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -730,10 +716,6 @@ static struct dentry *ceph_lookup(struct inode *dir, struct dentry *dentry,
|
||||
if (dentry->d_name.len > NAME_MAX)
|
||||
return ERR_PTR(-ENAMETOOLONG);
|
||||
|
||||
err = ceph_init_dentry(dentry);
|
||||
if (err < 0)
|
||||
return ERR_PTR(err);
|
||||
|
||||
/* can we conclude ENOENT locally? */
|
||||
if (d_really_is_negative(dentry)) {
|
||||
struct ceph_inode_info *ci = ceph_inode(dir);
|
||||
@ -1503,4 +1485,5 @@ const struct dentry_operations ceph_dentry_ops = {
|
||||
.d_revalidate = ceph_d_revalidate,
|
||||
.d_release = ceph_d_release,
|
||||
.d_prune = ceph_d_prune,
|
||||
.d_init = ceph_d_init,
|
||||
};
|
||||
|
@ -62,7 +62,6 @@ static struct dentry *__fh_to_dentry(struct super_block *sb, u64 ino)
|
||||
{
|
||||
struct ceph_mds_client *mdsc = ceph_sb_to_client(sb)->mdsc;
|
||||
struct inode *inode;
|
||||
struct dentry *dentry;
|
||||
struct ceph_vino vino;
|
||||
int err;
|
||||
|
||||
@ -94,16 +93,7 @@ static struct dentry *__fh_to_dentry(struct super_block *sb, u64 ino)
|
||||
return ERR_PTR(-ESTALE);
|
||||
}
|
||||
|
||||
dentry = d_obtain_alias(inode);
|
||||
if (IS_ERR(dentry))
|
||||
return dentry;
|
||||
err = ceph_init_dentry(dentry);
|
||||
if (err < 0) {
|
||||
dput(dentry);
|
||||
return ERR_PTR(err);
|
||||
}
|
||||
dout("__fh_to_dentry %llx %p dentry %p\n", ino, inode, dentry);
|
||||
return dentry;
|
||||
return d_obtain_alias(inode);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -131,7 +121,6 @@ static struct dentry *__get_parent(struct super_block *sb,
|
||||
struct ceph_mds_client *mdsc = ceph_sb_to_client(sb)->mdsc;
|
||||
struct ceph_mds_request *req;
|
||||
struct inode *inode;
|
||||
struct dentry *dentry;
|
||||
int mask;
|
||||
int err;
|
||||
|
||||
@ -164,18 +153,7 @@ static struct dentry *__get_parent(struct super_block *sb,
|
||||
if (!inode)
|
||||
return ERR_PTR(-ENOENT);
|
||||
|
||||
dentry = d_obtain_alias(inode);
|
||||
if (IS_ERR(dentry))
|
||||
return dentry;
|
||||
err = ceph_init_dentry(dentry);
|
||||
if (err < 0) {
|
||||
dput(dentry);
|
||||
return ERR_PTR(err);
|
||||
}
|
||||
dout("__get_parent ino %llx parent %p ino %llx.%llx\n",
|
||||
child ? ceph_ino(d_inode(child)) : ino,
|
||||
dentry, ceph_vinop(inode));
|
||||
return dentry;
|
||||
return d_obtain_alias(inode);
|
||||
}
|
||||
|
||||
static struct dentry *ceph_get_parent(struct dentry *child)
|
||||
|
@ -351,10 +351,6 @@ int ceph_atomic_open(struct inode *dir, struct dentry *dentry,
|
||||
if (dentry->d_name.len > NAME_MAX)
|
||||
return -ENAMETOOLONG;
|
||||
|
||||
err = ceph_init_dentry(dentry);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
if (flags & O_CREAT) {
|
||||
err = ceph_pre_init_acls(dir, &mode, &acls);
|
||||
if (err < 0)
|
||||
|
@ -1203,12 +1203,7 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req,
|
||||
err = -ENOMEM;
|
||||
goto done;
|
||||
}
|
||||
err = ceph_init_dentry(dn);
|
||||
if (err < 0) {
|
||||
dput(dn);
|
||||
dput(parent);
|
||||
goto done;
|
||||
}
|
||||
err = 0;
|
||||
} else if (d_really_is_positive(dn) &&
|
||||
(ceph_ino(d_inode(dn)) != vino.ino ||
|
||||
ceph_snap(d_inode(dn)) != vino.snap)) {
|
||||
@ -1561,12 +1556,6 @@ int ceph_readdir_prepopulate(struct ceph_mds_request *req,
|
||||
err = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
ret = ceph_init_dentry(dn);
|
||||
if (ret < 0) {
|
||||
dput(dn);
|
||||
err = ret;
|
||||
goto out;
|
||||
}
|
||||
} else if (d_really_is_positive(dn) &&
|
||||
(ceph_ino(d_inode(dn)) != vino.ino ||
|
||||
ceph_snap(d_inode(dn)) != vino.snap)) {
|
||||
|
@ -795,7 +795,6 @@ static struct dentry *open_root_dentry(struct ceph_fs_client *fsc,
|
||||
root = ERR_PTR(-ENOMEM);
|
||||
goto out;
|
||||
}
|
||||
ceph_init_dentry(root);
|
||||
dout("open_root_inode success, root dentry is %p\n", root);
|
||||
} else {
|
||||
root = ERR_PTR(err);
|
||||
|
@ -950,13 +950,6 @@ extern void ceph_invalidate_dentry_lease(struct dentry *dentry);
|
||||
extern unsigned ceph_dentry_hash(struct inode *dir, struct dentry *dn);
|
||||
extern void ceph_readdir_cache_release(struct ceph_readdir_cache_control *ctl);
|
||||
|
||||
/*
|
||||
* our d_ops vary depending on whether the inode is live,
|
||||
* snapshotted (read-only), or a virtual ".snap" directory.
|
||||
*/
|
||||
int ceph_init_dentry(struct dentry *dentry);
|
||||
|
||||
|
||||
/* ioctl.c */
|
||||
extern long ceph_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user