From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH v3 0/3] btrfs: qgroup: Fix the long existing regression of btrfs/153
Date: Wed, 8 Jul 2020 14:24:44 +0800 [thread overview]
Message-ID: <20200708062447.81341-1-wqu@suse.com> (raw)
Since commit c6887cd11149 ("Btrfs: don't do nocow check unless we have to"),
btrfs/153 always fails with early EDQUOT.
This is caused by the fact that:
- We always reserved data space for even NODATACOW buffered write
This is mostly to improve performance, and not pratical to revert.
- Btrfs qgroup data and meta reserved space share the same limit
So it's not ensured to return EDQUOT just for that data reservation,
metadata reservation can also get EDQUOT, means we can't go the same
solution as that commit.
This patchset will solve it by doing extra qgroup space flushing when
EDQUOT is hit.
This is a little like what we do in ticketing space reservation system,
but since there are very limited ways for qgroup to reclaim space,
currently it's still handled in qgroup realm, not reusing the ticketing
system yet.
By this, this patch could solve the btrfs/153 problem, while still keep
btrfs qgroup space usage under the limit.
The only cost is, when we're near qgroup limit, we will cause more dirty
inodes flush and transaction commit, much like what we do when the
metadata space is near exhausted.
So the cost should be still acceptable.
Changelog:
v2:
- Use existing ulist infrastructure
Thanks to the advice from Josef, we can just iterate the ulist nodes
inside the failure range to remove the offending nodes.
And since already dirtied range won't show up in the current extent
changeset, we won't clear existing range.
This saves around 100 new lines
- Remove the use of "Revert" in the 3rd cleanup patch
We're not reverting to fix some regression, but just remove some
deprecated mechanism which was designed to partially solve the
problem.
v3:
- Fix a variable shadowing bug
In the 2nd patch, there was a variable shadowing bug, which overrides
the @start and @len parameter.
- Update the commit message for the first patch
To make the cause more obvious
- Use cleaner if condition before try_flush_qgroup()
Qu Wenruo (3):
btrfs: qgroup: allow btrfs_qgroup_reserve_data() to revert the range
it just set without releasing other existing ranges
btrfs: qgroup: try to flush qgroup space when we get -EDQUOT
btrfs: qgroup: remove the ASYNC_COMMIT mechanism in favor of qgroup
reserve retry-after-EDQUOT
fs/btrfs/ctree.h | 6 +-
fs/btrfs/disk-io.c | 2 +-
fs/btrfs/qgroup.c | 234 ++++++++++++++++++++++++++++++-----------
fs/btrfs/transaction.c | 1 -
fs/btrfs/transaction.h | 14 ---
5 files changed, 172 insertions(+), 85 deletions(-)
--
2.27.0
next reply other threads:[~2020-07-08 6:25 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-08 6:24 Qu Wenruo [this message]
2020-07-08 6:24 ` [PATCH v3 1/3] btrfs: qgroup: allow btrfs_qgroup_reserve_data() to revert the range it just set without releasing other existing ranges Qu Wenruo
2020-07-08 14:09 ` Josef Bacik
2020-07-08 23:21 ` Qu Wenruo
2020-07-09 16:02 ` David Sterba
2020-07-13 0:01 ` Qu Wenruo
2020-07-08 6:24 ` [PATCH v3 2/3] btrfs: qgroup: try to flush qgroup space when we get -EDQUOT Qu Wenruo
2020-07-08 14:10 ` Josef Bacik
2020-07-09 16:32 ` David Sterba
2020-07-09 17:40 ` David Sterba
2020-07-09 23:06 ` Qu Wenruo
2020-07-08 6:24 ` [PATCH v3 3/3] btrfs: qgroup: remove the ASYNC_COMMIT mechanism in favor of qgroup reserve retry-after-EDQUOT Qu Wenruo
2020-07-09 16:38 ` David Sterba
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=20200708062447.81341-1-wqu@suse.com \
--to=wqu@suse.com \
--cc=linux-btrfs@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).