From: Dave Chinner <david@fromorbit.com>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH v3 00/42] xfs: per-ag centric allocation alogrithms
Date: Fri, 10 Feb 2023 16:00:31 +1100 [thread overview]
Message-ID: <20230210050031.GJ360264@dread.disaster.area> (raw)
In-Reply-To: <Y+W1hDsoWiaCVqlB@magnolia>
On Thu, Feb 09, 2023 at 07:09:56PM -0800, Darrick J. Wong wrote:
> On Fri, Feb 10, 2023 at 09:17:43AM +1100, Dave Chinner wrote:
> > This series continues the work towards making shrinking a filesystem possible.
> > We need to be able to stop operations from taking place on AGs that need to be
> > removed by a shrink, so before shrink can be implemented we need to have the
> > infrastructure in place to prevent incursion into AGs that are going to be, or
> > are in the process, of being removed from active duty.
>
> From a quick glance, it looks like all the random things I had comments
> about were fixed, so for patches 14, 20-23, 28, and 42:
> Reviewed-by: Darrick J. Wong <djwong@kernel.org>
>
> I'm leaving off patch #7 until tomorrow so that I can think about it
> with a non-tired brain. I didn't see anything obviously wrong in the
> diff itself -- but I still need to adjust my mental model per what Dave
> said in his previously reply (active perag refs are for user-facing
> online operations, passive refs are for internal operations) and
> (re)examine how that relates to scrub and repair.
>
> Mostly I tripped over "but repair needs to use passive references once
> the AG has had it's state changed to "offline" -- currently, repair uses
> the same perag reference that scrub _gets. If scrub now gets an
> "active" reference and something needs repair, do we mark the AG offline
> and keep the active reference? Or downgrade it to a passive reference?
So one of the things I was trying to explain and didn't do a very
good job of is that active references are references that prevent AG
operational state changes.
That is, if we want to take an AG offline, or just prevent new
allocations in an AG, we have to wait for all the active references
to drain before we can change the operational state.
This does not prevent an active reference from being taken when an
AG is offline - all an active reference in an offline state does is
prevent the AG from being put back online whilst that active
reference to the offline AG persists.
e.g. repair can drain all the active references on an online AG,
then mark it offline, then take a new active reference to pin the AG
in the offline state while it does the repair work on that AG.
Similarly, shrink can pin an AG in a "being shrunk" operational
state that allows inodes and extents to be freed, but no new
allocations to be made by draining the active references, changing
the state and then pinning by taking a new reference. Then the
shrink process can move all the user data and metadata out of the AG
without needing special tricks to avoid allocating in that AG. If it
fails to move everything or is aborted, it can drop it's active
reference and put the AG back online...
This means that the new allocation code that now takes active
references will be morphing further to be "grab active reference,
check AG opstate allows allocation, if not drop active reference and
skip AG".
Once an AG is ready to be removed, grabbing an active reference
will fail so at that point the AG is skipped without even getting to
state checks. Once all the passive references then drain, the perag
can be RCU freed.
> I've (tried to) design scrub & repair as if they were just another pile
> of higher level code that uses libxfs to manipulate metadata, just like
> fallocate and reflink and all those types of things. But then, I was
> designing for a world where there's only one type of AG reference. :)
For the moment, everything in scrub/repair will work just fine with
passive references. It's only once we start using AG opstate to
control allocator, caching and scanning behaviour that they might
want to start using active references...
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
prev parent reply other threads:[~2023-02-10 5:00 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-09 22:17 [PATCH v3 00/42] xfs: per-ag centric allocation alogrithms Dave Chinner
2023-02-09 22:17 ` [PATCH 01/42] xfs: fix low space alloc deadlock Dave Chinner
2023-02-09 22:17 ` [PATCH 02/42] xfs: prefer free inodes at ENOSPC over chunk allocation Dave Chinner
2023-02-09 22:17 ` [PATCH 03/42] xfs: block reservation too large for minleft allocation Dave Chinner
2023-02-09 22:17 ` [PATCH 04/42] xfs: drop firstblock constraints from allocation setup Dave Chinner
2023-02-09 22:17 ` [PATCH 05/42] xfs: t_firstblock is tracking AGs not blocks Dave Chinner
2023-02-09 22:17 ` [PATCH 06/42] xfs: don't assert fail on transaction cancel with deferred ops Dave Chinner
2023-02-09 22:17 ` [PATCH 07/42] xfs: active perag reference counting Dave Chinner
2023-02-11 4:06 ` Darrick J. Wong
2023-02-09 22:17 ` [PATCH 08/42] xfs: rework the perag trace points to be perag centric Dave Chinner
2023-02-09 22:17 ` [PATCH 09/42] xfs: convert xfs_imap() to take a perag Dave Chinner
2023-02-09 22:17 ` [PATCH 10/42] xfs: use active perag references for inode allocation Dave Chinner
2023-02-09 22:17 ` [PATCH 11/42] xfs: inobt can use perags in many more places than it does Dave Chinner
2023-02-09 22:17 ` [PATCH 12/42] xfs: convert xfs_ialloc_next_ag() to an atomic Dave Chinner
2023-02-09 22:17 ` [PATCH 13/42] xfs: perags need atomic operational state Dave Chinner
2023-02-09 22:17 ` [PATCH 14/42] xfs: introduce xfs_for_each_perag_wrap() Dave Chinner
2023-02-09 22:17 ` [PATCH 15/42] xfs: rework xfs_alloc_vextent() Dave Chinner
2023-02-09 22:17 ` [PATCH 16/42] xfs: factor xfs_alloc_vextent_this_ag() for _iterate_ags() Dave Chinner
2023-02-09 22:18 ` [PATCH 17/42] xfs: combine __xfs_alloc_vextent_this_ag and xfs_alloc_ag_vextent Dave Chinner
2023-02-09 22:18 ` [PATCH 18/42] xfs: use xfs_alloc_vextent_this_ag() where appropriate Dave Chinner
2023-02-09 22:18 ` [PATCH 19/42] xfs: factor xfs_bmap_btalloc() Dave Chinner
2023-02-09 22:18 ` [PATCH 20/42] xfs: use xfs_alloc_vextent_first_ag() where appropriate Dave Chinner
2023-02-09 22:18 ` [PATCH 21/42] xfs: use xfs_alloc_vextent_start_bno() " Dave Chinner
2023-02-09 22:18 ` [PATCH 22/42] xfs: introduce xfs_alloc_vextent_near_bno() Dave Chinner
2023-02-09 22:18 ` [PATCH 23/42] xfs: introduce xfs_alloc_vextent_exact_bno() Dave Chinner
2023-02-09 22:18 ` [PATCH 24/42] xfs: introduce xfs_alloc_vextent_prepare() Dave Chinner
2023-02-09 22:18 ` [PATCH 25/42] xfs: move allocation accounting to xfs_alloc_vextent_set_fsbno() Dave Chinner
2023-02-09 22:18 ` [PATCH 26/42] xfs: fold xfs_alloc_ag_vextent() into callers Dave Chinner
2023-02-09 22:18 ` [PATCH 27/42] xfs: move the minimum agno checks into xfs_alloc_vextent_check_args Dave Chinner
2023-02-09 22:18 ` [PATCH 28/42] xfs: convert xfs_alloc_vextent_iterate_ags() to use perag walker Dave Chinner
2023-02-09 22:18 ` [PATCH 29/42] xfs: convert trim to use for_each_perag_range Dave Chinner
2023-02-09 22:18 ` [PATCH 30/42] xfs: factor out filestreams from xfs_bmap_btalloc_nullfb Dave Chinner
2023-02-09 22:18 ` [PATCH 31/42] xfs: get rid of notinit from xfs_bmap_longest_free_extent Dave Chinner
2023-02-09 22:18 ` [PATCH 32/42] xfs: use xfs_bmap_longest_free_extent() in filestreams Dave Chinner
2023-02-09 22:18 ` [PATCH 33/42] xfs: move xfs_bmap_btalloc_filestreams() to xfs_filestreams.c Dave Chinner
2023-02-09 22:18 ` [PATCH 34/42] xfs: merge filestream AG lookup into xfs_filestream_select_ag() Dave Chinner
2023-02-09 22:18 ` [PATCH 35/42] xfs: merge new filestream AG selection " Dave Chinner
2023-02-09 22:18 ` [PATCH 36/42] xfs: remove xfs_filestream_select_ag() longest extent check Dave Chinner
2023-02-09 22:18 ` [PATCH 37/42] xfs: factor out MRU hit case in xfs_filestream_select_ag Dave Chinner
2023-02-09 22:18 ` [PATCH 38/42] xfs: track an active perag reference in filestreams Dave Chinner
2023-02-09 22:18 ` [PATCH 39/42] xfs: use for_each_perag_wrap in xfs_filestream_pick_ag Dave Chinner
2023-02-09 22:18 ` [PATCH 40/42] xfs: pass perag to filestreams tracing Dave Chinner
2023-02-09 22:18 ` [PATCH 41/42] xfs: return a referenced perag from filestreams allocator Dave Chinner
2023-02-09 22:18 ` [PATCH 42/42] xfs: refactor the filestreams allocator pick functions Dave Chinner
2023-02-10 3:09 ` [PATCH v3 00/42] xfs: per-ag centric allocation alogrithms Darrick J. Wong
2023-02-10 5:00 ` Dave Chinner [this message]
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=20230210050031.GJ360264@dread.disaster.area \
--to=david@fromorbit.com \
--cc=djwong@kernel.org \
--cc=linux-xfs@vger.kernel.org \
/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