public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Gao Xiang <hsiangkao@redhat.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org, Brian Foster <bfoster@redhat.com>,
	Eric Sandeen <sandeen@sandeen.net>
Subject: Re: [PATCH v3 4/4] xfs: support shrinking unused space in the last AG
Date: Sat, 9 Jan 2021 08:47:41 +0800	[thread overview]
Message-ID: <20210109004741.GA660098@xiangao.remote.csb> (raw)
In-Reply-To: <20210108211942.GQ38809@magnolia>

Hi Darrick,

On Fri, Jan 08, 2021 at 01:19:42PM -0800, Darrick J. Wong wrote:
> On Sat, Jan 09, 2021 at 03:09:19AM +0800, Gao Xiang wrote:

...

> >  	delta = nb;	/* use delta as a temporary here */
> 
> Yikes, can this become a separate variable please?

Ok.

> 
> >  	nb_mod = do_div(delta, mp->m_sb.sb_agblocks);
> > @@ -99,10 +102,18 @@ xfs_growfs_data_private(
> >  	if (nb_mod && nb_mod < XFS_MIN_AG_BLOCKS) {
> >  		nagcount--;
> >  		nb = (xfs_rfsblock_t)nagcount * mp->m_sb.sb_agblocks;
> > -		if (nb < mp->m_sb.sb_dblocks)
> > +		if (nagcount < 2)
> >  			return -EINVAL;
> >  	}
> > -	delta = nb - mp->m_sb.sb_dblocks;
> > +
> > +	if (nb > mp->m_sb.sb_dblocks) {
> > +		delta = nb - mp->m_sb.sb_dblocks;
> > +		extend = true;
> > +	} else {
> > +		delta = mp->m_sb.sb_dblocks - nb;
> > +		extend = false;
> 
> /me wonders why delta isn't simply int64_t, and then you can do things
> like:
> 
> if (delta > 0)
> 	growfs
> else if (delta < 0)
> 	shrinkfs
> 
> ?

Yeah, delta changed into a signed variable in mycurrent experimental
shrinking entire AG hack as well. Will update this here in advance.

Thanks,
Gao Xiang


      reply	other threads:[~2021-01-09  0:49 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-08 19:09 [PATCH v3 0/4] xfs: support shrinking free space in the last AG Gao Xiang
2021-01-08 19:09 ` [PATCH v3 1/4] xfs: rename `new' to `delta' in xfs_growfs_data_private() Gao Xiang
2021-01-08 21:23   ` Darrick J. Wong
2021-01-08 19:09 ` [PATCH v3 2/4] xfs: get rid of xfs_growfs_{data,log}_t Gao Xiang
2021-01-08 21:21   ` Darrick J. Wong
2021-01-08 21:27     ` Eric Sandeen
2021-01-09  0:49       ` Gao Xiang
2021-01-10 21:04         ` Dave Chinner
2021-01-11  0:17           ` Gao Xiang
2021-01-11 17:30             ` Christoph Hellwig
2021-01-11 18:02               ` Gao Xiang
2021-01-08 19:09 ` [PATCH v3 3/4] xfs: hoist out xfs_resizefs_init_new_ags() Gao Xiang
2021-01-08 21:20   ` Darrick J. Wong
2021-01-11 17:32   ` Christoph Hellwig
2021-01-11 17:47     ` Gao Xiang
2021-01-08 19:09 ` [PATCH v3 4/4] xfs: support shrinking unused space in the last AG Gao Xiang
2021-01-08 21:19   ` Darrick J. Wong
2021-01-09  0:47     ` Gao Xiang [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=20210109004741.GA660098@xiangao.remote.csb \
    --to=hsiangkao@redhat.com \
    --cc=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox