Thread (17 messages) 17 messages, 4 authors, 2021-06-22

Re: [PATCH v4 0/9] btrfs: compression: refactor and enhancement preparing for subpage compression support

From: David Sterba <hidden>
Date: 2021-06-17 16:49:55

On Thu, Jun 17, 2021 at 01:14:41PM +0800, Qu Wenruo wrote:
There are quite some problems in compression code:

- Weird compressed_bio::pending_bios dance
  If we just don't want compressed_bio being freed halfway, we have more
  sane methods, just like btrfs_subpage::readers.

  So here we fix it by introducing compressed_bio::io_sectors to do the
  job.

- BUG_ON()s inside btrfs_submit_compressed_*()
  Even they are just ENOMEM, we should handle them.
  With io_sectors introduced, we have a way to finish compressed_bio
  all by ourselves, as long as we haven't submitted last bio.

  If we have last bio submitted, then endio will handle it well.

- Duplicated code for compressed bio allocation and submission
  Just small refactor can handle it

- Stripe boundary is checked every time one page is added
  This is overkilled.
  Just learn from extent_io.c refactor which use bio_ctrl to do the
  boundary check only once for each bio.

  Although in compression context, we don't need extra checks in
  extent_io.c, thus we don't need bio_ctrl structure, but
  can afford to do it locally.

- Dead code removal
  One dead comment and a new zombie function,
  btrfs_bio_fits_in_stripe(), can be removed now.
I went through it several times, the changes are scary, but the overall
direction is IMHO the right one, not to say it's fixing the difficult
BUG_ONs.

I'll put it to for-next once it passes a few rounds of fstests. Taking
it to 5.14 could be risky if we don't have enough review and testing,
time is almost up before the code freeze.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help