Skip to content

Commit cc3010e

Browse files
rhnkdave
authored andcommitted
btrfs-progs: docs: clarify btrfs-send checksum
The way the CRC32C checksum used for btrfs-send differs from the way it's used elsewhere in btrfs. Without making the distinction, it's easy to make the flawed assumption that CRC32C always refers to the same, and end up with code that produces the wrong checksums. This small note should guide the reader to the right function. The best notes on the protocol I found are here: https://archive.kernel.org/oldwiki/btrfs.wiki.kernel.org/index.php/Design_notes_on_Send/Receive.html The crc32c might be used in two meanings and this could be confusing when implementing the send stream protocol. Rust code describing the algorithm for the crc crate that worked for me: pub const CRC_32_BTRFS_SEND: crc::Algorithm<u32> = crc::Algorithm { width: 32, poly: 0x1edc6f41, init: 0, refin: true, refout: true, xorout: 0, check: 0xe3069283, residue: 0xb798b438 }; (it's a slight variation on the one used in ISCSI) Note: Documentation/dev/dev-send-stream.rst briefly mentions that Pull-request: #794 Author: rhn <[email protected]> [ rephrase changelog and copy text from pull request and add link to developer documentation of the send stream ] Signed-off-by: David Sterba <[email protected]>
1 parent 4299446 commit cc3010e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Documentation/Send-receive.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@ The stream is a sequence of encoded commands that change e.g. file metadata
2020
(owner, permissions, extended attributes), data extents (create, clone,
2121
truncate), whole file operations (rename, delete). The stream can be sent over
2222
network, piped directly to the receive command or saved to a file. Each command
23-
in the stream is protected by a CRC32C checksum. See :doc:`btrfs-send`
24-
and :doc:`btrfs-receive` for more.
23+
in the stream is protected by a CRC32C checksum, with 0 as the initial value
24+
and no inversion. See :doc:`btrfs-send` and :doc:`btrfs-receive` for more,
25+
for protocol description :doc:`dev-send-stream`.

0 commit comments

Comments
 (0)