Skip to content

Commit 4b29ab0

Browse files
Christoph Hellwigdjwong
authored andcommitted
xfs: remove the XLOG_STATE_DO_CALLBACK state
XLOG_STATE_DO_CALLBACK is only entered through XLOG_STATE_DONE_SYNC and just used in a single debug check. Remove the flag and thus simplify the calling conventions for xlog_state_do_callback and xlog_state_iodone_process_iclog. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Brian Foster <bfoster@redhat.com>
1 parent 1858bb0 commit 4b29ab0

File tree

2 files changed

+11
-66
lines changed

2 files changed

+11
-66
lines changed

fs/xfs/xfs_log.c

Lines changed: 11 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -2750,7 +2750,6 @@ static bool
27502750
xlog_state_iodone_process_iclog(
27512751
struct xlog *log,
27522752
struct xlog_in_core *iclog,
2753-
struct xlog_in_core *completed_iclog,
27542753
bool *ioerror)
27552754
{
27562755
xfs_lsn_t lowest_lsn;
@@ -2768,17 +2767,16 @@ xlog_state_iodone_process_iclog(
27682767
* Between marking a filesystem SHUTDOWN and stopping the log,
27692768
* we do flush all iclogs to disk (if there wasn't a log I/O
27702769
* error). So, we do want things to go smoothly in case of just
2771-
* a SHUTDOWN w/o a LOG_IO_ERROR.
2770+
* a SHUTDOWN w/o a LOG_IO_ERROR.
27722771
*/
27732772
*ioerror = true;
27742773
return false;
27752774
case XLOG_STATE_DONE_SYNC:
2776-
case XLOG_STATE_DO_CALLBACK:
27772775
/*
2778-
* Now that we have an iclog that is in either the DO_CALLBACK
2779-
* or DONE_SYNC states, do one more check here to see if we have
2780-
* chased our tail around. If this is not the lowest lsn iclog,
2781-
* then we will leave it for another completion to process.
2776+
* Now that we have an iclog that is in the DONE_SYNC state, do
2777+
* one more check here to see if we have chased our tail around.
2778+
* If this is not the lowest lsn iclog, then we will leave it
2779+
* for another completion to process.
27822780
*/
27832781
header_lsn = be64_to_cpu(iclog->ic_header.h_lsn);
27842782
lowest_lsn = xlog_get_lowest_lsn(log);
@@ -2789,15 +2787,9 @@ xlog_state_iodone_process_iclog(
27892787
default:
27902788
/*
27912789
* Can only perform callbacks in order. Since this iclog is not
2792-
* in the DONE_SYNC or DO_CALLBACK states, we skip the rest and
2793-
* just try to clean up. If we set our iclog to DO_CALLBACK, we
2794-
* will not process it when we retry since a previous iclog is
2795-
* in the CALLBACK and the state cannot change since we are
2796-
* holding l_icloglock.
2790+
* in the DONE_SYNC state, we skip the rest and just try to
2791+
* clean up.
27972792
*/
2798-
if (completed_iclog &&
2799-
(completed_iclog->ic_state == XLOG_STATE_DONE_SYNC))
2800-
completed_iclog->ic_state = XLOG_STATE_DO_CALLBACK;
28012793
return true;
28022794
}
28032795
}
@@ -2838,54 +2830,13 @@ xlog_state_do_iclog_callbacks(
28382830
spin_unlock(&iclog->ic_callback_lock);
28392831
}
28402832

2841-
#ifdef DEBUG
2842-
/*
2843-
* Make one last gasp attempt to see if iclogs are being left in limbo. If the
2844-
* above loop finds an iclog earlier than the current iclog and in one of the
2845-
* syncing states, the current iclog is put into DO_CALLBACK and the callbacks
2846-
* are deferred to the completion of the earlier iclog. Walk the iclogs in order
2847-
* and make sure that no iclog is in DO_CALLBACK unless an earlier iclog is in
2848-
* one of the syncing states.
2849-
*/
2850-
static void
2851-
xlog_state_callback_check_state(
2852-
struct xlog *log)
2853-
{
2854-
struct xlog_in_core *first_iclog = log->l_iclog;
2855-
struct xlog_in_core *iclog = first_iclog;
2856-
2857-
do {
2858-
ASSERT(iclog->ic_state != XLOG_STATE_DO_CALLBACK);
2859-
/*
2860-
* Terminate the loop if iclogs are found in states
2861-
* which will cause other threads to clean up iclogs.
2862-
*
2863-
* SYNCING - i/o completion will go through logs
2864-
* DONE_SYNC - interrupt thread should be waiting for
2865-
* l_icloglock
2866-
* IOERROR - give up hope all ye who enter here
2867-
*/
2868-
if (iclog->ic_state == XLOG_STATE_WANT_SYNC ||
2869-
iclog->ic_state == XLOG_STATE_SYNCING ||
2870-
iclog->ic_state == XLOG_STATE_DONE_SYNC ||
2871-
iclog->ic_state == XLOG_STATE_IOERROR )
2872-
break;
2873-
iclog = iclog->ic_next;
2874-
} while (first_iclog != iclog);
2875-
}
2876-
#else
2877-
#define xlog_state_callback_check_state(l) ((void)0)
2878-
#endif
2879-
28802833
STATIC void
28812834
xlog_state_do_callback(
28822835
struct xlog *log,
2883-
bool aborted,
2884-
struct xlog_in_core *ciclog)
2836+
bool aborted)
28852837
{
28862838
struct xlog_in_core *iclog;
28872839
struct xlog_in_core *first_iclog;
2888-
bool did_callbacks = false;
28892840
bool cycled_icloglock;
28902841
bool ioerror;
28912842
int flushcnt = 0;
@@ -2909,7 +2860,7 @@ xlog_state_do_callback(
29092860

29102861
do {
29112862
if (xlog_state_iodone_process_iclog(log, iclog,
2912-
ciclog, &ioerror))
2863+
&ioerror))
29132864
break;
29142865

29152866
if (iclog->ic_state != XLOG_STATE_CALLBACK &&
@@ -2929,8 +2880,6 @@ xlog_state_do_callback(
29292880
iclog = iclog->ic_next;
29302881
} while (first_iclog != iclog);
29312882

2932-
did_callbacks |= cycled_icloglock;
2933-
29342883
if (repeats > 5000) {
29352884
flushcnt += repeats;
29362885
repeats = 0;
@@ -2940,9 +2889,6 @@ xlog_state_do_callback(
29402889
}
29412890
} while (!ioerror && cycled_icloglock);
29422891

2943-
if (did_callbacks)
2944-
xlog_state_callback_check_state(log);
2945-
29462892
if (log->l_iclog->ic_state == XLOG_STATE_ACTIVE ||
29472893
log->l_iclog->ic_state == XLOG_STATE_IOERROR)
29482894
wake_up_all(&log->l_flush_wait);
@@ -2993,7 +2939,7 @@ xlog_state_done_syncing(
29932939
*/
29942940
wake_up_all(&iclog->ic_write_wait);
29952941
spin_unlock(&log->l_icloglock);
2996-
xlog_state_do_callback(log, aborted, iclog); /* also cleans log */
2942+
xlog_state_do_callback(log, aborted); /* also cleans log */
29972943
} /* xlog_state_done_syncing */
29982944

29992945

@@ -3987,7 +3933,7 @@ xfs_log_force_umount(
39873933
spin_lock(&log->l_cilp->xc_push_lock);
39883934
wake_up_all(&log->l_cilp->xc_commit_wait);
39893935
spin_unlock(&log->l_cilp->xc_push_lock);
3990-
xlog_state_do_callback(log, true, NULL);
3936+
xlog_state_do_callback(log, true);
39913937

39923938
/* return non-zero if log IOERROR transition had already happened */
39933939
return retval;

fs/xfs/xfs_log_priv.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ enum xlog_iclog_state {
4545
XLOG_STATE_WANT_SYNC, /* Want to sync this iclog; no more writes */
4646
XLOG_STATE_SYNCING, /* This IC log is syncing */
4747
XLOG_STATE_DONE_SYNC, /* Done syncing to disk */
48-
XLOG_STATE_DO_CALLBACK, /* Process callback functions */
4948
XLOG_STATE_CALLBACK, /* Callback functions now */
5049
XLOG_STATE_DIRTY, /* Dirty IC log, not ready for ACTIVE status */
5150
XLOG_STATE_IOERROR, /* IO error happened in sync'ing log */

0 commit comments

Comments
 (0)