public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Wengang Wang <wen.gang.wang@oracle.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 2/2] xfs: log recovery stage split EFIs with multiple extents
Date: Thu, 20 Apr 2023 10:30:50 +1000	[thread overview]
Message-ID: <20230420003050.GX3223426@dread.disaster.area> (raw)
In-Reply-To: <20230414225836.8952-3-wen.gang.wang@oracle.com>

On Fri, Apr 14, 2023 at 03:58:36PM -0700, Wengang Wang wrote:
> At log recovery stage, we need to split EFIs with multiple extents. For each
> orginal multiple-extent EFI, split it into new EFIs each including one extent
> from the original EFI. By that we avoid deadlock when allocating blocks for
> AGFL waiting for the held busy extents by current transaction to be flushed.
> 
>  For the original EFI, the process is
>  1. Create and log new EFIs each covering one extent from the
>     original EFI.
>  2. Don't free extent with the original EFI.
>  3. Log EFD for the original EFI.
>     Make sure we log the new EFIs and original EFD in this order:
>       new EFI 1
>       new EFI 2
>       ...
>       new EFI N
>       original EFD
>  The original extents are freed with the new EFIs.

We may not have the log space available during recovery to explode a
single EFI out into many EFIs like this. The EFI only had enough
space reserved for processing a single EFI, and exploding a single
EFI out like this requires an individual log reservation for each
new EFI. Hence this de-multiplexing process risks running out of log
space and deadlocking before we've been able to process anything.

Hence the only option we really have here is to replicate how CUIs
are handled.  We must process the first extent with a whole EFD and
a new EFI containing the remaining unprocessed extents as defered
operations.  i.e.

1. free the first extent in the original EFI
2. log an EFD for the original EFI
3. Add all the remaining extents in the original EFI to an xefi chain
4. Call xfs_defer_ops_capture_and_commit() to create a new EFI from
   the xefi chain and commit the current transaction.

xfs_defer_ops_capture_and_commit() will then add a work item to the
defered list which will come back to the new EFI and process it
through the normal runtime deferred ops intent processing path.

The first patch changed that path to only create intents with a
single extent, so the continued defer ops would then do the right
thing with that change in place. However, I think that we also need
the runtime code to process a single extent per intent per commit in
the same manner as above. i.e. we process the first extent in the
intent, then relog all the remaining unprocessed extents as a single
new intent.

Note that this is similar to how we already relog intents to roll
them forward in the journal. The only difference for single extent
processing is that an intent relog duplicates the entire extent list
in the EFD and the new EFI, whilst what we want is the new EFI to
contain all the extents except the one we just processed...

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2023-04-20  0:30 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-14 22:58 [PATCH 0/2] xfs: one extent per EFI Wengang Wang
2023-04-14 22:58 ` [PATCH 1/2] xfs: IO time " Wengang Wang
2023-04-19 23:55   ` Dave Chinner
2023-04-20 17:31     ` Wengang Wang
2023-04-20 23:22       ` Dave Chinner
2023-04-21  0:24         ` Wengang Wang
2023-04-21  9:34           ` Dave Chinner
2023-04-21 18:23             ` Wengang Wang
2023-04-22  3:22               ` Wengang Wang
2023-04-24 15:53                 ` Wengang Wang
2023-04-24 22:52                   ` Wengang Wang
2023-04-14 22:58 ` [PATCH 2/2] xfs: log recovery stage split EFIs with multiple extents Wengang Wang
2023-04-20  0:30   ` Dave Chinner [this message]
2023-04-20 17:10     ` Wengang Wang
2023-04-20 22:54       ` Dave Chinner
2023-04-21  0:32         ` Wengang Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230420003050.GX3223426@dread.disaster.area \
    --to=david@fromorbit.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=wen.gang.wang@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox