1. 22

  2. 1

    Good read. I would like to know if and how BTRFS does guarantee that data that is on the disk is the one that was written. As well it would be interesting to know how much this guarantees are impacting the performance. I would be grateful if somebody who has answers to this could shed some light.

    1. 2

      (The same answear you can find on the blog in the comment section).

      Let’s start by seeing, “I’m not an expert in BTRFS”.

      That said, first of all, the BTRFS is using b-tree instead of the merkle tree. They decided not to keep the checksum of the node in the node above. Instead, they are checksumming the level of the block and block number where this block is supposed to live. This allows them to detect misplaced writes/reads on the media.

      Everything that points to a tree block also stores the transaction id (the generation field) it expects that block to have, and this allows to detect phantom writes.

      The difference with ZFS is that it checks the checksum of the block instead of the transaction id.

      Source: https://btrfs.wiki.kernel.org/index.php/Btrfs_design

      1. 1

        Thank you for the reply!