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

Christoph Hellwig
2022-09-05T14:31:10Z

On Mon, Sep 05, 2022 at 02:59:33PM +0800, Qu Wenruo wrote:
> Mostly due to the fact that metadata and data go split ways for
> verification.
>
> All the verification for data happens at endio time.

Yes.

> While part of the verification of metadata (bytenr, csum, level,
> tree-checker) goes at endio, but transid, checks against parent are all
> done at btrfs_read_extent_buffer() time.
>
> This also means, the read-repair happens at different timing.

Yes. read-repair for metadata currently is very different than that
from data. But that is something that exists already in is not new
in this series.

> But what about putting all the needed metadata info (first key, level,
> transid etc) also into bbio (using a union to take the same space of
> data csum), so that all verification and read repair can happen at endio
> time, the same timing as data?

I thought about that. And I suspect it probably is the right thing
to do. I'm mostly stayed away from it because it doesn't really
help with the goal in this series, and I also don't have good
code coverage to fail comfortable touching the metadata checksum
handling and repair. I can offer this sneaky deal: if someone
help creating good metadata repair coverage in xfstests, I will look
into this next.