Message ID | 20200316144233.900390-9-hch@lst.de (mailing list archive) |
---|---|
State | Deferred, archived |
Headers | show |
Series | [01/14] xfs: merge xlog_cil_push into xlog_cil_push_work | expand |
On Mon, Mar 16, 2020 at 03:42:27PM +0100, Christoph Hellwig wrote: > Move xlog_state_do_iclog_callbacks a little up, to avoid the need for a > forward declaration with upcoming changes. > > Signed-off-by: Christoph Hellwig <hch@lst.de> Looks ok, Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> --D > --- > fs/xfs/xfs_log.c | 74 ++++++++++++++++++++++++------------------------ > 1 file changed, 37 insertions(+), 37 deletions(-) > > diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c > index c490c5b0d8b7..c534d7007aa3 100644 > --- a/fs/xfs/xfs_log.c > +++ b/fs/xfs/xfs_log.c > @@ -2701,6 +2701,43 @@ xlog_state_set_callback( > xlog_grant_push_ail(log, 0); > } > > +/* > + * Keep processing entries in the iclog callback list until we come around and > + * it is empty. We need to atomically see that the list is empty and change the > + * state to DIRTY so that we don't miss any more callbacks being added. > + * > + * This function is called with the icloglock held and returns with it held. We > + * drop it while running callbacks, however, as holding it over thousands of > + * callbacks is unnecessary and causes excessive contention if we do. > + */ > +static void > +xlog_state_do_iclog_callbacks( > + struct xlog *log, > + struct xlog_in_core *iclog) > + __releases(&log->l_icloglock) > + __acquires(&log->l_icloglock) > +{ > + spin_unlock(&log->l_icloglock); > + spin_lock(&iclog->ic_callback_lock); > + while (!list_empty(&iclog->ic_callbacks)) { > + LIST_HEAD(tmp); > + > + list_splice_init(&iclog->ic_callbacks, &tmp); > + > + spin_unlock(&iclog->ic_callback_lock); > + xlog_cil_process_committed(&tmp); > + spin_lock(&iclog->ic_callback_lock); > + } > + > + /* > + * Pick up the icloglock while still holding the callback lock so we > + * serialise against anyone trying to add more callbacks to this iclog > + * now we've finished processing. > + */ > + spin_lock(&log->l_icloglock); > + spin_unlock(&iclog->ic_callback_lock); > +} > + > /* > * Return true if we need to stop processing, false to continue to the next > * iclog. The caller will need to run callbacks if the iclog is returned in the > @@ -2754,43 +2791,6 @@ xlog_state_iodone_process_iclog( > } > } > > -/* > - * Keep processing entries in the iclog callback list until we come around and > - * it is empty. We need to atomically see that the list is empty and change the > - * state to DIRTY so that we don't miss any more callbacks being added. > - * > - * This function is called with the icloglock held and returns with it held. We > - * drop it while running callbacks, however, as holding it over thousands of > - * callbacks is unnecessary and causes excessive contention if we do. > - */ > -static void > -xlog_state_do_iclog_callbacks( > - struct xlog *log, > - struct xlog_in_core *iclog) > - __releases(&log->l_icloglock) > - __acquires(&log->l_icloglock) > -{ > - spin_unlock(&log->l_icloglock); > - spin_lock(&iclog->ic_callback_lock); > - while (!list_empty(&iclog->ic_callbacks)) { > - LIST_HEAD(tmp); > - > - list_splice_init(&iclog->ic_callbacks, &tmp); > - > - spin_unlock(&iclog->ic_callback_lock); > - xlog_cil_process_committed(&tmp); > - spin_lock(&iclog->ic_callback_lock); > - } > - > - /* > - * Pick up the icloglock while still holding the callback lock so we > - * serialise against anyone trying to add more callbacks to this iclog > - * now we've finished processing. > - */ > - spin_lock(&log->l_icloglock); > - spin_unlock(&iclog->ic_callback_lock); > -} > - > STATIC void > xlog_state_do_callback( > struct xlog *log) > -- > 2.24.1 >
On Mon, Mar 16, 2020 at 03:42:27PM +0100, Christoph Hellwig wrote: > Move xlog_state_do_iclog_callbacks a little up, to avoid the need for a > forward declaration with upcoming changes. > > Signed-off-by: Christoph Hellwig <hch@lst.de> > --- Reviewed-by: Brian Foster <bfoster@redhat.com> > fs/xfs/xfs_log.c | 74 ++++++++++++++++++++++++------------------------ > 1 file changed, 37 insertions(+), 37 deletions(-) > > diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c > index c490c5b0d8b7..c534d7007aa3 100644 > --- a/fs/xfs/xfs_log.c > +++ b/fs/xfs/xfs_log.c > @@ -2701,6 +2701,43 @@ xlog_state_set_callback( > xlog_grant_push_ail(log, 0); > } > > +/* > + * Keep processing entries in the iclog callback list until we come around and > + * it is empty. We need to atomically see that the list is empty and change the > + * state to DIRTY so that we don't miss any more callbacks being added. > + * > + * This function is called with the icloglock held and returns with it held. We > + * drop it while running callbacks, however, as holding it over thousands of > + * callbacks is unnecessary and causes excessive contention if we do. > + */ > +static void > +xlog_state_do_iclog_callbacks( > + struct xlog *log, > + struct xlog_in_core *iclog) > + __releases(&log->l_icloglock) > + __acquires(&log->l_icloglock) > +{ > + spin_unlock(&log->l_icloglock); > + spin_lock(&iclog->ic_callback_lock); > + while (!list_empty(&iclog->ic_callbacks)) { > + LIST_HEAD(tmp); > + > + list_splice_init(&iclog->ic_callbacks, &tmp); > + > + spin_unlock(&iclog->ic_callback_lock); > + xlog_cil_process_committed(&tmp); > + spin_lock(&iclog->ic_callback_lock); > + } > + > + /* > + * Pick up the icloglock while still holding the callback lock so we > + * serialise against anyone trying to add more callbacks to this iclog > + * now we've finished processing. > + */ > + spin_lock(&log->l_icloglock); > + spin_unlock(&iclog->ic_callback_lock); > +} > + > /* > * Return true if we need to stop processing, false to continue to the next > * iclog. The caller will need to run callbacks if the iclog is returned in the > @@ -2754,43 +2791,6 @@ xlog_state_iodone_process_iclog( > } > } > > -/* > - * Keep processing entries in the iclog callback list until we come around and > - * it is empty. We need to atomically see that the list is empty and change the > - * state to DIRTY so that we don't miss any more callbacks being added. > - * > - * This function is called with the icloglock held and returns with it held. We > - * drop it while running callbacks, however, as holding it over thousands of > - * callbacks is unnecessary and causes excessive contention if we do. > - */ > -static void > -xlog_state_do_iclog_callbacks( > - struct xlog *log, > - struct xlog_in_core *iclog) > - __releases(&log->l_icloglock) > - __acquires(&log->l_icloglock) > -{ > - spin_unlock(&log->l_icloglock); > - spin_lock(&iclog->ic_callback_lock); > - while (!list_empty(&iclog->ic_callbacks)) { > - LIST_HEAD(tmp); > - > - list_splice_init(&iclog->ic_callbacks, &tmp); > - > - spin_unlock(&iclog->ic_callback_lock); > - xlog_cil_process_committed(&tmp); > - spin_lock(&iclog->ic_callback_lock); > - } > - > - /* > - * Pick up the icloglock while still holding the callback lock so we > - * serialise against anyone trying to add more callbacks to this iclog > - * now we've finished processing. > - */ > - spin_lock(&log->l_icloglock); > - spin_unlock(&iclog->ic_callback_lock); > -} > - > STATIC void > xlog_state_do_callback( > struct xlog *log) > -- > 2.24.1 >
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index c490c5b0d8b7..c534d7007aa3 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c @@ -2701,6 +2701,43 @@ xlog_state_set_callback( xlog_grant_push_ail(log, 0); } +/* + * Keep processing entries in the iclog callback list until we come around and + * it is empty. We need to atomically see that the list is empty and change the + * state to DIRTY so that we don't miss any more callbacks being added. + * + * This function is called with the icloglock held and returns with it held. We + * drop it while running callbacks, however, as holding it over thousands of + * callbacks is unnecessary and causes excessive contention if we do. + */ +static void +xlog_state_do_iclog_callbacks( + struct xlog *log, + struct xlog_in_core *iclog) + __releases(&log->l_icloglock) + __acquires(&log->l_icloglock) +{ + spin_unlock(&log->l_icloglock); + spin_lock(&iclog->ic_callback_lock); + while (!list_empty(&iclog->ic_callbacks)) { + LIST_HEAD(tmp); + + list_splice_init(&iclog->ic_callbacks, &tmp); + + spin_unlock(&iclog->ic_callback_lock); + xlog_cil_process_committed(&tmp); + spin_lock(&iclog->ic_callback_lock); + } + + /* + * Pick up the icloglock while still holding the callback lock so we + * serialise against anyone trying to add more callbacks to this iclog + * now we've finished processing. + */ + spin_lock(&log->l_icloglock); + spin_unlock(&iclog->ic_callback_lock); +} + /* * Return true if we need to stop processing, false to continue to the next * iclog. The caller will need to run callbacks if the iclog is returned in the @@ -2754,43 +2791,6 @@ xlog_state_iodone_process_iclog( } } -/* - * Keep processing entries in the iclog callback list until we come around and - * it is empty. We need to atomically see that the list is empty and change the - * state to DIRTY so that we don't miss any more callbacks being added. - * - * This function is called with the icloglock held and returns with it held. We - * drop it while running callbacks, however, as holding it over thousands of - * callbacks is unnecessary and causes excessive contention if we do. - */ -static void -xlog_state_do_iclog_callbacks( - struct xlog *log, - struct xlog_in_core *iclog) - __releases(&log->l_icloglock) - __acquires(&log->l_icloglock) -{ - spin_unlock(&log->l_icloglock); - spin_lock(&iclog->ic_callback_lock); - while (!list_empty(&iclog->ic_callbacks)) { - LIST_HEAD(tmp); - - list_splice_init(&iclog->ic_callbacks, &tmp); - - spin_unlock(&iclog->ic_callback_lock); - xlog_cil_process_committed(&tmp); - spin_lock(&iclog->ic_callback_lock); - } - - /* - * Pick up the icloglock while still holding the callback lock so we - * serialise against anyone trying to add more callbacks to this iclog - * now we've finished processing. - */ - spin_lock(&log->l_icloglock); - spin_unlock(&iclog->ic_callback_lock); -} - STATIC void xlog_state_do_callback( struct xlog *log)
Move xlog_state_do_iclog_callbacks a little up, to avoid the need for a forward declaration with upcoming changes. Signed-off-by: Christoph Hellwig <hch@lst.de> --- fs/xfs/xfs_log.c | 74 ++++++++++++++++++++++++------------------------ 1 file changed, 37 insertions(+), 37 deletions(-)