Skip to content

Commit c79ba4b

Browse files
author
Andreas Gruenbacher
committed
gfs2: Rename dinode_demise to evict_behavior
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 <[email protected]>
1 parent 9fb794a commit c79ba4b

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

fs/gfs2/super.c

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@
4444
#include "xattr.h"
4545
#include "lops.h"
4646

47-
enum dinode_demise {
48-
SHOULD_DELETE_DINODE,
49-
SHOULD_NOT_DELETE_DINODE,
50-
SHOULD_DEFER_EVICTION,
47+
enum evict_behavior {
48+
EVICT_SHOULD_DELETE,
49+
EVICT_SHOULD_SKIP_DELETE,
50+
EVICT_SHOULD_DEFER_DELETE,
5151
};
5252

5353
/**
@@ -1313,8 +1313,8 @@ static bool gfs2_upgrade_iopen_glock(struct inode *inode)
13131313
*
13141314
* Returns: the fate of the dinode
13151315
*/
1316-
static enum dinode_demise evict_should_delete(struct inode *inode,
1317-
struct gfs2_holder *gh)
1316+
static enum evict_behavior evict_should_delete(struct inode *inode,
1317+
struct gfs2_holder *gh)
13181318
{
13191319
struct gfs2_inode *ip = GFS2_I(inode);
13201320
struct super_block *sb = inode->i_sb;
@@ -1325,46 +1325,46 @@ static enum dinode_demise evict_should_delete(struct inode *inode,
13251325
goto should_delete;
13261326

13271327
if (test_bit(GIF_DEFER_DELETE, &ip->i_flags))
1328-
return SHOULD_DEFER_EVICTION;
1328+
return EVICT_SHOULD_DEFER_DELETE;
13291329

13301330
/* Deletes should never happen under memory pressure anymore. */
13311331
if (WARN_ON_ONCE(current->flags & PF_MEMALLOC))
1332-
return SHOULD_DEFER_EVICTION;
1332+
return EVICT_SHOULD_DEFER_DELETE;
13331333

13341334
/* Must not read inode block until block type has been verified */
13351335
ret = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, GL_SKIP, gh);
13361336
if (unlikely(ret)) {
13371337
glock_clear_object(ip->i_iopen_gh.gh_gl, ip);
13381338
ip->i_iopen_gh.gh_flags |= GL_NOCACHE;
13391339
gfs2_glock_dq_uninit(&ip->i_iopen_gh);
1340-
return SHOULD_DEFER_EVICTION;
1340+
return EVICT_SHOULD_DEFER_DELETE;
13411341
}
13421342

13431343
if (gfs2_inode_already_deleted(ip->i_gl, ip->i_no_formal_ino))
1344-
return SHOULD_NOT_DELETE_DINODE;
1344+
return EVICT_SHOULD_SKIP_DELETE;
13451345
ret = gfs2_check_blk_type(sdp, ip->i_no_addr, GFS2_BLKST_UNLINKED);
13461346
if (ret)
1347-
return SHOULD_NOT_DELETE_DINODE;
1347+
return EVICT_SHOULD_SKIP_DELETE;
13481348

13491349
ret = gfs2_instantiate(gh);
13501350
if (ret)
1351-
return SHOULD_NOT_DELETE_DINODE;
1351+
return EVICT_SHOULD_SKIP_DELETE;
13521352

13531353
/*
13541354
* The inode may have been recreated in the meantime.
13551355
*/
13561356
if (inode->i_nlink)
1357-
return SHOULD_NOT_DELETE_DINODE;
1357+
return EVICT_SHOULD_SKIP_DELETE;
13581358

13591359
should_delete:
13601360
if (gfs2_holder_initialized(&ip->i_iopen_gh) &&
13611361
test_bit(HIF_HOLDER, &ip->i_iopen_gh.gh_iflags)) {
13621362
if (!gfs2_upgrade_iopen_glock(inode)) {
13631363
gfs2_holder_uninit(&ip->i_iopen_gh);
1364-
return SHOULD_NOT_DELETE_DINODE;
1364+
return EVICT_SHOULD_SKIP_DELETE;
13651365
}
13661366
}
1367-
return SHOULD_DELETE_DINODE;
1367+
return EVICT_SHOULD_DELETE;
13681368
}
13691369

13701370
/**
@@ -1475,6 +1475,7 @@ static void gfs2_evict_inode(struct inode *inode)
14751475
struct gfs2_sbd *sdp = sb->s_fs_info;
14761476
struct gfs2_inode *ip = GFS2_I(inode);
14771477
struct gfs2_holder gh;
1478+
enum evict_behavior behavior;
14781479
int ret;
14791480

14801481
if (inode->i_nlink || sb_rdonly(sb) || !ip->i_no_addr)
@@ -1489,10 +1490,10 @@ static void gfs2_evict_inode(struct inode *inode)
14891490
goto out;
14901491

14911492
gfs2_holder_mark_uninitialized(&gh);
1492-
ret = evict_should_delete(inode, &gh);
1493-
if (ret == SHOULD_DEFER_EVICTION)
1493+
behavior = evict_should_delete(inode, &gh);
1494+
if (behavior == EVICT_SHOULD_DEFER_DELETE)
14941495
goto out;
1495-
if (ret == SHOULD_DELETE_DINODE)
1496+
if (behavior == EVICT_SHOULD_DELETE)
14961497
ret = evict_unlinked_inode(inode);
14971498
else
14981499
ret = evict_linked_inode(inode);

0 commit comments

Comments
 (0)