While writing to a file, the file size is increases - but the current active extent won't be persisted unless we get an fsync() or a close() call.
If we do a metadata roll, the file size will be persisted as part of a snapshot, so if we get a crash or an ungraceful shutdown after that we can end up having a file without extents but with a file size > 0.
ZenFS is not required to persist un-fsync data, but we should make sure that the file size matches the persisted extent lengths.
We can simply truncate the file size to the sum of all extent lenghts, and we'll be consistent after mount.
While writing to a file, the file size is increases - but the current active extent won't be persisted unless we get an fsync() or a close() call.
If we do a metadata roll, the file size will be persisted as part of a snapshot, so if we get a crash or an ungraceful shutdown after that we can end up having a file without extents but with a file size > 0.
ZenFS is not required to persist un-fsync data, but we should make sure that the file size matches the persisted extent lengths. We can simply truncate the file size to the sum of all extent lenghts, and we'll be consistent after mount.