From: Christoph Hellwig <hch@infradead.org>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org, Christoph Hellwig <hch@infradead.org>
Subject: Re: [PATCH RFC v2 05/12] btrfs: add a helper to queue a corrupted sector for read repair
Date: Thu, 28 Apr 2022 06:44:27 -0700 [thread overview]
Message-ID: <YmqaOynJjWS2XB76@infradead.org> (raw)
In-Reply-To: <2fd10883-5a4d-5cbd-d09f-7a30bb326a4a@suse.com>
On Thu, Apr 28, 2022 at 01:20:37PM +0800, Qu Wenruo wrote:
> This function will get called very frequently, and I really want to avoid
> doing such re-search every time from the beginning of the original bio.
>
> Maybe we can cache a bvec_iter and using the bi_size to check if the target
> offset is still beyond us (then advance), or re-wind and re-search from the
> beginning.
>
> I guess there is no existing helper to do the same work, right?
It is basically impossible to review this because you just add a
standalone static helper without the callers. Please split the
work into logical chunks that actually are reviewable. Yes, that will
be a pretty large patch, but that's still much better than having to
jump around hal a dozen ones.
No, there is no way to efficiently look up what bvec in a bio some
offset falls into, because the bvecs are variable length.
It seems like the caller (at least the one added a little later, not
sure if there are more) is iterating over the bitmap and then calls
this for every bit set. So for that you're much better off making
the __bio_for_each_segment the main loop, and then at the beginning of
the loop checking the bitmap if we need to handle this sector.
> > + struct bio_list read_bios;
I'd just calls this bios. Obviously they are used for reading here.
Also please be very careful about dead locks. The mempool for the
btrfs_bios is small right now, you need to size it up by the
largerst number of bios that can be on this list.
next prev parent reply other threads:[~2022-04-28 13:44 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1651043617.git.wqu@suse.com>
2022-04-27 7:18 ` [PATCH RFC v2 01/12] btrfs: introduce a pure data checksum checking helper Qu Wenruo
2022-04-28 13:26 ` Christoph Hellwig
2022-04-27 7:18 ` [PATCH RFC v2 02/12] btrfs: always save bio::bi_iter into btrfs_bio::iter before submitting Qu Wenruo
2022-04-28 5:16 ` Qu Wenruo
2022-04-28 13:32 ` Christoph Hellwig
2022-04-28 22:41 ` Qu Wenruo
2022-04-29 15:09 ` Christoph Hellwig
2022-04-29 23:04 ` Qu Wenruo
2022-04-27 7:18 ` [PATCH RFC v2 03/12] btrfs: remove duplicated parameters from submit_data_read_repair() Qu Wenruo
2022-04-28 13:32 ` Christoph Hellwig
2022-04-27 7:18 ` [PATCH RFC v2 04/12] btrfs: add btrfs_read_repair_ctrl to record corrupted sectors Qu Wenruo
2022-04-28 13:37 ` Christoph Hellwig
2022-04-28 22:51 ` Qu Wenruo
2022-04-29 0:09 ` Qu Wenruo
2022-04-29 15:12 ` Christoph Hellwig
2022-04-29 15:11 ` Christoph Hellwig
2022-04-27 7:18 ` [PATCH RFC v2 05/12] btrfs: add a helper to queue a corrupted sector for read repair Qu Wenruo
2022-04-28 5:20 ` Qu Wenruo
2022-04-28 13:44 ` Christoph Hellwig [this message]
2022-04-28 22:55 ` Qu Wenruo
2022-04-29 7:11 ` Qu Wenruo
2022-04-29 15:14 ` Christoph Hellwig
2022-04-29 23:08 ` Qu Wenruo
2022-05-01 23:59 ` Qu Wenruo
2022-05-02 16:45 ` Christoph Hellwig
2022-05-02 23:00 ` Qu Wenruo
2022-04-27 7:18 ` [PATCH RFC v2 06/12] btrfs: introduce a helper to repair from one mirror Qu Wenruo
2022-04-27 7:18 ` [PATCH RFC v2 07/12] btrfs: allow btrfs read repair to submit all writes in one go Qu Wenruo
2022-04-27 7:18 ` [PATCH RFC v2 08/12] btrfs: switch buffered read to the new btrfs_read_repair_* based repair routine Qu Wenruo
2022-04-27 7:18 ` [PATCH RFC v2 09/12] btrfs: switch direct IO routine to use btrfs_read_repair_ctrl Qu Wenruo
2022-04-27 7:18 ` [PATCH RFC v2 10/12] btrfs: cleanup btrfs_repair_one_sector() Qu Wenruo
2022-04-28 13:45 ` Christoph Hellwig
2022-04-27 7:18 ` [PATCH RFC v2 11/12] btrfs: remove io_failure_record infrastructure completely Qu Wenruo
2022-04-27 7:18 ` [PATCH RFC v2 12/12] btrfs: remove btrfs_inode::io_failure_tree Qu Wenruo
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=YmqaOynJjWS2XB76@infradead.org \
--to=hch@infradead.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=wqu@suse.com \
/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