gfs2: Rename dinode_demise to evict_behavior
[ Upstream commit c79ba4be351a06e0ac4c51143a83023bb37888d6 ] Rename enum dinode_demise to evict_behavior and its items SHOULD_DELETE_DINODE to EVICT_SHOULD_DELETE, SHOULD_NOT_DELETE_DINODE to EVICT_SHOULD_SKIP_DELETE, and SHOULD_DEFER_EVICTION to EVICT_SHOULD_DEFER_DELETE. In gfs2_evict_inode(), add a separate variable of type enum evict_behavior instead of implicitly casting to int. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> Stable-dep-of: 2c63986dd35f ("gfs2: deallocate inodes in gfs2_create_inode") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
862ca0b49f
commit
af2ce45c28
+19
-18
@@ -44,10 +44,10 @@
|
|||||||
#include "xattr.h"
|
#include "xattr.h"
|
||||||
#include "lops.h"
|
#include "lops.h"
|
||||||
|
|
||||||
enum dinode_demise {
|
enum evict_behavior {
|
||||||
SHOULD_DELETE_DINODE,
|
EVICT_SHOULD_DELETE,
|
||||||
SHOULD_NOT_DELETE_DINODE,
|
EVICT_SHOULD_SKIP_DELETE,
|
||||||
SHOULD_DEFER_EVICTION,
|
EVICT_SHOULD_DEFER_DELETE,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1315,8 +1315,8 @@ static bool gfs2_upgrade_iopen_glock(struct inode *inode)
|
|||||||
*
|
*
|
||||||
* Returns: the fate of the dinode
|
* Returns: the fate of the dinode
|
||||||
*/
|
*/
|
||||||
static enum dinode_demise evict_should_delete(struct inode *inode,
|
static enum evict_behavior evict_should_delete(struct inode *inode,
|
||||||
struct gfs2_holder *gh)
|
struct gfs2_holder *gh)
|
||||||
{
|
{
|
||||||
struct gfs2_inode *ip = GFS2_I(inode);
|
struct gfs2_inode *ip = GFS2_I(inode);
|
||||||
struct super_block *sb = inode->i_sb;
|
struct super_block *sb = inode->i_sb;
|
||||||
@@ -1327,11 +1327,11 @@ static enum dinode_demise evict_should_delete(struct inode *inode,
|
|||||||
goto should_delete;
|
goto should_delete;
|
||||||
|
|
||||||
if (test_bit(GIF_DEFER_DELETE, &ip->i_flags))
|
if (test_bit(GIF_DEFER_DELETE, &ip->i_flags))
|
||||||
return SHOULD_DEFER_EVICTION;
|
return EVICT_SHOULD_DEFER_DELETE;
|
||||||
|
|
||||||
/* Deletes should never happen under memory pressure anymore. */
|
/* Deletes should never happen under memory pressure anymore. */
|
||||||
if (WARN_ON_ONCE(current->flags & PF_MEMALLOC))
|
if (WARN_ON_ONCE(current->flags & PF_MEMALLOC))
|
||||||
return SHOULD_DEFER_EVICTION;
|
return EVICT_SHOULD_DEFER_DELETE;
|
||||||
|
|
||||||
/* Must not read inode block until block type has been verified */
|
/* Must not read inode block until block type has been verified */
|
||||||
ret = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, GL_SKIP, gh);
|
ret = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, GL_SKIP, gh);
|
||||||
@@ -1339,34 +1339,34 @@ static enum dinode_demise evict_should_delete(struct inode *inode,
|
|||||||
glock_clear_object(ip->i_iopen_gh.gh_gl, ip);
|
glock_clear_object(ip->i_iopen_gh.gh_gl, ip);
|
||||||
ip->i_iopen_gh.gh_flags |= GL_NOCACHE;
|
ip->i_iopen_gh.gh_flags |= GL_NOCACHE;
|
||||||
gfs2_glock_dq_uninit(&ip->i_iopen_gh);
|
gfs2_glock_dq_uninit(&ip->i_iopen_gh);
|
||||||
return SHOULD_DEFER_EVICTION;
|
return EVICT_SHOULD_DEFER_DELETE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gfs2_inode_already_deleted(ip->i_gl, ip->i_no_formal_ino))
|
if (gfs2_inode_already_deleted(ip->i_gl, ip->i_no_formal_ino))
|
||||||
return SHOULD_NOT_DELETE_DINODE;
|
return EVICT_SHOULD_SKIP_DELETE;
|
||||||
ret = gfs2_check_blk_type(sdp, ip->i_no_addr, GFS2_BLKST_UNLINKED);
|
ret = gfs2_check_blk_type(sdp, ip->i_no_addr, GFS2_BLKST_UNLINKED);
|
||||||
if (ret)
|
if (ret)
|
||||||
return SHOULD_NOT_DELETE_DINODE;
|
return EVICT_SHOULD_SKIP_DELETE;
|
||||||
|
|
||||||
ret = gfs2_instantiate(gh);
|
ret = gfs2_instantiate(gh);
|
||||||
if (ret)
|
if (ret)
|
||||||
return SHOULD_NOT_DELETE_DINODE;
|
return EVICT_SHOULD_SKIP_DELETE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The inode may have been recreated in the meantime.
|
* The inode may have been recreated in the meantime.
|
||||||
*/
|
*/
|
||||||
if (inode->i_nlink)
|
if (inode->i_nlink)
|
||||||
return SHOULD_NOT_DELETE_DINODE;
|
return EVICT_SHOULD_SKIP_DELETE;
|
||||||
|
|
||||||
should_delete:
|
should_delete:
|
||||||
if (gfs2_holder_initialized(&ip->i_iopen_gh) &&
|
if (gfs2_holder_initialized(&ip->i_iopen_gh) &&
|
||||||
test_bit(HIF_HOLDER, &ip->i_iopen_gh.gh_iflags)) {
|
test_bit(HIF_HOLDER, &ip->i_iopen_gh.gh_iflags)) {
|
||||||
if (!gfs2_upgrade_iopen_glock(inode)) {
|
if (!gfs2_upgrade_iopen_glock(inode)) {
|
||||||
gfs2_holder_uninit(&ip->i_iopen_gh);
|
gfs2_holder_uninit(&ip->i_iopen_gh);
|
||||||
return SHOULD_NOT_DELETE_DINODE;
|
return EVICT_SHOULD_SKIP_DELETE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return SHOULD_DELETE_DINODE;
|
return EVICT_SHOULD_DELETE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1477,6 +1477,7 @@ static void gfs2_evict_inode(struct inode *inode)
|
|||||||
struct gfs2_sbd *sdp = sb->s_fs_info;
|
struct gfs2_sbd *sdp = sb->s_fs_info;
|
||||||
struct gfs2_inode *ip = GFS2_I(inode);
|
struct gfs2_inode *ip = GFS2_I(inode);
|
||||||
struct gfs2_holder gh;
|
struct gfs2_holder gh;
|
||||||
|
enum evict_behavior behavior;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (inode->i_nlink || sb_rdonly(sb) || !ip->i_no_addr)
|
if (inode->i_nlink || sb_rdonly(sb) || !ip->i_no_addr)
|
||||||
@@ -1491,10 +1492,10 @@ static void gfs2_evict_inode(struct inode *inode)
|
|||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
gfs2_holder_mark_uninitialized(&gh);
|
gfs2_holder_mark_uninitialized(&gh);
|
||||||
ret = evict_should_delete(inode, &gh);
|
behavior = evict_should_delete(inode, &gh);
|
||||||
if (ret == SHOULD_DEFER_EVICTION)
|
if (behavior == EVICT_SHOULD_DEFER_DELETE)
|
||||||
goto out;
|
goto out;
|
||||||
if (ret == SHOULD_DELETE_DINODE)
|
if (behavior == EVICT_SHOULD_DELETE)
|
||||||
ret = evict_unlinked_inode(inode);
|
ret = evict_unlinked_inode(inode);
|
||||||
else
|
else
|
||||||
ret = evict_linked_inode(inode);
|
ret = evict_linked_inode(inode);
|
||||||
|
|||||||
Reference in New Issue
Block a user