From: Andreas Gruenbacher Date: Mon, 5 Aug 2019 14:25:41 +0200 Subject: [Cluster-devel] [PATCH] gfs2: gfs2_walk_metadata cleanup Message-ID: <20190805122541.6676-1-agruenba@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Simplify the code a bit and add an additional assertion. Signed-off-by: Andreas Gruenbacher --- 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