[Cluster-devel] [GFS2 PATCH 1/3] GFS2: Eliminate a goto from function gfs2_inplace_reserve

Bob Peterson rpeterso at redhat.com
Mon Sep 16 20:10:42 UTC 2013


This patch just refactors function gfs2_inplace_reserve in order to
eliminate a goto. This is mainly just preparation for a future
patch that will simplify the logic and improve performance.
---
 fs/gfs2/rgrp.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index e4f3362..8d5d583 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -1899,19 +1899,17 @@ int gfs2_inplace_reserve(struct gfs2_inode *ip, u32 requested, u32 aflags)
 			rg_mblk_search(rs->rs_rbm.rgd, ip, requested);
 
 		/* Skip rgrps when we can't get a reservation on first pass */
-		if (!gfs2_rs_active(rs) && (loops < 1))
-			goto check_rgrp;
+		if (gfs2_rs_active(rs) || (loops >= 1)) {
+			/* If rgrp has enough free space, use it */
+			if (rs->rs_rbm.rgd->rd_free_clone >= requested) {
+				ip->i_rgd = rs->rs_rbm.rgd;
+				return 0;
+			}
 
-		/* If rgrp has enough free space, use it */
-		if (rs->rs_rbm.rgd->rd_free_clone >= requested) {
-			ip->i_rgd = rs->rs_rbm.rgd;
-			return 0;
+			/* Drop reservation if we couldn't use reserved rgrp */
+			if (gfs2_rs_active(rs))
+				gfs2_rs_deltree(rs);
 		}
-
-		/* Drop reservation, if we couldn't use reserved rgrp */
-		if (gfs2_rs_active(rs))
-			gfs2_rs_deltree(rs);
-check_rgrp:
 		/* Check for unlinked inodes which can be reclaimed */
 		if (rs->rs_rbm.rgd->rd_flags & GFS2_RDF_CHECK)
 			try_rgrp_unlink(rs->rs_rbm.rgd, &last_unlinked,
-- 
1.8.3.1




More information about the Cluster-devel mailing list