linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] xfs: Remove dead code
@ 2022-05-20  6:44 Jiapeng Chong
  2022-05-20 15:45 ` Darrick J. Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Jiapeng Chong @ 2022-05-20  6:44 UTC (permalink / raw)
  To: djwong; +Cc: linux-xfs, linux-kernel, Jiapeng Chong, Abaci Robot

Remove tht entire xlog_recover_check_summary() function, this entire
function is dead code and has been for 12 years.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
Changes in v2:
  -Remove dead code.

 fs/xfs/xfs_log_recover.c | 59 ----------------------------------------
 1 file changed, 59 deletions(-)

diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 97b941c07957..b1980d7cbbee 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -39,13 +39,6 @@ STATIC int
 xlog_clear_stale_blocks(
 	struct xlog	*,
 	xfs_lsn_t);
-#if defined(DEBUG)
-STATIC void
-xlog_recover_check_summary(
-	struct xlog *);
-#else
-#define	xlog_recover_check_summary(log)
-#endif
 STATIC int
 xlog_do_recovery_pass(
         struct xlog *, xfs_daddr_t, xfs_daddr_t, int, xfs_daddr_t *);
@@ -3339,8 +3332,6 @@ xlog_do_recover(
 	}
 	mp->m_alloc_set_aside = xfs_alloc_set_aside(mp);
 
-	xlog_recover_check_summary(log);
-
 	/* Normal transactions can now occur */
 	clear_bit(XLOG_ACTIVE_RECOVERY, &log->l_opstate);
 	return 0;
@@ -3483,7 +3474,6 @@ xlog_recover_finish(
 	}
 
 	xlog_recover_process_iunlinks(log);
-	xlog_recover_check_summary(log);
 
 	/*
 	 * Recover any CoW staging blocks that are still referenced by the
@@ -3517,52 +3507,3 @@ xlog_recover_cancel(
 		xlog_recover_cancel_intents(log);
 }
 
-#if defined(DEBUG)
-/*
- * Read all of the agf and agi counters and check that they
- * are consistent with the superblock counters.
- */
-STATIC void
-xlog_recover_check_summary(
-	struct xlog		*log)
-{
-	struct xfs_mount	*mp = log->l_mp;
-	struct xfs_perag	*pag;
-	struct xfs_buf		*agfbp;
-	struct xfs_buf		*agibp;
-	xfs_agnumber_t		agno;
-	uint64_t		freeblks;
-	uint64_t		itotal;
-	uint64_t		ifree;
-	int			error;
-
-	freeblks = 0LL;
-	itotal = 0LL;
-	ifree = 0LL;
-	for_each_perag(mp, agno, pag) {
-		error = xfs_read_agf(mp, NULL, pag->pag_agno, 0, &agfbp);
-		if (error) {
-			xfs_alert(mp, "%s agf read failed agno %d error %d",
-						__func__, pag->pag_agno, error);
-		} else {
-			struct xfs_agf	*agfp = agfbp->b_addr;
-
-			freeblks += be32_to_cpu(agfp->agf_freeblks) +
-				    be32_to_cpu(agfp->agf_flcount);
-			xfs_buf_relse(agfbp);
-		}
-
-		error = xfs_read_agi(mp, NULL, pag->pag_agno, &agibp);
-		if (error) {
-			xfs_alert(mp, "%s agi read failed agno %d error %d",
-						__func__, pag->pag_agno, error);
-		} else {
-			struct xfs_agi	*agi = agibp->b_addr;
-
-			itotal += be32_to_cpu(agi->agi_count);
-			ifree += be32_to_cpu(agi->agi_freecount);
-			xfs_buf_relse(agibp);
-		}
-	}
-}
-#endif /* DEBUG */
-- 
2.20.1.7.g153144c


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] xfs: Remove dead code
  2022-05-20  6:44 [PATCH v2] xfs: Remove dead code Jiapeng Chong
@ 2022-05-20 15:45 ` Darrick J. Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Darrick J. Wong @ 2022-05-20 15:45 UTC (permalink / raw)
  To: Jiapeng Chong; +Cc: linux-xfs, linux-kernel, Abaci Robot

