All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] btrfs: raid56: concurrency fix and a very tiny optimization
@ 2023-01-21  8:06 Qu Wenruo
  2023-01-21  8:06 ` [PATCH v2 1/2] btrfs: raid56: make error_bitmap update atomic Qu Wenruo
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Qu Wenruo @ 2023-01-21  8:06 UTC (permalink / raw)
  To: linux-btrfs

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(-)

-- 
2.39.1


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

end of thread, other threads:[~2023-01-27 14:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-21  8:06 [PATCH v2 0/2] btrfs: raid56: concurrency fix and a very tiny optimization Qu Wenruo
2023-01-21  8:06 ` [PATCH v2 1/2] btrfs: raid56: make error_bitmap update atomic Qu Wenruo
2023-01-21  8:07   ` Christoph Hellwig
2023-01-21  8:06 ` [PATCH v2 2/2] btrfs: raid56: reduce the overhead to calculate the bio length Qu Wenruo
2023-01-21  8:08   ` Christoph Hellwig
2023-01-27 13:56 ` [PATCH v2 0/2] btrfs: raid56: concurrency fix and a very tiny optimization David Sterba

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.