From: Brian Foster <bfoster@redhat.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 4/7] xfs: add support for free space btree staging cursors
Date: Mon, 16 Mar 2020 08:29:42 -0400 [thread overview]
Message-ID: <20200316122942.GA12313@bfoster> (raw)
In-Reply-To: <158431626637.357791.7694218797816175496.stgit@magnolia>
On Sun, Mar 15, 2020 at 04:51:06PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
>
> Add support for btree staging cursors for the free space btrees. This
> is needed both for online repair and also to convert xfs_repair to use
> btree bulk loading.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
> fs/xfs/libxfs/xfs_alloc_btree.c | 98 +++++++++++++++++++++++++++++++--------
> fs/xfs/libxfs/xfs_alloc_btree.h | 7 +++
> 2 files changed, 86 insertions(+), 19 deletions(-)
>
>
> diff --git a/fs/xfs/libxfs/xfs_alloc_btree.c b/fs/xfs/libxfs/xfs_alloc_btree.c
> index a28041fdf4c0..93792ee7924e 100644
> --- a/fs/xfs/libxfs/xfs_alloc_btree.c
> +++ b/fs/xfs/libxfs/xfs_alloc_btree.c
...
> @@ -485,36 +520,61 @@ xfs_allocbt_init_cursor(
...
>
> +/*
> + * Install a new free space btree root. Caller is responsible for invalidating
> + * and freeing the old btree blocks.
> + */
> +void
> +xfs_allocbt_commit_staged_btree(
> + struct xfs_btree_cur *cur,
> + struct xfs_trans *tp,
> + struct xfs_buf *agbp)
> +{
> + struct xfs_agf *agf = agbp->b_addr;
> + struct xbtree_afakeroot *afake = cur->bc_ag.afake;
> +
> + ASSERT(cur->bc_flags & XFS_BTREE_STAGING);
> +
> + agf->agf_roots[cur->bc_btnum] = cpu_to_be32(afake->af_root);
> + agf->agf_levels[cur->bc_btnum] = cpu_to_be32(afake->af_levels);
> + xfs_alloc_log_agf(tp, agbp, XFS_AGF_ROOTS | XFS_AGF_LEVELS);
> +
> + if (cur->bc_btnum == XFS_BTNUM_BNO) {
> + xfs_btree_commit_afakeroot(cur, tp, agbp, &xfs_bnobt_ops);
> + } else {
> + cur->bc_flags |= XFS_BTREE_LASTREC_UPDATE;
Any reason this is set here and not at init time for the staging cursor?
Brian
> + xfs_btree_commit_afakeroot(cur, tp, agbp, &xfs_cntbt_ops);
> + }
> +}
> +
> /*
> * Calculate number of records in an alloc btree block.
> */
> diff --git a/fs/xfs/libxfs/xfs_alloc_btree.h b/fs/xfs/libxfs/xfs_alloc_btree.h
> index c9305ebb69f6..047f09f0be3c 100644
> --- a/fs/xfs/libxfs/xfs_alloc_btree.h
> +++ b/fs/xfs/libxfs/xfs_alloc_btree.h
> @@ -13,6 +13,7 @@
> struct xfs_buf;
> struct xfs_btree_cur;
> struct xfs_mount;
> +struct xbtree_afakeroot;
>
> /*
> * Btree block header size depends on a superblock flag.
> @@ -48,8 +49,14 @@ struct xfs_mount;
> extern struct xfs_btree_cur *xfs_allocbt_init_cursor(struct xfs_mount *,
> struct xfs_trans *, struct xfs_buf *,
> xfs_agnumber_t, xfs_btnum_t);
> +struct xfs_btree_cur *xfs_allocbt_stage_cursor(struct xfs_mount *mp,
> + struct xbtree_afakeroot *afake, xfs_agnumber_t agno,
> + xfs_btnum_t btnum);
> extern int xfs_allocbt_maxrecs(struct xfs_mount *, int, int);
> extern xfs_extlen_t xfs_allocbt_calc_size(struct xfs_mount *mp,
> unsigned long long len);
>
> +void xfs_allocbt_commit_staged_btree(struct xfs_btree_cur *cur,
> + struct xfs_trans *tp, struct xfs_buf *agbp);
> +
> #endif /* __XFS_ALLOC_BTREE_H__ */
>
next prev parent reply other threads:[~2020-03-16 12:29 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-15 23:50 [PATCH v5 0/7] xfs: btree bulk loading Darrick J. Wong
2020-03-15 23:50 ` [PATCH 1/7] xfs: introduce fake roots for ag-rooted btrees Darrick J. Wong
2020-03-16 10:41 ` Christoph Hellwig
2020-03-16 15:03 ` Darrick J. Wong
2020-03-15 23:50 ` [PATCH 2/7] xfs: introduce fake roots for inode-rooted btrees Darrick J. Wong
2020-03-15 23:50 ` [PATCH 3/7] xfs: support bulk loading of staged btrees Darrick J. Wong
2020-03-15 23:51 ` [PATCH 4/7] xfs: add support for free space btree staging cursors Darrick J. Wong
2020-03-16 12:29 ` Brian Foster [this message]
2020-03-16 14:58 ` Darrick J. Wong
2020-03-16 19:35 ` [PATCH v2 " Darrick J. Wong
2020-03-17 11:37 ` Brian Foster
2020-03-15 23:51 ` [PATCH 5/7] xfs: add support for inode " Darrick J. Wong
2020-03-16 12:29 ` Brian Foster
2020-03-15 23:51 ` [PATCH 6/7] xfs: add support for refcount " Darrick J. Wong
2020-03-16 12:29 ` Brian Foster
2020-03-15 23:51 ` [PATCH 7/7] xfs: add support for rmap " Darrick J. Wong
2020-03-16 12:30 ` Brian Foster
-- strict thread matches above, loose matches on Subject: below --
2020-03-12 3:45 [PATCH v4 0/7] xfs: btree bulk loading Darrick J. Wong
2020-03-12 3:45 ` [PATCH 4/7] xfs: add support for free space btree staging cursors Darrick J. Wong
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=20200316122942.GA12313@bfoster \
--to=bfoster@redhat.com \
--cc=darrick.wong@oracle.com \
--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;
as well as URLs for NNTP newsgroup(s).