Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Does Datto snapshot use COFW? #282

Open
Finix1979 opened this issue Aug 4, 2022 · 2 comments
Open

[Question] Does Datto snapshot use COFW? #282

Finix1979 opened this issue Aug 4, 2022 · 2 comments

Comments

@Finix1979
Copy link
Contributor

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.

@nickchen-cpu
Copy link

nickchen-cpu commented Aug 4, 2022

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:

  • pros:
    • Reducing time to read original data which needs to reach the disk.
  • cons:
    • Increasing time to bio_for_each_segment to check block_mapping for every bio coming snap_trace_bio.

@Finix1979
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants