[Cluster-devel] [GFS2 PATCH 5/6] gfs2: simplify the logic in gfs2_evict_inode

Bob Peterson rpeterso at redhat.com
Wed Sep 16 15:00:19 UTC 2020


Now that we've factored out the deleted and undeleted dinode cases
in gfs2_evict_inode, we can greatly simplify the logic. Now the function
is easy to read and understand.

Signed-off-by: Bob Peterson <rpeterso at redhat.com>
---
 fs/gfs2/super.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index 9fc4135a35c0..e07399110cd0 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -1496,16 +1496,11 @@ static void gfs2_evict_inode(struct inode *inode)
 	ret = evict_should_delete(inode, &gh);
 	if (ret == SHOULD_DEFER_EVICTION)
 		goto out;
-	if (ret == SHOULD_NOT_DELETE_DINODE)
-		goto out_truncate;
-
-	ret = evict_deleted_inode(inode);
-	goto out_unlock;
-
-out_truncate:
-	ret = evict_saved_inode(inode);
+	if (ret == SHOULD_DELETE_DINODE)
+		ret = evict_deleted_inode(inode);
+	else
+		ret = evict_saved_inode(inode);
 
-out_unlock:
 	if (gfs2_rs_active(&ip->i_res))
 		gfs2_rs_deltree(&ip->i_res);
 
-- 
2.26.2




More information about the Cluster-devel mailing list