pub fn create_dir_all_durable(path: &Path) -> Result<()>Expand description
Create a directory and any missing ancestors, making new dirents crash-durable.
Bare fs::create_dir_all only ensures the directories exist in the live
filesystem view. After the first write into a newly created shard
(e.g. blobs/ab/…), write_file_atomic fsyncs the shard directory so
the file dirent is durable — but the grandparent that holds the new
shard dirent may never be fsynced. A crash can then drop the entire new
shard tree despite per-file durability (GAP_MAP L6).
This helper:
- creates missing ancestor directories (same end state as
create_dir_all); - fsyncs each newly created directory, deepest-first;
- fsyncs the deepest pre-existing parent so the new child dirent is durable.
On Windows, directory fsync is a no-op (see sync_directory); creation
still proceeds. Cost is once per new path segment (typically once per
object-store shard).