[Cluster-devel] [PATCH] gfs2: gfs2_walk_metadata cleanup
Andreas Gruenbacher
agruenba at redhat.com
Mon Aug 5 12:25:41 UTC 2019
Simplify the code a bit and add an additional assertion.
Signed-off-by: Andreas Gruenbacher <agruenba at redhat.com>
---
fs/gfs2/bmap.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index 9fe1793ebf6f..5bfc20e9052d 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -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;
--
2.20.1
More information about the Cluster-devel
mailing list