mirror of
https://kernel.googlesource.com/pub/scm/linux/kernel/git/stable/linux-stable.git
synced 2025-10-30 22:47:06 +10:00
erofs: clean up erofs_iget()
isdir indicated REQ_META|REQ_PRIO which no longer works now. Get rid of isdir entirely. Link: https://lore.kernel.org/r/20220927063607.54832-2-hsiangkao@linux.alibaba.com Reviewed-by: Yue Hu <huyue2@coolpad.com> Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
This commit is contained in:
parent
53a7f9961c
commit
312fe643ad
@ -241,7 +241,7 @@ static int erofs_fill_symlink(struct inode *inode, void *kaddr,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int erofs_fill_inode(struct inode *inode, int isdir)
|
static int erofs_fill_inode(struct inode *inode)
|
||||||
{
|
{
|
||||||
struct erofs_inode *vi = EROFS_I(inode);
|
struct erofs_inode *vi = EROFS_I(inode);
|
||||||
struct erofs_buf buf = __EROFS_BUF_INITIALIZER;
|
struct erofs_buf buf = __EROFS_BUF_INITIALIZER;
|
||||||
@ -249,7 +249,7 @@ static int erofs_fill_inode(struct inode *inode, int isdir)
|
|||||||
unsigned int ofs;
|
unsigned int ofs;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
trace_erofs_fill_inode(inode, isdir);
|
trace_erofs_fill_inode(inode);
|
||||||
|
|
||||||
/* read inode base data from disk */
|
/* read inode base data from disk */
|
||||||
kaddr = erofs_read_inode(&buf, inode, &ofs);
|
kaddr = erofs_read_inode(&buf, inode, &ofs);
|
||||||
@ -324,21 +324,13 @@ static int erofs_iget_set_actor(struct inode *inode, void *opaque)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline struct inode *erofs_iget_locked(struct super_block *sb,
|
struct inode *erofs_iget(struct super_block *sb, erofs_nid_t nid)
|
||||||
erofs_nid_t nid)
|
|
||||||
{
|
{
|
||||||
const unsigned long hashval = erofs_inode_hash(nid);
|
const unsigned long hashval = erofs_inode_hash(nid);
|
||||||
|
struct inode *inode;
|
||||||
|
|
||||||
return iget5_locked(sb, hashval, erofs_ilookup_test_actor,
|
inode = iget5_locked(sb, hashval, erofs_ilookup_test_actor,
|
||||||
erofs_iget_set_actor, &nid);
|
erofs_iget_set_actor, &nid);
|
||||||
}
|
|
||||||
|
|
||||||
struct inode *erofs_iget(struct super_block *sb,
|
|
||||||
erofs_nid_t nid,
|
|
||||||
bool isdir)
|
|
||||||
{
|
|
||||||
struct inode *inode = erofs_iget_locked(sb, nid);
|
|
||||||
|
|
||||||
if (!inode)
|
if (!inode)
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
||||||
@ -348,10 +340,10 @@ struct inode *erofs_iget(struct super_block *sb,
|
|||||||
|
|
||||||
vi->nid = nid;
|
vi->nid = nid;
|
||||||
|
|
||||||
err = erofs_fill_inode(inode, isdir);
|
err = erofs_fill_inode(inode);
|
||||||
if (!err)
|
if (!err) {
|
||||||
unlock_new_inode(inode);
|
unlock_new_inode(inode);
|
||||||
else {
|
} else {
|
||||||
iget_failed(inode);
|
iget_failed(inode);
|
||||||
inode = ERR_PTR(err);
|
inode = ERR_PTR(err);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -492,7 +492,7 @@ extern const struct inode_operations erofs_generic_iops;
|
|||||||
extern const struct inode_operations erofs_symlink_iops;
|
extern const struct inode_operations erofs_symlink_iops;
|
||||||
extern const struct inode_operations erofs_fast_symlink_iops;
|
extern const struct inode_operations erofs_fast_symlink_iops;
|
||||||
|
|
||||||
struct inode *erofs_iget(struct super_block *sb, erofs_nid_t nid, bool dir);
|
struct inode *erofs_iget(struct super_block *sb, erofs_nid_t nid);
|
||||||
int erofs_getattr(struct user_namespace *mnt_userns, const struct path *path,
|
int erofs_getattr(struct user_namespace *mnt_userns, const struct path *path,
|
||||||
struct kstat *stat, u32 request_mask,
|
struct kstat *stat, u32 request_mask,
|
||||||
unsigned int query_flags);
|
unsigned int query_flags);
|
||||||
|
|||||||
@ -219,7 +219,7 @@ static struct dentry *erofs_lookup(struct inode *dir, struct dentry *dentry,
|
|||||||
} else {
|
} else {
|
||||||
erofs_dbg("%s, %pd (nid %llu) found, d_type %u", __func__,
|
erofs_dbg("%s, %pd (nid %llu) found, d_type %u", __func__,
|
||||||
dentry, nid, d_type);
|
dentry, nid, d_type);
|
||||||
inode = erofs_iget(dir->i_sb, nid, d_type == FT_DIR);
|
inode = erofs_iget(dir->i_sb, nid);
|
||||||
}
|
}
|
||||||
return d_splice_alias(inode, dentry);
|
return d_splice_alias(inode, dentry);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -385,7 +385,7 @@ static int erofs_read_superblock(struct super_block *sb)
|
|||||||
sbi->packed_inode = NULL;
|
sbi->packed_inode = NULL;
|
||||||
if (erofs_sb_has_fragments(sbi) && dsb->packed_nid) {
|
if (erofs_sb_has_fragments(sbi) && dsb->packed_nid) {
|
||||||
sbi->packed_inode =
|
sbi->packed_inode =
|
||||||
erofs_iget(sb, le64_to_cpu(dsb->packed_nid), false);
|
erofs_iget(sb, le64_to_cpu(dsb->packed_nid));
|
||||||
if (IS_ERR(sbi->packed_inode)) {
|
if (IS_ERR(sbi->packed_inode)) {
|
||||||
ret = PTR_ERR(sbi->packed_inode);
|
ret = PTR_ERR(sbi->packed_inode);
|
||||||
goto out;
|
goto out;
|
||||||
@ -668,7 +668,7 @@ static int erofs_init_managed_cache(struct super_block *sb) { return 0; }
|
|||||||
static struct inode *erofs_nfs_get_inode(struct super_block *sb,
|
static struct inode *erofs_nfs_get_inode(struct super_block *sb,
|
||||||
u64 ino, u32 generation)
|
u64 ino, u32 generation)
|
||||||
{
|
{
|
||||||
return erofs_iget(sb, ino, false);
|
return erofs_iget(sb, ino);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct dentry *erofs_fh_to_dentry(struct super_block *sb,
|
static struct dentry *erofs_fh_to_dentry(struct super_block *sb,
|
||||||
@ -694,7 +694,7 @@ static struct dentry *erofs_get_parent(struct dentry *child)
|
|||||||
err = erofs_namei(d_inode(child), &dotdot_name, &nid, &d_type);
|
err = erofs_namei(d_inode(child), &dotdot_name, &nid, &d_type);
|
||||||
if (err)
|
if (err)
|
||||||
return ERR_PTR(err);
|
return ERR_PTR(err);
|
||||||
return d_obtain_alias(erofs_iget(child->d_sb, nid, d_type == FT_DIR));
|
return d_obtain_alias(erofs_iget(child->d_sb, nid));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct export_operations erofs_export_ops = {
|
static const struct export_operations erofs_export_ops = {
|
||||||
@ -782,7 +782,7 @@ static int erofs_fc_fill_super(struct super_block *sb, struct fs_context *fc)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* get the root inode */
|
/* get the root inode */
|
||||||
inode = erofs_iget(sb, ROOT_NID(sbi), true);
|
inode = erofs_iget(sb, ROOT_NID(sbi));
|
||||||
if (IS_ERR(inode))
|
if (IS_ERR(inode))
|
||||||
return PTR_ERR(inode);
|
return PTR_ERR(inode);
|
||||||
|
|
||||||
|
|||||||
@ -53,15 +53,14 @@ TRACE_EVENT(erofs_lookup,
|
|||||||
);
|
);
|
||||||
|
|
||||||
TRACE_EVENT(erofs_fill_inode,
|
TRACE_EVENT(erofs_fill_inode,
|
||||||
TP_PROTO(struct inode *inode, int isdir),
|
TP_PROTO(struct inode *inode),
|
||||||
TP_ARGS(inode, isdir),
|
TP_ARGS(inode),
|
||||||
|
|
||||||
TP_STRUCT__entry(
|
TP_STRUCT__entry(
|
||||||
__field(dev_t, dev )
|
__field(dev_t, dev )
|
||||||
__field(erofs_nid_t, nid )
|
__field(erofs_nid_t, nid )
|
||||||
__field(erofs_blk_t, blkaddr )
|
__field(erofs_blk_t, blkaddr )
|
||||||
__field(unsigned int, ofs )
|
__field(unsigned int, ofs )
|
||||||
__field(int, isdir )
|
|
||||||
),
|
),
|
||||||
|
|
||||||
TP_fast_assign(
|
TP_fast_assign(
|
||||||
@ -69,13 +68,11 @@ TRACE_EVENT(erofs_fill_inode,
|
|||||||
__entry->nid = EROFS_I(inode)->nid;
|
__entry->nid = EROFS_I(inode)->nid;
|
||||||
__entry->blkaddr = erofs_blknr(iloc(EROFS_I_SB(inode), __entry->nid));
|
__entry->blkaddr = erofs_blknr(iloc(EROFS_I_SB(inode), __entry->nid));
|
||||||
__entry->ofs = erofs_blkoff(iloc(EROFS_I_SB(inode), __entry->nid));
|
__entry->ofs = erofs_blkoff(iloc(EROFS_I_SB(inode), __entry->nid));
|
||||||
__entry->isdir = isdir;
|
|
||||||
),
|
),
|
||||||
|
|
||||||
TP_printk("dev = (%d,%d), nid = %llu, blkaddr %u ofs %u, isdir %d",
|
TP_printk("dev = (%d,%d), nid = %llu, blkaddr %u ofs %u",
|
||||||
show_dev_nid(__entry),
|
show_dev_nid(__entry),
|
||||||
__entry->blkaddr, __entry->ofs,
|
__entry->blkaddr, __entry->ofs)
|
||||||
__entry->isdir)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
TRACE_EVENT(erofs_readpage,
|
TRACE_EVENT(erofs_readpage,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user