linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-xfs <linux-xfs@vger.kernel.org>,
	Hou Tao <houtao1@huawei.com>, Amir Goldstein <amir73il@gmail.com>
Subject: Re: [PATCH] xfs: log recovery should replay deferred ops in order
Date: Mon, 27 Nov 2017 09:50:53 -0800	[thread overview]
Message-ID: <20171127175053.GD19379@magnolia> (raw)
In-Reply-To: <20171123133640.GA27935@lst.de>

On Thu, Nov 23, 2017 at 02:36:40PM +0100, Christoph Hellwig wrote:
> Hi Darrick,
> 
> this looks generally good to me:
> 
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> 
> But I have a few nitpicks below:
> 
> > +	/*
> > +	 * We're finishing the defer_ops that accumulated as a result of
> > +	 * recovering unfinished intent items during log recovery.  We
> > +	 * reserve an itruncate transaction because it is the largest
> > +	 * permanent transaction type.  Since we're the only user of the
> > +	 * fs right now, take 93% of the available free blocks.  Use
> > +	 * weird math to avoid a 64-bit division.
> > +	 */
> 
> Those magic 93% are 15/16th, maybe better to write it that way :)

Ok, will update comment.

> That being said / 16 still is a 64-bit division, and I'm pretty sure
> we'll run into an old gcc on some weird architecture that will not
> turn it into a shift, so better write it as a shift to start with.

It shouldn't be, since resblks is unsigned int, which afaik is 32-bit.
But meh, I'll just change it to ">> 4" to make it obvious.

> > +	freeblks = percpu_counter_sum(&mp->m_fdblocks);
> > +	resblks = min_t(s64, UINT_MAX, freeblks);
> 
> Didn't I just got called out for using u* types?  The same applies
> to s*, so use int64_t here to be consistent.

Yeah... I pulled the return type directly from percpu_counter_sum, sigh.
Will change to int64_t.

> > +		/*
> > +		 * NOTE: If your intent processing routine can create
> > +		 * more deferred ops, you /must/ attach them to the
> > +		 * dfops in this routine or else those subsequent
> > +		 * intents will get replayed in the wrong order!
> > +		 */
> 
> Please use up all available 80 characters for your comments.

Ok, will fix the comment.

--D

> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2017-11-27 17:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-22 18:29 [PATCH] xfs: log recovery should replay deferred ops in order Darrick J. Wong
2017-11-23 10:46 ` Amir Goldstein
2017-11-23 13:36 ` Christoph Hellwig
2017-11-27 17:50   ` Darrick J. Wong [this message]
2017-11-30 20:31 ` Amir Goldstein

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=20171127175053.GD19379@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=amir73il@gmail.com \
    --cc=hch@lst.de \
    --cc=houtao1@huawei.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).