All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gao Xiang <hsiangkao@redhat.com>
To: Dave Chinner <david@fromorbit.com>
Cc: linux-xfs@vger.kernel.org, Dave Chinner <dchinner@redhat.com>,
	"Darrick J. Wong" <darrick.wong@oracle.com>
Subject: Re: [PATCH v2] xfs: get rid of unnecessary xfs_perag_{get,put} pairs
Date: Fri, 5 Jun 2020 09:44:47 +0800	[thread overview]
Message-ID: <20200605014447.GA25293@xiangao.remote.csb> (raw)
In-Reply-To: <20200604215917.GS2040@dread.disaster.area>

On Fri, Jun 05, 2020 at 07:59:17AM +1000, Dave Chinner wrote:
> On Wed, Jun 03, 2020 at 08:11:56PM +0800, Gao Xiang wrote:

...

> 
> Ok, I think we had a small misunderstanding there. I was trying to
> say the asserts that were in the first patch were fine, but we
> didn't really need any more because the new asserts mostly matched
> an existing pattern.
> 
> I wasn't suggesting that we do this everywhere:
> 
> > diff --git a/fs/xfs/libxfs/xfs_ag.c b/fs/xfs/libxfs/xfs_ag.c
> > index 9d84007a5c65..4b8c7cb87b84 100644
> > --- a/fs/xfs/libxfs/xfs_ag.c
> > +++ b/fs/xfs/libxfs/xfs_ag.c
> > @@ -563,7 +563,9 @@ xfs_ag_get_geometry(
> >  	error = xfs_alloc_read_agf(mp, NULL, agno, 0, &agf_bp);
> >  	if (error)
> >  		goto out_agi;
> > -	pag = xfs_perag_get(mp, agno);
> > +
> > +	pag = agi_bp->b_pag;
> > +	ASSERT(pag->pag_agno == agno);
> 
> .... because we've already checked this in xfs_ialloc_read_agi() a
> few lines of code back up the function.
> 
> That's the pattern I was refering to - we tend to check
> relationships when they are first brought into a context, then we
> don't need to check them again in that context.  Hence the asserts
> in xfs_ialloc_read_agi() and xfs_alloc_read_agf() effectively cover
> all the places where we pull the pag from those buffers, and so
> there's no need to validate the correct perag is attached to the
> buffer every time we access it....

Sorry about that, I folded in ASSERTs of my debugging code at that time.
Because that is the straight way to check if somewhere has strange due
to my modification, but some are unnecessary really, I didn't check that,
sorry about that. I will check again and remove unneeded ASSERTs
in the next version.

Thanks,
Gao Xiang

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


  reply	other threads:[~2020-06-05  1:45 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
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 [this message]
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=20200605014447.GA25293@xiangao.remote.csb \
    --to=hsiangkao@redhat.com \
    --cc=darrick.wong@oracle.com \
    --cc=david@fromorbit.com \
    --cc=dchinner@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 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.