diff mbox series

[6/7] xfs: cleanup xlog_state_clean_iclog

Message ID 20200306143137.236478-7-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series [1/7] xfs: remove the unused return value from xfs_log_unmount_write | expand

Commit Message

Christoph Hellwig March 6, 2020, 2:31 p.m. UTC
Use the shutdown flag in the log to bypass the iclog processing
instead of looking at the ioerror flag, and slightly simplify the
while loop processing.

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

Comments

Brian Foster March 6, 2020, 5:12 p.m. UTC | #1
On Fri, Mar 06, 2020 at 07:31:36AM -0700, Christoph Hellwig wrote:
> Use the shutdown flag in the log to bypass the iclog processing
> instead of looking at the ioerror flag, and slightly simplify the
> while loop processing.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---

Reviewed-by: Brian Foster <bfoster@redhat.com>

>  fs/xfs/xfs_log.c | 27 +++++++++++++--------------
>  1 file changed, 13 insertions(+), 14 deletions(-)
> 
> diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
> index d1accad13af4..fae5107099b1 100644
> --- a/fs/xfs/xfs_log.c
> +++ b/fs/xfs/xfs_log.c
> @@ -2582,30 +2582,29 @@ xlog_state_activate_iclog(
>   *
>   * Caller must hold the icloglock before calling us.
>   *
> - * State Change: !IOERROR -> DIRTY -> ACTIVE
> + * State Change: CALLBACK -> DIRTY -> ACTIVE
>   */
>  STATIC void
>  xlog_state_clean_iclog(
>  	struct xlog		*log,
>  	struct xlog_in_core	*dirty_iclog)
>  {
> -	struct xlog_in_core	*iclog;
>  	int			changed = 0;
>  
> -	/* Prepare the completed iclog. */
> -	if (dirty_iclog->ic_state != XLOG_STATE_IOERROR)
> -		dirty_iclog->ic_state = XLOG_STATE_DIRTY;
> +	if (!XLOG_FORCED_SHUTDOWN(log)) {
> +		struct xlog_in_core	*iclog = log->l_iclog;
>  
> -	/* Walk all the iclogs to update the ordered active state. */
> -	iclog = log->l_iclog;
> -	do {
> -		if (iclog->ic_state == XLOG_STATE_DIRTY)
> -			xlog_state_activate_iclog(iclog, &changed);
> -		else if (iclog->ic_state != XLOG_STATE_ACTIVE)
> -			break;
> -		iclog = iclog->ic_next;
> -	} while (iclog != log->l_iclog);
> +		/* Prepare the completed iclog. */
> +		dirty_iclog->ic_state = XLOG_STATE_DIRTY;
>  
> +		/* Walk all the iclogs to update the ordered active state. */
> +		do {
> +			if (iclog->ic_state == XLOG_STATE_DIRTY)
> +				xlog_state_activate_iclog(iclog, &changed);
> +			else if (iclog->ic_state != XLOG_STATE_ACTIVE)
> +				break;
> +		} while ((iclog = iclog->ic_next) != log->l_iclog);
> +	}
>  
>  	/*
>  	 * Wake up threads waiting in xfs_log_force() for the dirty iclog
> -- 
> 2.24.1
>
diff mbox series

Patch

diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index d1accad13af4..fae5107099b1 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -2582,30 +2582,29 @@  xlog_state_activate_iclog(
  *
  * Caller must hold the icloglock before calling us.
  *
- * State Change: !IOERROR -> DIRTY -> ACTIVE
+ * State Change: CALLBACK -> DIRTY -> ACTIVE
  */
 STATIC void
 xlog_state_clean_iclog(
 	struct xlog		*log,
 	struct xlog_in_core	*dirty_iclog)
 {
-	struct xlog_in_core	*iclog;
 	int			changed = 0;
 
-	/* Prepare the completed iclog. */
-	if (dirty_iclog->ic_state != XLOG_STATE_IOERROR)
-		dirty_iclog->ic_state = XLOG_STATE_DIRTY;
+	if (!XLOG_FORCED_SHUTDOWN(log)) {
+		struct xlog_in_core	*iclog = log->l_iclog;
 
-	/* Walk all the iclogs to update the ordered active state. */
-	iclog = log->l_iclog;
-	do {
-		if (iclog->ic_state == XLOG_STATE_DIRTY)
-			xlog_state_activate_iclog(iclog, &changed);
-		else if (iclog->ic_state != XLOG_STATE_ACTIVE)
-			break;
-		iclog = iclog->ic_next;
-	} while (iclog != log->l_iclog);
+		/* Prepare the completed iclog. */
+		dirty_iclog->ic_state = XLOG_STATE_DIRTY;
 
+		/* Walk all the iclogs to update the ordered active state. */
+		do {
+			if (iclog->ic_state == XLOG_STATE_DIRTY)
+				xlog_state_activate_iclog(iclog, &changed);
+			else if (iclog->ic_state != XLOG_STATE_ACTIVE)
+				break;
+		} while ((iclog = iclog->ic_next) != log->l_iclog);
+	}
 
 	/*
 	 * Wake up threads waiting in xfs_log_force() for the dirty iclog