From: Filipe Manana <[email protected]>
The following patchset fixes 2 bugs with the swapfile support, where we can
end up falling back to COW when writing to an active swapfile. The first patch
is actually independent and just makes the nocow buffered IO path more efficient
by eliminating a repeated check for a read-only block group.
V2: Removed the part of optimizing the direct IO nocow path from patch 2,
because removing the RO block group check from can_nocow_extent() would
leave the buffered write path that checks if we can fallback to nocow at
write time (and not writeback time), after hitting ENOSPC when attempting
to reserve data space, from doing that check. The optimization can still
be done, but that would require adding more context information to
can_nocow_extent(), so it could know when it needs to check if the block
group is RO or not - since things are a bit entangled around that function
and its callers, I've left it out for now.
Filipe Manana (3):
btrfs: avoid checking for RO block group twice during nocow writeback
btrfs: fix race between writes to swap files and scrub
btrfs: fix race between swap file activation and snapshot creation
fs/btrfs/block-group.c | 33 ++++++++++++++++++++++++++++++-
fs/btrfs/block-group.h | 9 +++++++++
fs/btrfs/ctree.h | 5 +++++
fs/btrfs/inode.c | 44 ++++++++++++++++++++++++++++++++++++------
fs/btrfs/scrub.c | 9 ++++++++-
5 files changed, 92 insertions(+), 8 deletions(-)
--
2.28.0