On Tue, Sep 26, 2023 at 04:31:38PM -0700, Darrick J. Wong wrote: > From: Darrick J. Wong <djwong@xxxxxxxxxx> > > Traditionally, all pending deferred work attached to a transaction is > finished when one of the xfs_defer_finish* functions is called. > However, online repair wants to be able to allocate space for a new data > structure, format a new metadata structure into the allocated space, and > commit that into the filesystem. > > As a hedge against system crashes during repairs, we also want to log > some EFI items for the allocated space speculatively, and cancel them if > we elect to commit the new data structure. > > Therefore, introduce the idea of pausing a pending deferred work item. > Log intent items are still created for paused items and relogged as > necessary. However, paused items are pushed onto a side list before we > start calling ->finish_item, and the whole list is reattach to the > transaction afterwards. New work items are never attached to paused > pending items. > > Modify xfs_defer_cancel to clean up pending deferred work items holding > a log intent item but not a log intent done item, since that is now > possible. > > Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx> > --- > fs/xfs/libxfs/xfs_defer.c | 98 +++++++++++++++++++++++++++++++++++++++------ > fs/xfs/libxfs/xfs_defer.h | 17 +++++++- > fs/xfs/xfs_trace.h | 13 +++++- > 3 files changed, 112 insertions(+), 16 deletions(-) Not 100% certain how this will be used, but the mechanism itself looks fine. Reviewed-by: Dave Chinner <dchinner@xxxxxxxxxx> -- Dave Chinner david@xxxxxxxxxxxxx