linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH v2 0/2] btrfs: raid56: concurrency fix and a very tiny optimization
Date: Sat, 21 Jan 2023 16:06:10 +0800	[thread overview]
Message-ID: <cover.1674285037.git.wqu@suse.com> (raw)

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


             reply	other threads:[~2023-01-21  8:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-21  8:06 Qu Wenruo [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1674285037.git.wqu@suse.com \
    --to=wqu@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).