From: Gao Xiang <hsiangkao@redhat.com>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: linux-xfs@vger.kernel.org,
"Darrick J. Wong" <darrick.wong@oracle.com>,
Brian Foster <bfoster@redhat.com>,
Eric Sandeen <sandeen@sandeen.net>,
Dave Chinner <david@fromorbit.com>,
Christoph Hellwig <hch@infradead.org>
Subject: Re: [PATCH v5 4/5] xfs: support shrinking unused space in the last AG
Date: Thu, 21 Jan 2021 04:31:40 +0800 [thread overview]
Message-ID: <20210120203140.GA2802723@xiangao.remote.csb> (raw)
In-Reply-To: <20210120202259.GA2800037@xiangao.remote.csb>
On Thu, Jan 21, 2021 at 04:22:59AM +0800, Gao Xiang wrote:
... (cont..)
>
> >
> > > + err2 = xfs_ag_resv_init(agibp->b_pag, tp);
> > > + if (err2)
> > > + goto resv_err;
> > > + return error;
> > > + }
> > > +
> > > + /*
> > > + * if successfully deleted from freespace btrees, need to confirm
> > > + * per-AG reservation works as expected.
> > > + */
> > > + be32_add_cpu(&agi->agi_length, -len);
> > > + be32_add_cpu(&agf->agf_length, -len);
> > > +
> > > + err2 = xfs_ag_resv_init(agibp->b_pag, tp);
> > > + if (err2) {
> > > + be32_add_cpu(&agi->agi_length, len);
> > > + be32_add_cpu(&agf->agf_length, len);
> > > + if (err2 != -ENOSPC)
> > > + goto resv_err;
> >
> > If we've just undone reducing ag[if]_length, don't we need to call
> > xfs_ag_resv_init here to (try to) recreate the former per-ag
> > reservations?
>
> If my understanding is correct, xfs_fs_reserve_ag_blocks() in
> xfs_growfs_data_private() would do that for all AGs... Do we
> need to xfs_ag_resv_init() in advance here?
>
> I thought xfs_ag_resv_init() here is mainly used to guarantee the
> per-AG reservation for resized size is fine... if ag{i,f}_length
> don't change, leave such normal reservation to
> xfs_fs_reserve_ag_blocks() would be okay?
>
Although When xfs_fs_reserve_ag_blocks(), the transaction has already
been commited, the last AG is unlocked. So there might be some race
window here... So I will update it, thanks for this!
Thanks,
Gao Xiang
next prev parent reply other threads:[~2021-01-20 20:34 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-18 8:36 [PATCH v5 0/5] xfs: support shrinking free space in the last AG Gao Xiang
2021-01-18 8:36 ` [PATCH v5 1/5] xfs: rename `new' to `delta' in xfs_growfs_data_private() Gao Xiang
2021-01-18 8:36 ` [PATCH v5 2/5] xfs: get rid of xfs_growfs_{data,log}_t Gao Xiang
2021-01-18 8:36 ` [PATCH v5 3/5] xfs: hoist out xfs_resizefs_init_new_ags() Gao Xiang
2021-01-18 8:36 ` [PATCH v5 4/5] xfs: support shrinking unused space in the last AG Gao Xiang
2021-01-20 19:25 ` Darrick J. Wong
2021-01-20 20:22 ` Gao Xiang
2021-01-20 20:31 ` Gao Xiang [this message]
2021-01-21 1:51 ` Gao Xiang
2021-01-18 8:37 ` [PATCH v5 5/5] xfs: add error injection for per-AG resv failure when shrinkfs Gao Xiang
2021-01-20 19:25 ` 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=20210120203140.GA2802723@xiangao.remote.csb \
--to=hsiangkao@redhat.com \
--cc=bfoster@redhat.com \
--cc=darrick.wong@oracle.com \
--cc=david@fromorbit.com \
--cc=djwong@kernel.org \
--cc=hch@infradead.org \
--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;
as well as URLs for NNTP newsgroup(s).