All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: sandeen@sandeen.net, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 09/12] xfs_repair: rebuild reverse mapping btrees with bulk loader
Date: Thu, 18 Jun 2020 11:37:40 -0400	[thread overview]
Message-ID: <20200618153740.GE32216@bfoster> (raw)
In-Reply-To: <20200618153100.GG11255@magnolia>

On Thu, Jun 18, 2020 at 08:31:00AM -0700, Darrick J. Wong wrote:
> On Thu, Jun 18, 2020 at 11:25:11AM -0400, Brian Foster wrote:
> > On Mon, Jun 01, 2020 at 09:27:51PM -0700, Darrick J. Wong wrote:
> > > From: Darrick J. Wong <darrick.wong@oracle.com>
> > > 
> > > Use the btree bulk loading functions to rebuild the reverse mapping
> > > btrees and drop the open-coded implementation.
> > > 
> > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > > ---
> > >  libxfs/libxfs_api_defs.h |    1 
> > >  repair/agbtree.c         |   70 ++++++++
> > >  repair/agbtree.h         |    5 +
> > >  repair/phase5.c          |  409 ++--------------------------------------------
> > >  4 files changed, 96 insertions(+), 389 deletions(-)
> > > 
> > > 
> > ...
> > > diff --git a/repair/phase5.c b/repair/phase5.c
> > > index e570349d..1c6448f4 100644
> > > --- a/repair/phase5.c
> > > +++ b/repair/phase5.c
> > ...
> > > @@ -1244,6 +879,8 @@ build_agf_agfl(
> > >  	freelist = xfs_buf_to_agfl_bno(agfl_buf);
> > >  	fill_agfl(btr_bno, freelist, &agfl_idx);
> > >  	fill_agfl(btr_cnt, freelist, &agfl_idx);
> > > +	if (xfs_sb_version_hasrmapbt(&mp->m_sb))
> > > +		fill_agfl(btr_rmap, freelist, &agfl_idx);
> > 
> > Is this new behavior? Either way, I guess it makes sense since the
> > rmapbt feeds from/to the agfl:
> 
> It's a defensive move to make sure we don't lose the blocks if we
> overestimate the size of the rmapbt.  We never did in the past (and we
> shouldn't now) but I figured I should throw that in as a defensive
> measure so we don't leak the blocks if something goes wrong.
> 
> (Granted, I think in the past any overages would have been freed back
> into the filesystem...)
> 

I thought that was still the case since finish_rebuild() moves any
unused blocks over to the lost_fsb slab, which is why I was asking about
the agfl filling specifically..

Brian

> Thanks for the review.
> 
> --D
> 
> > Reviewed-by: Brian Foster <bfoster@redhat.com>
> > 
> > >  
> > >  	/* Set the AGF counters for the AGFL. */
> > >  	if (agfl_idx > 0) {
> > > @@ -1343,7 +980,7 @@ phase5_func(
> > >  	struct bt_rebuild	btr_cnt;
> > >  	struct bt_rebuild	btr_ino;
> > >  	struct bt_rebuild	btr_fino;
> > > -	bt_status_t		rmap_btree_curs;
> > > +	struct bt_rebuild	btr_rmap;
> > >  	bt_status_t		refcnt_btree_curs;
> > >  	int			extra_blocks = 0;
> > >  	uint			num_freeblocks;
> > > @@ -1378,11 +1015,7 @@ _("unable to rebuild AG %u.  Not enough free space in on-disk AG.\n"),
> > >  	init_ino_cursors(&sc, agno, num_freeblocks, &sb_icount_ag[agno],
> > >  			&sb_ifree_ag[agno], &btr_ino, &btr_fino);
> > >  
> > > -	/*
> > > -	 * Set up the btree cursors for the on-disk rmap btrees, which includes
> > > -	 * pre-allocating all required blocks.
> > > -	 */
> > > -	init_rmapbt_cursor(mp, agno, &rmap_btree_curs);
> > > +	init_rmapbt_cursor(&sc, agno, num_freeblocks, &btr_rmap);
> > >  
> > >  	/*
> > >  	 * Set up the btree cursors for the on-disk refcount btrees,
> > > @@ -1448,10 +1081,8 @@ _("unable to rebuild AG %u.  Not enough free space in on-disk AG.\n"),
> > >  	ASSERT(btr_bno.freeblks == btr_cnt.freeblks);
> > >  
> > >  	if (xfs_sb_version_hasrmapbt(&mp->m_sb)) {
> > > -		build_rmap_tree(mp, agno, &rmap_btree_curs);
> > > -		write_cursor(&rmap_btree_curs);
> > > -		sb_fdblocks_ag[agno] += (rmap_btree_curs.num_tot_blocks -
> > > -				rmap_btree_curs.num_free_blocks) - 1;
> > > +		build_rmap_tree(&sc, agno, &btr_rmap);
> > > +		sb_fdblocks_ag[agno] += btr_rmap.newbt.afake.af_blocks - 1;
> > >  	}
> > >  
> > >  	if (xfs_sb_version_hasreflink(&mp->m_sb)) {
> > > @@ -1462,7 +1093,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, &rmap_btree_curs,
> > > +	build_agf_agfl(mp, agno, &btr_bno, &btr_cnt, &btr_rmap,
> > >  			&refcnt_btree_curs, lost_fsb);
> > >  
> > >  	build_inode_btrees(&sc, agno, &btr_ino, &btr_fino);
> > > @@ -1479,7 +1110,7 @@ _("unable to rebuild AG %u.  Not enough free space in on-disk AG.\n"),
> > >  	if (xfs_sb_version_hasfinobt(&mp->m_sb))
> > >  		finish_rebuild(mp, &btr_fino, lost_fsb);
> > >  	if (xfs_sb_version_hasrmapbt(&mp->m_sb))
> > > -		finish_cursor(&rmap_btree_curs);
> > > +		finish_rebuild(mp, &btr_rmap, lost_fsb);
> > >  	if (xfs_sb_version_hasreflink(&mp->m_sb))
> > >  		finish_cursor(&refcnt_btree_curs);
> > >  
> > > 
> > 
> 


  reply	other threads:[~2020-06-18 15:37 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 [this message]
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

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=20200618153740.GE32216@bfoster \
    --to=bfoster@redhat.com \
    --cc=darrick.wong@oracle.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.