diff mbox series

[34/34] xfs: always pass a valid hdr to xfs_dir3_leaf_check_int

Message ID 20191101220719.29100-35-hch@lst.de (mailing list archive)
State Superseded, archived
Headers show
Series [01/34] xfs: move incore structures out of xfs_da_format.h | expand

Commit Message

Christoph Hellwig Nov. 1, 2019, 10:07 p.m. UTC
Move the code for extracting the incore header to the only caller that
didn't already do that.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/libxfs/xfs_dir2_leaf.c | 31 +++++++++++++------------------
 1 file changed, 13 insertions(+), 18 deletions(-)

Comments

Darrick J. Wong Nov. 4, 2019, 8:53 p.m. UTC | #1
On Fri, Nov 01, 2019 at 03:07:19PM -0700, Christoph Hellwig wrote:
> Move the code for extracting the incore header to the only caller that
> didn't already do that.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Well, that was quite the cleanup.  Even more surprisingly it didn't
clash too badly with the health reporting patch series I sent yesterday.
:)

Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  fs/xfs/libxfs/xfs_dir2_leaf.c | 31 +++++++++++++------------------
>  1 file changed, 13 insertions(+), 18 deletions(-)
> 
> diff --git a/fs/xfs/libxfs/xfs_dir2_leaf.c b/fs/xfs/libxfs/xfs_dir2_leaf.c
> index 6912264e081e..fecec1ac8e40 100644
> --- a/fs/xfs/libxfs/xfs_dir2_leaf.c
> +++ b/fs/xfs/libxfs/xfs_dir2_leaf.c
> @@ -137,20 +137,14 @@ xfs_dir3_leaf_check(
>  
>  xfs_failaddr_t
>  xfs_dir3_leaf_check_int(
> -	struct xfs_mount	*mp,
> -	struct xfs_dir3_icleaf_hdr *hdr,
> -	struct xfs_dir2_leaf	*leaf)
> +	struct xfs_mount		*mp,
> +	struct xfs_dir3_icleaf_hdr	*hdr,
> +	struct xfs_dir2_leaf		*leaf)
>  {
> -	xfs_dir2_leaf_tail_t	*ltp;
> -	int			stale;
> -	int			i;
> -	struct xfs_dir3_icleaf_hdr leafhdr;
> -	struct xfs_da_geometry	*geo = mp->m_dir_geo;
> -
> -	if (!hdr) {
> -		xfs_dir2_leaf_hdr_from_disk(mp, &leafhdr, leaf);
> -		hdr = &leafhdr;
> -	}
> +	struct xfs_da_geometry		*geo = mp->m_dir_geo;
> +	xfs_dir2_leaf_tail_t		*ltp;
> +	int				stale;
> +	int				i;
>  
>  	ltp = xfs_dir2_leaf_tail_p(geo, leaf);
>  
> @@ -190,17 +184,18 @@ xfs_dir3_leaf_check_int(
>   */
>  static xfs_failaddr_t
>  xfs_dir3_leaf_verify(
> -	struct xfs_buf		*bp)
> +	struct xfs_buf			*bp)
>  {
> -	struct xfs_mount	*mp = bp->b_mount;
> -	struct xfs_dir2_leaf	*leaf = bp->b_addr;
> -	xfs_failaddr_t		fa;
> +	struct xfs_mount		*mp = bp->b_mount;
> +	struct xfs_dir3_icleaf_hdr	leafhdr;
> +	xfs_failaddr_t			fa;
>  
>  	fa = xfs_da3_blkinfo_verify(bp, bp->b_addr);
>  	if (fa)
>  		return fa;
>  
> -	return xfs_dir3_leaf_check_int(mp, NULL, leaf);
> +	xfs_dir2_leaf_hdr_from_disk(mp, &leafhdr, bp->b_addr);
> +	return xfs_dir3_leaf_check_int(mp, &leafhdr, bp->b_addr);
>  }
>  
>  static void
> -- 
> 2.20.1
>
diff mbox series

Patch

diff --git a/fs/xfs/libxfs/xfs_dir2_leaf.c b/fs/xfs/libxfs/xfs_dir2_leaf.c
index 6912264e081e..fecec1ac8e40 100644
--- a/fs/xfs/libxfs/xfs_dir2_leaf.c
+++ b/fs/xfs/libxfs/xfs_dir2_leaf.c
@@ -137,20 +137,14 @@  xfs_dir3_leaf_check(
 
 xfs_failaddr_t
 xfs_dir3_leaf_check_int(
-	struct xfs_mount	*mp,
-	struct xfs_dir3_icleaf_hdr *hdr,
-	struct xfs_dir2_leaf	*leaf)
+	struct xfs_mount		*mp,
+	struct xfs_dir3_icleaf_hdr	*hdr,
+	struct xfs_dir2_leaf		*leaf)
 {
-	xfs_dir2_leaf_tail_t	*ltp;
-	int			stale;
-	int			i;
-	struct xfs_dir3_icleaf_hdr leafhdr;
-	struct xfs_da_geometry	*geo = mp->m_dir_geo;
-
-	if (!hdr) {
-		xfs_dir2_leaf_hdr_from_disk(mp, &leafhdr, leaf);
-		hdr = &leafhdr;
-	}
+	struct xfs_da_geometry		*geo = mp->m_dir_geo;
+	xfs_dir2_leaf_tail_t		*ltp;
+	int				stale;
+	int				i;
 
 	ltp = xfs_dir2_leaf_tail_p(geo, leaf);
 
@@ -190,17 +184,18 @@  xfs_dir3_leaf_check_int(
  */
 static xfs_failaddr_t
 xfs_dir3_leaf_verify(
-	struct xfs_buf		*bp)
+	struct xfs_buf			*bp)
 {
-	struct xfs_mount	*mp = bp->b_mount;
-	struct xfs_dir2_leaf	*leaf = bp->b_addr;
-	xfs_failaddr_t		fa;
+	struct xfs_mount		*mp = bp->b_mount;
+	struct xfs_dir3_icleaf_hdr	leafhdr;
+	xfs_failaddr_t			fa;
 
 	fa = xfs_da3_blkinfo_verify(bp, bp->b_addr);
 	if (fa)
 		return fa;
 
-	return xfs_dir3_leaf_check_int(mp, NULL, leaf);
+	xfs_dir2_leaf_hdr_from_disk(mp, &leafhdr, bp->b_addr);
+	return xfs_dir3_leaf_check_int(mp, &leafhdr, bp->b_addr);
 }
 
 static void