gfs2: Minor gfs2_lookup_by_inum cleanup
Use a zero no_formal_ino instead of a NULL pointer to indicate that any inode generation number will qualify: a valid inode never has a zero no_formal_ino. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
This commit is contained in:
parent
9e73330f29
commit
6bdcadea75
|
@ -134,7 +134,9 @@ static struct dentry *gfs2_get_dentry(struct super_block *sb,
|
||||||
struct gfs2_sbd *sdp = sb->s_fs_info;
|
struct gfs2_sbd *sdp = sb->s_fs_info;
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
|
|
||||||
inode = gfs2_lookup_by_inum(sdp, inum->no_addr, &inum->no_formal_ino,
|
if (!inum->no_formal_ino)
|
||||||
|
return ERR_PTR(-ESTALE);
|
||||||
|
inode = gfs2_lookup_by_inum(sdp, inum->no_addr, inum->no_formal_ino,
|
||||||
GFS2_BLKST_DINODE);
|
GFS2_BLKST_DINODE);
|
||||||
if (IS_ERR(inode))
|
if (IS_ERR(inode))
|
||||||
return ERR_CAST(inode);
|
return ERR_CAST(inode);
|
||||||
|
|
|
@ -843,7 +843,7 @@ static void delete_work_func(struct work_struct *work)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inode = gfs2_lookup_by_inum(sdp, no_addr, NULL, GFS2_BLKST_UNLINKED);
|
inode = gfs2_lookup_by_inum(sdp, no_addr, 0, GFS2_BLKST_UNLINKED);
|
||||||
if (!IS_ERR_OR_NULL(inode)) {
|
if (!IS_ERR_OR_NULL(inode)) {
|
||||||
d_prune_aliases(inode);
|
d_prune_aliases(inode);
|
||||||
iput(inode);
|
iput(inode);
|
||||||
|
|
|
@ -207,8 +207,15 @@ fail:
|
||||||
return ERR_PTR(error);
|
return ERR_PTR(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gfs2_lookup_by_inum - look up an inode by inode number
|
||||||
|
* @sdp: The super block
|
||||||
|
* @no_addr: The inode number
|
||||||
|
* @no_formal_ino: The inode generation number (0 for any)
|
||||||
|
* @blktype: Requested block type (see gfs2_inode_lookup)
|
||||||
|
*/
|
||||||
struct inode *gfs2_lookup_by_inum(struct gfs2_sbd *sdp, u64 no_addr,
|
struct inode *gfs2_lookup_by_inum(struct gfs2_sbd *sdp, u64 no_addr,
|
||||||
u64 *no_formal_ino, unsigned int blktype)
|
u64 no_formal_ino, unsigned int blktype)
|
||||||
{
|
{
|
||||||
struct super_block *sb = sdp->sd_vfs;
|
struct super_block *sb = sdp->sd_vfs;
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
|
@ -221,7 +228,7 @@ struct inode *gfs2_lookup_by_inum(struct gfs2_sbd *sdp, u64 no_addr,
|
||||||
/* Two extra checks for NFS only */
|
/* Two extra checks for NFS only */
|
||||||
if (no_formal_ino) {
|
if (no_formal_ino) {
|
||||||
error = -ESTALE;
|
error = -ESTALE;
|
||||||
if (GFS2_I(inode)->i_no_formal_ino != *no_formal_ino)
|
if (GFS2_I(inode)->i_no_formal_ino != no_formal_ino)
|
||||||
goto fail_iput;
|
goto fail_iput;
|
||||||
|
|
||||||
error = -EIO;
|
error = -EIO;
|
||||||
|
|
|
@ -92,7 +92,7 @@ extern struct inode *gfs2_inode_lookup(struct super_block *sb, unsigned type,
|
||||||
u64 no_addr, u64 no_formal_ino,
|
u64 no_addr, u64 no_formal_ino,
|
||||||
unsigned int blktype);
|
unsigned int blktype);
|
||||||
extern struct inode *gfs2_lookup_by_inum(struct gfs2_sbd *sdp, u64 no_addr,
|
extern struct inode *gfs2_lookup_by_inum(struct gfs2_sbd *sdp, u64 no_addr,
|
||||||
u64 *no_formal_ino,
|
u64 no_formal_ino,
|
||||||
unsigned int blktype);
|
unsigned int blktype);
|
||||||
|
|
||||||
extern int gfs2_inode_refresh(struct gfs2_inode *ip);
|
extern int gfs2_inode_refresh(struct gfs2_inode *ip);
|
||||||
|
|
Loading…
Reference in New Issue