Skip to content

btrfs: cleanups and preparation for the incoming RAID56J features

Qu Wenruo linux-btrfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 12 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4btrfs: remove @dev_extent_len argument from scrub_stripe() functionfs/btrfs/scrub.c fs/btrfs/volumes.c fs/btrfs/volumes.h+14 -121 reply
2/4btrfs: use btrfs_chunk_max_errors() to replace weird tolerance calculationfs/btrfs/volumes.c+1 -11 reply
3/4btrfs: use btrfs_raid_array[] to calculate the number of parity stripesfs/btrfs/raid56.c fs/btrfs/raid56.h fs/btrfs/volumes.c +1 more+12 -181 reply
4/4btrfs: use btrfs_raid_array[].ncopies in btrfs_num_copies()fs/btrfs/volumes.c+7 -74 replies

Reviews trailers per patch

All 4 patches have a Reviewed-by or Acked-by.

PatchJohannes Thumshirn
1/4R-b
2/4R-b
3/4R-b
4/4R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/4] btrfs: cleanups and preparation for the incoming RAID56J features

Since I'm going to introduce two new chunk profiles, RAID5J and RAID6J (J for journal), if we're relying on ad-hoc if () else if () branches to calculate thing like number of p/q stripes, it will cause a lot of problems.

In fact, during my development, I have hit tons of bugs related to this.

One example is alloc_rbio(), it will assign rbio->nr_data, if we forgot to update the check for RAID5 and RAID6 profiles, we will got a bad nr_data == num_stripes, and screw up later writeback.

90% of my suffering comes from such ad-hoc usage doing manual checks on RAID56.

Another example is, scrub_stripe() which due to the extra per-device reservation, @dev_extent_len is no longer the same the data stripe length calculated from extent_map.

So this patchset will do the following cleanups preparing for the incoming RAID56J (already finished coding, functionality and on-disk format are fine, although no journal yet):

- Calculate device stripe length in-house inside scrub_stripe() This removes one of the nasty mismatch which is less obvious.

- Use btrfs_raid_array[] based calculation instead of ad-hoc check The only exception is scrub_nr_raid_mirrors(), which has several difference against btrfs_num_copies():

* No iteration on all RAID6 combinations
No sure if it's planned or not.

* Use bioc->num_stripes directly
In that context, bioc is already all the mirrors for the same stripe, thus no need to lookup using btrfs_raid_array[].

With all these cleanups, the RAID56J will be much easier to implement.

Qu Wenruo (4):
btrfs: remove @dev_extent_len argument from scrub_stripe() function
btrfs: use btrfs_chunk_max_errors() to replace weird tolerance
calculation
btrfs: use btrfs_raid_array[] to calculate the number of parity
stripes
btrfs: use btrfs_raid_array[].ncopies in btrfs_num_copies()

 fs/btrfs/raid56.c  | 10 ++--------
 fs/btrfs/raid56.h  | 12 ++----------
 fs/btrfs/scrub.c   | 13 +++++++------
 fs/btrfs/volumes.c | 35 +++++++++++++++++++++--------------
 fs/btrfs/volumes.h |  2 ++
 5 files changed, 34 insertions(+), 38 deletions(-)
Signature · 1 line
2.36.1