Skip to contentSkip to conversation

gfs2: gfs2_walk_metadata cleanup

PATCH New Andreas Gruenbacher 2 participants 2 messages Aug 5, 2019 GFS2 file system

lore
Share & tools
lore

Andreas Gruenbacher

author maintainer
#0 lore raw

PATCH 1/1 gfs2: gfs2_walk_metadata cleanup

Simplify the code a bit and add an additional assertion.

---
 fs/gfs2/bmap.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
fs/gfs2/bmap.c +7 -8
index 9fe1793ebf6f..5bfc20e9052d 100644
@@ -471,7 +471,14 @@ static int gfs2_walk_metadata(struct inode *inode, sector_t lblock,
 		if (step >= len)
 			break;
 		len -= step;
+
+		if (mp != &clone) {
+			clone_metapath(&clone, mp);
+			mp = &clone;
+		}
+
 		if (ptr != WALK_NEXT) {
+			BUG_ON(mp->mp_aheight == mp->mp_fheight);
 			BUG_ON(!*ptr);
 			mp->mp_list[hgt] += ptr - start;
 			goto fill_up_metapath;
@@ -479,10 +486,6 @@ static int gfs2_walk_metadata(struct inode *inode, sector_t lblock,
 
 lower_metapath:
 		/* Decrease height of metapath. */
-		if (mp != &clone) {
-			clone_metapath(&clone, mp);
-			mp = &clone;
-		}
 		brelse(mp->mp_bh[hgt]);
 		mp->mp_bh[hgt] = NULL;
 		mp->mp_list[hgt] = 0;
@@ -503,10 +506,6 @@ static int gfs2_walk_metadata(struct inode *inode, sector_t lblock,
 
 fill_up_metapath:
 		/* Increase height of metapath. */
-		if (mp != &clone) {
-			clone_metapath(&clone, mp);
-			mp = &clone;
-		}
 		ret = fillup_metapath(ip, mp, ip->i_height - 1);
 		if (ret < 0)
 			break;
Signature · 1 line
2.20.1