From: "Darrick J. Wong" <djwong@kernel.org>
To: Brian Foster <bfoster@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>,
linux-xfs@vger.kernel.org, hch@infradead.org,
david@fromorbit.com
Subject: Re: [PATCH 12/12] xfs: flush speculative space allocations when we run out of space
Date: Fri, 29 Jan 2021 09:34:30 -0800 [thread overview]
Message-ID: <20210129173430.GH7695@magnolia> (raw)
In-Reply-To: <20210129161047.GH2665284@bfoster>
On Fri, Jan 29, 2021 at 11:10:47AM -0500, Brian Foster wrote:
> On Thu, Jan 28, 2021 at 06:18:54PM -0800, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> >
> > If a fs modification (creation, file write, reflink, etc.) is unable to
> > reserve enough space to handle the modification, try clearing whatever
> > space the filesystem might have been hanging onto in the hopes of
> > speeding up the filesystem. The flushing behavior will become
> > particularly important when we add deferred inode inactivation because
> > that will increase the amount of space that isn't actively tied to user
> > data.
> >
> > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> > Reviewed-by: Christoph Hellwig <hch@lst.de>
> > ---
> > fs/xfs/xfs_trans.c | 12 ++++++++++++
> > 1 file changed, 12 insertions(+)
> >
> >
> > diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
> > index b08bb5a8fb60..3c2b26a21c6d 100644
> > --- a/fs/xfs/xfs_trans.c
> > +++ b/fs/xfs/xfs_trans.c
> > @@ -289,6 +289,18 @@ xfs_trans_alloc(
> > tp->t_firstblock = NULLFSBLOCK;
> >
> > error = xfs_trans_reserve(tp, resp, blocks, rtextents);
> > + if (error == -ENOSPC) {
> > + /*
> > + * We weren't able to reserve enough space for the transaction.
> > + * Flush the other speculative space allocations to free space.
> > + * Do not perform a synchronous scan because callers can hold
> > + * other locks.
> > + */
> > + error = xfs_blockgc_free_space(mp, NULL);
> > + if (error)
> > + return error;
> > + error = xfs_trans_reserve(tp, resp, blocks, rtextents);
> > + }
>
> We probably want to cancel the transaction if the scan fails. Perhaps
> tweak this to:
>
> ...
> error = xfs_blockgc_free_space(mp, NULL);
> if (!error)
> error = xfs_trans_reserve(tp, resp, blocks, rtextents);
> }
> ...
>
> Hm?
Doh, yes, good catch! Will fix.
--D
> Brian
>
> > if (error) {
> > xfs_trans_cancel(tp);
> > return error;
> >
>
next prev parent reply other threads:[~2021-01-29 17:37 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-29 2:17 [PATCHSET v6 00/12] xfs: try harder to reclaim space when we run out Darrick J. Wong
2021-01-29 2:17 ` [PATCH 01/12] xfs: trigger all block gc scans when low on quota space Darrick J. Wong
2021-01-29 2:17 ` [PATCH 02/12] xfs: don't stall cowblocks scan if we can't take locks Darrick J. Wong
2021-01-29 2:18 ` [PATCH 03/12] xfs: xfs_inode_free_quota_blocks should scan project quota Darrick J. Wong
2021-01-29 2:18 ` [PATCH 04/12] xfs: move and rename xfs_inode_free_quota_blocks to avoid conflicts Darrick J. Wong
2021-01-29 2:18 ` [PATCH 05/12] xfs: pass flags and return gc errors from xfs_blockgc_free_quota Darrick J. Wong
2021-01-29 2:18 ` [PATCH 06/12] xfs: try worst case space reservation upfront in xfs_reflink_remap_extent Darrick J. Wong
2021-01-29 2:18 ` [PATCH 07/12] xfs: flush eof/cowblocks if we can't reserve quota for file blocks Darrick J. Wong
[not found] ` <20210129160944.GE2665284@bfoster>
2021-01-29 17:47 ` Darrick J. Wong
2021-01-29 2:18 ` [PATCH 08/12] xfs: flush eof/cowblocks if we can't reserve quota for inode creation Darrick J. Wong
2021-01-29 2:18 ` [PATCH 09/12] xfs: flush eof/cowblocks if we can't reserve quota for chown Darrick J. Wong
2021-01-29 2:18 ` [PATCH 10/12] xfs: add a tracepoint for blockgc scans Darrick J. Wong
2021-01-29 2:18 ` [PATCH 11/12] xfs: refactor xfs_icache_free_{eof,cow}blocks call sites Darrick J. Wong
2021-01-29 2:18 ` [PATCH 12/12] xfs: flush speculative space allocations when we run out of space Darrick J. Wong
[not found] ` <20210129161047.GH2665284@bfoster>
2021-01-29 17:34 ` Darrick J. Wong [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-02-01 2:05 [PATCHSET v7 00/12] xfs: try harder to reclaim space when we run out Darrick J. Wong
2021-02-01 2:06 ` [PATCH 12/12] xfs: flush speculative space allocations when we run out of space Darrick J. Wong
2021-02-02 15:39 ` Brian Foster
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=20210129173430.GH7695@magnolia \
--to=djwong@kernel.org \
--cc=bfoster@redhat.com \
--cc=david@fromorbit.com \
--cc=hch@infradead.org \
--cc=hch@lst.de \
--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