On Fri, May 20, 2022 at 02:44:16PM +0800, Jiapeng Chong wrote:
> Remove tht entire xlog_recover_check_summary() function, this entire
> function is dead code and has been for 12 years.
> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>

LGTM,
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
> Changes in v2:
>   -Remove dead code.
> 
>  fs/xfs/xfs_log_recover.c | 59 ----------------------------------------
>  1 file changed, 59 deletions(-)
> 
> diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
> index 97b941c07957..b1980d7cbbee 100644
> --- a/fs/xfs/xfs_log_recover.c
> +++ b/fs/xfs/xfs_log_recover.c
> @@ -39,13 +39,6 @@ STATIC int
>  xlog_clear_stale_blocks(
>  	struct xlog	*,
>  	xfs_lsn_t);
> -#if defined(DEBUG)
> -STATIC void
> -xlog_recover_check_summary(
> -	struct xlog *);
> -#else
> -#define	xlog_recover_check_summary(log)
> -#endif
>  STATIC int
>  xlog_do_recovery_pass(
>          struct xlog *, xfs_daddr_t, xfs_daddr_t, int, xfs_daddr_t *);
> @@ -3339,8 +3332,6 @@ xlog_do_recover(
>  	}
>  	mp->m_alloc_set_aside = xfs_alloc_set_aside(mp);
>  
> -	xlog_recover_check_summary(log);
> -
>  	/* Normal transactions can now occur */
>  	clear_bit(XLOG_ACTIVE_RECOVERY, &log->l_opstate);
>  	return 0;
> @@ -3483,7 +3474,6 @@ xlog_recover_finish(
>  	}
>  
>  	xlog_recover_process_iunlinks(log);
> -	xlog_recover_check_summary(log);
>  
>  	/*
>  	 * Recover any CoW staging blocks that are still referenced by the
> @@ -3517,52 +3507,3 @@ xlog_recover_cancel(
>  		xlog_recover_cancel_intents(log);
>  }
>  
> -#if defined(DEBUG)
> -/*
> - * Read all of the agf and agi counters and check that they
> - * are consistent with the superblock counters.
> - */
> -STATIC void
> -xlog_recover_check_summary(
> -	struct xlog		*log)
> -{
> -	struct xfs_mount	*mp = log->l_mp;
> -	struct xfs_perag	*pag;
> -	struct xfs_buf		*agfbp;
> -	struct xfs_buf		*agibp;
> -	xfs_agnumber_t		agno;
> -	uint64_t		freeblks;
> -	uint64_t		itotal;
> -	uint64_t		ifree;
> -	int			error;
> -
> -	freeblks = 0LL;
> -	itotal = 0LL;
> -	ifree = 0LL;
> -	for_each_perag(mp, agno, pag) {
> -		error = xfs_read_agf(mp, NULL, pag->pag_agno, 0, &agfbp);
> -		if (error) {
> -			xfs_alert(mp, "%s agf read failed agno %d error %d",
> -						__func__, pag->pag_agno, error);
> -		} else {
> -			struct xfs_agf	*agfp = agfbp->b_addr;
> -
> -			freeblks += be32_to_cpu(agfp->agf_freeblks) +
> -				    be32_to_cpu(agfp->agf_flcount);
> -			xfs_buf_relse(agfbp);
> -		}
> -
> -		error = xfs_read_agi(mp, NULL, pag->pag_agno, &agibp);
> -		if (error) {
> -			xfs_alert(mp, "%s agi read failed agno %d error %d",
> -						__func__, pag->pag_agno, error);
> -		} else {
> -			struct xfs_agi	*agi = agibp->b_addr;
> -
> -			itotal += be32_to_cpu(agi->agi_count);
> -			ifree += be32_to_cpu(agi->agi_freecount);
> -			xfs_buf_relse(agibp);
> -		}
> -	}
> -}
> -#endif /* DEBUG */
> -- 
> 2.20.1.7.g153144c
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-20 15:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-20  6:44 [PATCH v2] xfs: Remove dead code Jiapeng Chong
2022-05-20 15:45 ` Darrick J. Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).