All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC 0/8] btrfs: experimental compression support for subpage
@ 2021-06-23  5:55 Qu Wenruo
  2021-06-23  5:55 ` [PATCH RFC 1/8] btrfs: don't pass compressed pages to btrfs_writepage_endio_finish_ordered() Qu Wenruo
                   ` (9 more replies)
  0 siblings, 10 replies; 14+ messages in thread
From: Qu Wenruo @ 2021-06-23  5:55 UTC (permalink / raw)
  To: linux-btrfs

This patchset is based on my previously submitted compression refactor,
which is further based on subpage patchset.

It can be fetched from the following repo:
https://github.com/adam900710/linux/tree/compression

It only has been lightly tested, no stress test/full fstests run yet.
The reason for such a unstable patchset is to get feedback on how to
continue the development, aka the feedback for the last patch.

The first 7 patches are mostly cleanups to make compression path to be
more subpage compatible.

The RFC is for the last patch, which will enable subpage compression in
a pretty controversial way.

The reason is copied from that patch:

```
This mechanism allows btrfs to continue handling next ranges, without
waiting for the time consuming compression.

But this has a problem for subpage case, as we could have the following
delalloc range for a page:

0		32K		64K
|	|///////|	|///////|
		\- A		\- B

In above case, if we pass both range to cow_file_range_async(), both
range A and range B will try to unlock the full page [0, 64K).

And which finishes later than the other range will try to do other page
operatioins like end_page_writeback() on a unlocked page, triggering VM
layer BUG_ON().

Currently I don't have any perfect solution to this, but two
workarounds:

- Only allow compression for fully page aligned range

  This is what I did in this patch.
  By this, the compressed range can exclusively lock the first page
  (and other pages), so they are completely safe to do whatever they
  want.
  The problem is, we will not compress a lot of small writes.
  This is especially problematic as our target page size is 64K, not
  a small size.

- Make cow_file_range_async() to behave like cow_file_range() for
  subpage

  This needs several behavier change, and are all subpage specific:
  * Skip the first page of the range when finished
    Just like cow_file_range()
  * Have a way to wait for the async_cow to finish before handling the
    next delalloc range

  The biggest problem here is the performance impact.
  Although by this we can compress all sector aligned ranges, we will
  waste time waiting for the async_cow to finish.
  This is completely denying the meaning of "async" part.
  Now to mention there are tons of code needs to be changed.

Thus I choose the current way to only compress ranges which is fully
page aligned.
The cost is we will skip a lot of small writes for 64K page size.
```

Any feedback on this part would be pretty helpful.

Qu Wenruo (8):
  btrfs: don't pass compressed pages to
    btrfs_writepage_endio_finish_ordered()
  btrfs: make btrfs_subpage_end_and_test_writer() to handle pages not
    locked by btrfs_page_start_writer_lock()
  btrfs: make compress_file_range() to be subpage compatible
  btrfs: make btrfs_submit_compressed_write() to be subpage compatible
  btrfs: use async_chunk::async_cow to replace the confusing pending
    pointer
  btrfs: make end_compressed_bio_writeback() to be subpage compatble
  btrfs: make extent_write_locked_range() to be subpage compatible
  btrfs: only allow subpage compression if the range fully covers the
    first page

 fs/btrfs/compression.c |  8 +++++--
 fs/btrfs/extent_io.c   |  7 ++++--
 fs/btrfs/inode.c       | 49 +++++++++++++++++++++++++++---------------
 fs/btrfs/subpage.c     | 24 ++++++++++++++++++++-
 4 files changed, 66 insertions(+), 22 deletions(-)

-- 
2.32.0


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2021-07-05 12:43 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-23  5:55 [PATCH RFC 0/8] btrfs: experimental compression support for subpage Qu Wenruo
2021-06-23  5:55 ` [PATCH RFC 1/8] btrfs: don't pass compressed pages to btrfs_writepage_endio_finish_ordered() Qu Wenruo
2021-06-23  5:55 ` [PATCH RFC 2/8] btrfs: make btrfs_subpage_end_and_test_writer() to handle pages not locked by btrfs_page_start_writer_lock() Qu Wenruo
2021-06-23  5:55 ` [PATCH RFC 3/8] btrfs: make compress_file_range() to be subpage compatible Qu Wenruo
2021-06-23  5:55 ` [PATCH RFC 4/8] btrfs: make btrfs_submit_compressed_write() " Qu Wenruo
2021-06-23  5:55 ` [PATCH RFC 5/8] btrfs: use async_chunk::async_cow to replace the confusing pending pointer Qu Wenruo
2021-06-23  5:55 ` [PATCH RFC 6/8] btrfs: make end_compressed_bio_writeback() to be subpage compatble Qu Wenruo
2021-06-23  5:55 ` [PATCH RFC 7/8] btrfs: make extent_write_locked_range() to be subpage compatible Qu Wenruo
2021-07-05 12:43   ` Qu Wenruo
2021-06-23  5:55 ` [PATCH RFC 8/8] btrfs: only allow subpage compression if the range fully covers the first page Qu Wenruo
2021-06-23 21:23 ` [PATCH RFC 0/8] btrfs: experimental compression support for subpage David Sterba
2021-06-24  1:10   ` Qu Wenruo
2021-06-23 22:37 ` David Sterba
2021-06-23 22:54   ` Qu Wenruo

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.