[Btrfs-devel] checksum errors

Chris Mason chris.mason at oracle.com
Wed Jun 20 12:13:17 PDT 2007


On Wed, Jun 20, 2007 at 03:07:10PM -0400, Josef Bacik wrote:
> Hello,
> 
> I'm getting errors when I mount a freshly mkfs'ed btrfs filesystem
> 
> btrfs: dm-2 checksum verify failed on 4
> 
> and so on for however many roots were created.  It looks to be because mkfs
> doesn't create checksums for the roots when its making the filesystem, so all of
> them will have null checksum feilds at first, until eventually they get
> populated by somebody writing or something like that.

Exactly, I haven't put the csum code into mkfs yet.

> Should mkfs be creating
> these checksums when its first creating the filesystem?  Just want to know so I
> know where I should be trying to fix this, or if I should mess with it at all.
> Thank you,

Yes, we definitely need this in userland, it should be a pretty quick
mini-project.  The easy way is to change disk-io.c:write_tree_block to
do the csum just before it calls pwrite.  See csum_tree_block and
btrfs_csum_data in the kernel module for a basic idea.

For all the tree blocks, the csum field is the first 32 bytes (even if
you're only doing a 4 byte crc32c csum).  So, the csum field is not fed
into the csum function, but the entire rest of the block is.

Longer term, there needs to be a field in the tree root that indicates
what kind of csum is used for all the blocks in the tree.  For now, you
can just assume crc32c.

-chris




More information about the Btrfs-devel mailing list