Re: [PATCH 04/17] btrfs: handle checksum validation and repair at the storage layer

Christoph Hellwig
2022-09-05T06:48:24Z

On Thu, Sep 01, 2022 at 05:04:34PM +0800, Qu Wenruo wrote:
> But for the verification part, I still don't like the idea of putting
> the verification code at endio context at all.

Why?

> This is especially true when data and metadata are still doing different
> checksum verfication at different timing.

Note that this does not handle the metadata checksum verification at
all. Both because it actually works very different and I could not
verify that we'd actually always read all data that needs to be verified
together for metadata, but also because there is zero metadata repair
coverage in xfstests, so I don't dare to touch that code.

> Can we just let the endio function to do the IO, and let the reader to
> do the verification after all needed data is read out?

What would the benefit be? It will lead to a lot of duplicate (and thus
inconsistent) code that is removed here, and make splitting the bios
under btrfs_submit_bio much more complicated and expensive.