From: Josef Bacik <josef@toxicpanda.com>
To: linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: [PATCH 0/3] btrfs: no longer hold the extent lock for the entire read
Date: Wed, 21 Aug 2024 12:01:58 -0400 [thread overview]
Message-ID: <cover.1724255475.git.josef@toxicpanda.com> (raw)
Hello,
One of the biggest obstacles to switching to iomap is that our extent locking is
a bit wonky. We've made a lot of progress on the write side to drastically
narrow the scope of the extent lock, but the read side is arguably the most
problematic in that we hold it until the readpage is completed.
This patch series addresses this by no longer holding the lock for the entire
IO. This is safe on the buffered side because we are protected by the page lock
and the checks for ordered extents when we start the write.
The direct io side is the more problematic side, since we could now end up with
overlapping and concurrent direct writes in direct read ranges. To solve this
problem I'm introducing a new extent io bit to do range locking for direct IO.
This will work basically the same as the extent lock did before, but only for
direct IO. We are saved by the normal inode lock and page cache in the mixed
buffered and direct case, so this shouldn't carry the same iomap+locking
reloated woes that the extent lock did.
This will also allow us to remove the page fault restrictions in the direct IO
case, which will be done in a followup series.
I've run this through the CI and a lot of local testing, I'm keeping it small
and targeted because this is a pretty big logical shift for us, so I want to
make sure we get good testing on it before I go doing the other larger projects.
Thanks,
Josef
Josef Bacik (3):
btrfs: introduce EXTENT_DIO_LOCKED
btrfs: take the dio extent lock during O_DIRECT operations
btrfs: do not hold the extent lock for entire read
fs/btrfs/compression.c | 2 +-
fs/btrfs/direct-io.c | 72 ++++++++++++++++++++------------
fs/btrfs/extent-io-tree.c | 52 +++++++++++------------
fs/btrfs/extent-io-tree.h | 38 +++++++++++++++--
fs/btrfs/extent_io.c | 88 +++------------------------------------
5 files changed, 111 insertions(+), 141 deletions(-)
--
2.43.0
next reply other threads:[~2024-08-21 16:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-21 16:01 Josef Bacik [this message]
2024-08-21 16:01 ` [PATCH 1/3] btrfs: introduce EXTENT_DIO_LOCKED Josef Bacik
2024-08-21 16:02 ` [PATCH 2/3] btrfs: take the dio extent lock during O_DIRECT operations Josef Bacik
2024-08-21 16:02 ` [PATCH 3/3] btrfs: do not hold the extent lock for entire read Josef Bacik
2024-08-24 16:03 ` Goldwyn Rodrigues
2024-08-26 14:49 ` Josef Bacik
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=cover.1724255475.git.josef@toxicpanda.com \
--to=josef@toxicpanda.com \
--cc=kernel-team@fb.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).