How filesystem atomically writes a block to disk?
A disk should grant that a sector is written atomically. The sector size was 512 bytes and today is typically 4096 bytes for larger disks.
In order to get no problem from partially written "blocks", it is important to write everything in a special order.
Note that the only reason why there could be a partially written part in the filesystem is a power outage or something similar.
The method is:
First write all file content and verify that this worked
Then write the meta data and make sure that all data structures in the meta data fit in a single disk sector and do not span a sector boundary. This is e.g. important for variable length file names as directory content.