Description
https://btrfs.readthedocs.io/en/latest/Checksumming.html says:
checksum is calculated before write and verifed after reading the blocks from devices.
this needs to be improved IMO.
For example, when there is an error completely writing the file or the writing is completed, but the data are different from the source non-BTRFS drive (due to maybe bad drive controller, port, cable?), is BTRFS automatically reading the file after copying it in order to compare its checksum with the checksum that it calculated out of the source file which is located outside of BTRFS filesystem? Or instead it is NOT automatically reading the BTRFS file after writing it, but it is done later after i need to read this file in future (for example because file on non-BTRFS drive is lost, and my attempt copying the file out of BTRFS fails, because the file checksum is now found to be different from the checksum made from original file that was located on a non-BTRFSD drive?)
Thank you for explaining in advance and sorry for hard to understand english.
FIX: if it can be a bit cleared in linked documentation + there is a typo in word "verifed".
UPDATE: it seems that btrfs is not made to verify that it written the data correctly, per the @Zygo comment:
The checksum is written at the same time as the data, but the checksum is not verified at write time. Verification occurs only when an application reads the data, or a maintenance scrub is run. ... you will have to run an application or script which re-reads and verifies the data
he mentions "sysctl vm.drop_caches=3" may be needed. Regarding improving the docummentation, he also suggested how to do it, even it unfortunately does not explain that the csum verification/data reading is NOT done by btrfs right after it complete writing.