Skip to content

btrfs: raid56: concurrency fix and a very tiny optimization

Qu Wenruo linux-btrfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest2 patches 3 repliesIn review

Changes in v2 from the cover letter

- Use set_bit() in a loop instead of an asymmetrical spinlock. Since only endio can have concurrency accessing the bitmap, while the main thread only access them in a single thread, we will have asymmetrical spinlock schema, which is not ideal. Instead go set_bit() in a loop.

- Add a tiny optimization to calculate bio length in rbio_update_error_bitmap()

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2btrfs: raid56: make error_bitmap update atomicfs/btrfs/raid56.c+10 -21 reply
2/2btrfs: raid56: reduce the overhead to calculate the bio lengthfs/btrfs/raid56.c+1 -21 reply

Reviews trailers per patch

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

PatchChristoph Hellwig
1/2R-b
2/2R-b

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

Read the v2 thread

Cover letter [PATCH v2 0/2] btrfs: raid56: concurrency fix and a very tiny optimization

We have a unprotected concurrency updateing rbio::error_bitmap. The first patch is going to fix it.

While we are at rbio_update_error_bitmap(), there is also a tiny optimization we can do for calculating the bio size.
Since we only care about the size of the bio, bio_for_each_bvec_all() is much better than bio_for_each_segment_all(), as the former one can handle multi-page bvec directly to reduce the loop.

Changelog:
v2:
- Use set_bit() in a loop instead of an asymmetrical spinlock. Since only endio can have concurrency accessing the bitmap, while the main thread only access them in a single thread, we will have asymmetrical spinlock schema, which is not ideal. Instead go set_bit() in a loop.

- Add a tiny optimization to calculate bio length in rbio_update_error_bitmap()

Qu Wenruo (2):
btrfs: raid56: make error_bitmap update atomic
btrfs: raid56: reduce the overhead to calculate the bio length

 fs/btrfs/raid56.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
Signature · 1 line
2.39.1