Open Finix1979 opened 2 years ago
Hi
Yes, Dattobd uses COFW.
But its check time is when writing instead of reading as you mentioned.
static int cow_write_current(struct cow_manager *cm, uint64_t block, void *buf){
...
//if the block mapping already exists return so we don't overwrite it
if(block_mapping) return 0;
...
}
Trade off:
bio_for_each_segment
to check block_mapping for every bio
coming snap_trace_bio
.Thank you @nickchen-cpu If we could check if the write range is already copied or in progress(read io is in flight already) before issuing the read operation, we could avoid this disk IO (copied) or wait until the previous read(in flight). It could be a range tree to record what is already copied to the file, and another range tree records in flight read range.
I have a question about how to handle write operations in snapshot mode. When the write I/O comes and matches the tracing requirement, Datto clones the IO via bio_make_read_clone and submits it for reading the original data. After reading completion, Datto submits the original write IO and COW file write IO in separate threads.
My question is whether the read IO is necessary if the COW file already contains the required data.