From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH v3 0/3] btrfs: allow btrfs_truncate_block() to fallback to nocow for data space reservation
Date: Thu, 18 Jun 2020 15:49:47 +0800 [thread overview]
Message-ID: <20200618074950.136553-1-wqu@suse.com> (raw)
Before this patch, btrfs_truncate_block() never checks the NODATACOW
bit, thus when we run out of data space, we can return ENOSPC for
truncate for NODATACOW inode.
This patchset will address this problem by doing the same behavior as
buffered write to address it.
Changelog:
v2:
- Rebased to misc-next
Only one minor conflict in ctree.h
v3:
- Added two new patches
- Refactor check_can_nocow()
Since the introduction of nowait, check_can_nocow() are in fact split
into two usage patterns: check_can_nocow(nowait = false) with
btrfs_drew_write_unlock(), and single check_can_nocow(nowait = true).
Refactor them into two functions: start_nocow_check() paired with
end_nocow_check(), and single try_nocow_check(). With comment added.
- Rebased to latest misc-next
- Added btrfs_assert_drew_write_locked() for btrfs_end_nocow_check()
This is a little concerning one, as it's in the hot path of buffered
write.
It has percpu_counter_sum() called in that hot path, causing
obvious performance drop for CONFIG_BTRFS_DEBUG build.
Not sure if the assert is worthy since there aren't any other users.
Qu Wenruo (3):
btrfs: add comments for check_can_nocow() and can_nocow_extent()
btrfs: refactor check_can_nocow() into two variants
btrfs: allow btrfs_truncate_block() to fallback to nocow for data
space reservation
fs/btrfs/ctree.h | 3 +++
fs/btrfs/file.c | 52 +++++++++++++++++++++++++++++++++------
fs/btrfs/inode.c | 61 ++++++++++++++++++++++++++++++++++++++++------
fs/btrfs/locking.h | 13 ++++++++++
4 files changed, 113 insertions(+), 16 deletions(-)
--
2.27.0
next reply other threads:[~2020-06-18 7:49 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-18 7:49 Qu Wenruo [this message]
2020-06-18 7:49 ` [PATCH v3 1/3] btrfs: add comments for check_can_nocow() and can_nocow_extent() Qu Wenruo
2020-06-18 11:57 ` Johannes Thumshirn
2020-06-18 12:00 ` Qu Wenruo
2020-06-18 12:14 ` Johannes Thumshirn
2020-06-18 15:14 ` David Sterba
2020-06-18 7:49 ` [PATCH v3 2/3] btrfs: refactor check_can_nocow() into two variants Qu Wenruo
2020-06-18 12:05 ` Johannes Thumshirn
2020-06-18 12:09 ` Qu Wenruo
2020-06-18 12:16 ` Johannes Thumshirn
2020-06-18 12:35 ` Qu Wenruo
2020-06-18 15:24 ` David Sterba
2020-06-18 7:49 ` [PATCH v3 3/3] btrfs: allow btrfs_truncate_block() to fallback to nocow for data space reservation Qu Wenruo
2020-06-18 15:29 ` [PATCH v3 0/3] " 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=20200618074950.136553-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.