From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Brian Foster <bfoster@redhat.com>
Cc: sandeen@sandeen.net, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 12/12] xfs_repair: use bitmap to track blocks lost during btree construction
Date: Fri, 19 Jun 2020 14:36:31 -0700 [thread overview]
Message-ID: <20200619213631.GD11245@magnolia> (raw)
In-Reply-To: <20200619111047.GB36770@bfoster>
On Fri, Jun 19, 2020 at 07:10:47AM -0400, Brian Foster wrote:
> On Mon, Jun 01, 2020 at 09:28:10PM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> >
> > Use the incore bitmap structure to track blocks that were lost
> > during btree construction. This makes it somewhat more efficient.
> >
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> > repair/agbtree.c | 21 ++++++++--------
> > repair/agbtree.h | 2 +-
> > repair/phase5.c | 72 ++++++++++++++++++++++--------------------------------
> > 3 files changed, 41 insertions(+), 54 deletions(-)
> >
> >
> ...
> > diff --git a/repair/phase5.c b/repair/phase5.c
> > index 439c1065..446f7ec0 100644
> > --- a/repair/phase5.c
> > +++ b/repair/phase5.c
> ...
> > @@ -211,7 +212,7 @@ build_agf_agfl(
> > struct bt_rebuild *btr_cnt,
> > struct bt_rebuild *btr_rmap,
> > struct bt_rebuild *btr_refc,
> > - struct xfs_slab *lost_fsb)
> > + struct bitmap *lost_blocks)
> > {
>
> Looks like another case of an unused parameter here, otherwise looks
> good:
Heh, yep, this could be removed all the way back in "xfs_repair: rebuild
free space btrees with bulk loader" so I'll go do it there.
Thanks for reviewing!
--D
> Reviewed-by: Brian Foster <bfoster@redhat.com>
>
> > struct extent_tree_node *ext_ptr;
> > struct xfs_buf *agf_buf, *agfl_buf;
> > @@ -428,7 +429,7 @@ static void
> > phase5_func(
> > struct xfs_mount *mp,
> > xfs_agnumber_t agno,
> > - struct xfs_slab *lost_fsb)
> > + struct bitmap *lost_blocks)
> > {
> > struct repair_ctx sc = { .mp = mp, };
> > struct bt_rebuild btr_bno;
> > @@ -543,7 +544,7 @@ _("unable to rebuild AG %u. Not enough free space in on-disk AG.\n"),
> > * set up agf and agfl
> > */
> > build_agf_agfl(mp, agno, &btr_bno, &btr_cnt, &btr_rmap, &btr_refc,
> > - lost_fsb);
> > + lost_blocks);
> >
> > build_inode_btrees(&sc, agno, &btr_ino, &btr_fino);
> >
> > @@ -553,15 +554,15 @@ _("unable to rebuild AG %u. Not enough free space in on-disk AG.\n"),
> > /*
> > * tear down cursors
> > */
> > - finish_rebuild(mp, &btr_bno, lost_fsb);
> > - finish_rebuild(mp, &btr_cnt, lost_fsb);
> > - finish_rebuild(mp, &btr_ino, lost_fsb);
> > + finish_rebuild(mp, &btr_bno, lost_blocks);
> > + finish_rebuild(mp, &btr_cnt, lost_blocks);
> > + finish_rebuild(mp, &btr_ino, lost_blocks);
> > if (xfs_sb_version_hasfinobt(&mp->m_sb))
> > - finish_rebuild(mp, &btr_fino, lost_fsb);
> > + finish_rebuild(mp, &btr_fino, lost_blocks);
> > if (xfs_sb_version_hasrmapbt(&mp->m_sb))
> > - finish_rebuild(mp, &btr_rmap, lost_fsb);
> > + finish_rebuild(mp, &btr_rmap, lost_blocks);
> > if (xfs_sb_version_hasreflink(&mp->m_sb))
> > - finish_rebuild(mp, &btr_refc, lost_fsb);
> > + finish_rebuild(mp, &btr_refc, lost_blocks);
> >
> > /*
> > * release the incore per-AG bno/bcnt trees so the extent nodes
> > @@ -572,48 +573,33 @@ _("unable to rebuild AG %u. Not enough free space in on-disk AG.\n"),
> > PROG_RPT_INC(prog_rpt_done[agno], 1);
> > }
> >
> > -/* Inject lost blocks back into the filesystem. */
> > +/* Inject this unused space back into the filesystem. */
> > static int
> > -inject_lost_blocks(
> > - struct xfs_mount *mp,
> > - struct xfs_slab *lost_fsbs)
> > +inject_lost_extent(
> > + uint64_t start,
> > + uint64_t length,
> > + void *arg)
> > {
> > - struct xfs_trans *tp = NULL;
> > - struct xfs_slab_cursor *cur = NULL;
> > - xfs_fsblock_t *fsb;
> > + struct xfs_mount *mp = arg;
> > + struct xfs_trans *tp;
> > int error;
> >
> > - error = init_slab_cursor(lost_fsbs, NULL, &cur);
> > + error = -libxfs_trans_alloc_rollable(mp, 16, &tp);
> > if (error)
> > return error;
> >
> > - while ((fsb = pop_slab_cursor(cur)) != NULL) {
> > - error = -libxfs_trans_alloc_rollable(mp, 16, &tp);
> > - if (error)
> > - goto out_cancel;
> > -
> > - error = -libxfs_free_extent(tp, *fsb, 1,
> > - &XFS_RMAP_OINFO_ANY_OWNER, XFS_AG_RESV_NONE);
> > - if (error)
> > - goto out_cancel;
> > -
> > - error = -libxfs_trans_commit(tp);
> > - if (error)
> > - goto out_cancel;
> > - tp = NULL;
> > - }
> > + error = -libxfs_free_extent(tp, start, length,
> > + &XFS_RMAP_OINFO_ANY_OWNER, XFS_AG_RESV_NONE);
> > + if (error)
> > + return error;
> >
> > -out_cancel:
> > - if (tp)
> > - libxfs_trans_cancel(tp);
> > - free_slab_cursor(&cur);
> > - return error;
> > + return -libxfs_trans_commit(tp);
> > }
> >
> > void
> > phase5(xfs_mount_t *mp)
> > {
> > - struct xfs_slab *lost_fsb;
> > + struct bitmap *lost_blocks = NULL;
> > xfs_agnumber_t agno;
> > int error;
> >
> > @@ -656,12 +642,12 @@ phase5(xfs_mount_t *mp)
> > if (sb_fdblocks_ag == NULL)
> > do_error(_("cannot alloc sb_fdblocks_ag buffers\n"));
> >
> > - error = init_slab(&lost_fsb, sizeof(xfs_fsblock_t));
> > + error = bitmap_alloc(&lost_blocks);
> > if (error)
> > - do_error(_("cannot alloc lost block slab\n"));
> > + do_error(_("cannot alloc lost block bitmap\n"));
> >
> > for (agno = 0; agno < mp->m_sb.sb_agcount; agno++)
> > - phase5_func(mp, agno, lost_fsb);
> > + phase5_func(mp, agno, lost_blocks);
> >
> > print_final_rpt();
> >
> > @@ -704,10 +690,10 @@ _("unable to add AG %u reverse-mapping data to btree.\n"), agno);
> > * Put blocks that were unnecessarily reserved for btree
> > * reconstruction back into the filesystem free space data.
> > */
> > - error = inject_lost_blocks(mp, lost_fsb);
> > + error = bitmap_iterate(lost_blocks, inject_lost_extent, mp);
> > if (error)
> > do_error(_("Unable to reinsert lost blocks into filesystem.\n"));
> > - free_slab(&lost_fsb);
> > + bitmap_free(&lost_blocks);
> >
> > bad_ino_btree = 0;
> >
> >
>
prev parent reply other threads:[~2020-06-19 21:36 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-02 4:26 [PATCH v6 00/12] xfs_repair: use btree bulk loading Darrick J. Wong
2020-06-02 4:26 ` [PATCH 01/12] xfs_repair: drop lostblocks from build_agf_agfl Darrick J. Wong
2020-06-17 12:09 ` Brian Foster
2020-06-02 4:27 ` [PATCH 02/12] xfs_repair: rename the agfl index loop variable in build_agf_agfl Darrick J. Wong
2020-06-17 12:09 ` Brian Foster
2020-06-02 4:27 ` [PATCH 03/12] xfs_repair: make container for btree bulkload root and block reservation Darrick J. Wong
2020-06-17 12:09 ` Brian Foster
2020-06-02 4:27 ` [PATCH 04/12] xfs_repair: remove gratuitous code block in phase5 Darrick J. Wong
2020-06-02 4:27 ` [PATCH 05/12] xfs_repair: inject lost blocks back into the fs no matter the owner Darrick J. Wong
2020-06-17 12:09 ` Brian Foster
2020-06-02 4:27 ` [PATCH 06/12] xfs_repair: create a new class of btree rebuild cursors Darrick J. Wong
2020-06-17 12:10 ` Brian Foster
2020-06-18 18:30 ` Darrick J. Wong
2020-06-29 23:10 ` Darrick J. Wong
2020-07-02 15:18 ` [PATCH v2 " Darrick J. Wong
2020-07-03 3:24 ` Eric Sandeen
2020-07-03 20:26 ` Darrick J. Wong
2020-07-03 21:51 ` Eric Sandeen
2020-07-04 3:39 ` Darrick J. Wong
2020-07-10 19:10 ` Eric Sandeen
2020-07-13 13:37 ` Brian Foster
2020-06-02 4:27 ` [PATCH 07/12] xfs_repair: rebuild free space btrees with bulk loader Darrick J. Wong
2020-06-18 15:23 ` Brian Foster
2020-06-18 16:41 ` Darrick J. Wong
2020-06-18 16:51 ` Brian Foster
2020-06-02 4:27 ` [PATCH 08/12] xfs_repair: rebuild inode " Darrick J. Wong
2020-06-18 15:24 ` Brian Foster
2020-06-18 18:33 ` Darrick J. Wong
2020-06-02 4:27 ` [PATCH 09/12] xfs_repair: rebuild reverse mapping " Darrick J. Wong
2020-06-18 15:25 ` Brian Foster
2020-06-18 15:31 ` Darrick J. Wong
2020-06-18 15:37 ` Brian Foster
2020-06-18 16:54 ` Darrick J. Wong
2020-06-02 4:27 ` [PATCH 10/12] xfs_repair: rebuild refcount " Darrick J. Wong
2020-06-18 15:26 ` Brian Foster
2020-06-18 16:56 ` Darrick J. Wong
2020-06-18 17:05 ` Brian Foster
2020-06-02 4:28 ` [PATCH 11/12] xfs_repair: remove old btree rebuild support code Darrick J. Wong
2020-06-19 11:10 ` Brian Foster
2020-06-02 4:28 ` [PATCH 12/12] xfs_repair: use bitmap to track blocks lost during btree construction Darrick J. Wong
2020-06-19 11:10 ` Brian Foster
2020-06-19 21:36 ` Darrick J. Wong [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=20200619213631.GD11245@magnolia \
--to=darrick.wong@oracle.com \
--cc=bfoster@redhat.com \
--cc=linux-xfs@vger.kernel.org \
--cc=sandeen@sandeen.net \
/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).