linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Dave Chinner <david@fromorbit.com>
Cc: Gao Xiang <hsiangkao@redhat.com>, linux-xfs@vger.kernel.org
Subject: Re: [PATCH] xfs: get rid of unnecessary xfs_perag_{get,put} pairs
Date: Tue, 2 Jun 2020 17:48:52 -0700	[thread overview]
Message-ID: <20200603004852.GY8230@magnolia> (raw)
In-Reply-To: <20200603004429.GK2040@dread.disaster.area>

On Wed, Jun 03, 2020 at 10:44:29AM +1000, Dave Chinner wrote:
> On Tue, Jun 02, 2020 at 05:22:22PM -0700, Darrick J. Wong wrote:
> > On Tue, Jun 02, 2020 at 10:52:38PM +0800, Gao Xiang wrote:
> > > Sometimes no need to play with perag_tree since for many
> > > cases perag can also be accessed by agbp reliably.
> > > 
> > > Signed-off-by: Gao Xiang <hsiangkao@redhat.com>
> > > ---
> ....
> > > @@ -2447,32 +2443,22 @@ xfs_iunlink_remove(
> > >  	 * this inode's backref to point from the next inode.
> > >  	 */
> > >  	if (next_agino != NULLAGINO) {
> > > -		pag = xfs_perag_get(mp, agno);
> > > -		error = xfs_iunlink_change_backref(pag, next_agino,
> > > +		error = xfs_iunlink_change_backref(agibp->b_pag, next_agino,
> > >  				NULLAGINO);
> > >  		if (error)
> > > -			goto out;
> > > +			return error;
> > >  	}
> > >  
> > > -	if (head_agino == agino) {
> > > -		/* Point the head of the list to the next unlinked inode. */
> > > -		error = xfs_iunlink_update_bucket(tp, agno, agibp, bucket_index,
> > > -				next_agino);
> > > -		if (error)
> > > -			goto out;
> > > -	} else {
> > > +	if (head_agino != agino) {
> > >  		struct xfs_imap	imap;
> > >  		xfs_agino_t	prev_agino;
> > >  
> > > -		if (!pag)
> > > -			pag = xfs_perag_get(mp, agno);
> > > -
> > >  		/* We need to search the list for the inode being freed. */
> > >  		error = xfs_iunlink_map_prev(tp, agno, head_agino, agino,
> > >  				&prev_agino, &imap, &last_dip, &last_ibp,
> > > -				pag);
> > > +				agibp->b_pag);
> > >  		if (error)
> > > -			goto out;
> > > +			return error;
> > >  
> > >  		/* Point the previous inode on the list to the next inode. */
> > >  		xfs_iunlink_update_dinode(tp, agno, prev_agino, last_ibp,
> > > @@ -2486,15 +2472,13 @@ xfs_iunlink_remove(
> > >  		 * change_backref takes care of deleting the backref if
> > >  		 * next_agino is NULLAGINO.
> > >  		 */
> > > -		error = xfs_iunlink_change_backref(pag, agino, next_agino);
> > > -		if (error)
> > > -			goto out;
> > > +		return xfs_iunlink_change_backref(agibp->b_pag, agino,
> > > +				next_agino);
> > >  	}
> > >  
> > > -out:
> > > -	if (pag)
> > > -		xfs_perag_put(pag);
> > > -	return error;
> > > +	/* Point the head of the list to the next unlinked inode. */
> > > +	return xfs_iunlink_update_bucket(tp, agno, agibp, bucket_index,
> > > +			next_agino);
> > 
> > Why not cut out the agno argument here too?  Surely you could obtain it
> > from agibp->b_pag->pag_agno.  Ditto for xfs_iunlink_map_prev.
> 
> Those functions go away completely in the patchset I'm currently
> working on for tracking dirty inodes in ordered buffers. The
> in-memory unlinked list code needs to be completely reworked to
> acheive this (due to lock order constraints), so I'd much prefer
> unnecessary cleanup changes in this area are kept to a minimum
> because it will all away real soon.
> 
> FWIW, it was the discovery we could use agibp->b_pag instead of
> get/put in my iunlink list rework that prompted me to ask Xiang to
> look at the rest of the code and see where the same pattern could be
> applied...

Aha!  I wondered.  Ok, let's just leave this part alone then?  No harm
nor foul letting it stay in the meantime. :)

--D

> Cheers,
> 
> Dave.
> -- 
> Dave Chinner
> david@fromorbit.com

  reply	other threads:[~2020-06-03  0:48 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-02 14:52 [PATCH] xfs: get rid of unnecessary xfs_perag_{get,put} pairs Gao Xiang
2020-06-03  0:22 ` Darrick J. Wong
2020-06-03  0:44   ` Dave Chinner
2020-06-03  0:48     ` Darrick J. Wong [this message]
2020-06-03  0:49   ` Gao Xiang
2020-06-03  1:27 ` Dave Chinner
2020-06-03  1:40   ` Gao Xiang
2020-06-03  3:02     ` Dave Chinner
2020-06-03  3:19       ` Gao Xiang
2020-06-03 12:11 ` [PATCH v2] " Gao Xiang
2020-06-04 21:59   ` Dave Chinner
2020-06-05  1:44     ` Gao Xiang
2020-06-05  8:52   ` [PATCH v3] " Gao Xiang
2020-06-05 15:56     ` Darrick J. Wong
2020-06-05 18:30       ` Gao Xiang
2020-06-05 18:47         ` Gao Xiang
2020-06-23 10:08           ` Gao Xiang
2020-07-13  8:53     ` [PATCH v4] " Gao Xiang
2020-07-13 16:12       ` 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=20200603004852.GY8230@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=david@fromorbit.com \
    --cc=hsiangkao@redhat.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).