kahing/catfs

writeback support

kahing opened this issue · 2 comments

the "simple" implementation would be logging all the dirty files and copy back in the background, while making sure they are never evicted. Ideally provide ways to let the user know how much dirty data are yet to be replicated

I'm considering implementing this feature and I'm wondering if you have a precise idea about how to "log" dirty files.

I think a naive solution probably works fine. So just a list of file names (separated by '\0') every time it's changed. We keep the list of dirty files in memory. Every time a new file is modified a new file name is appended to this file (unless it's already there). We have another file that contains nothing but an offset, and every time we copy back we update this offset. Periodically we rollover to a new set of files.

So the file names are something like:

dirtylog_v1.log.00000000
dirtylog_v1.checkpoint.00000000
...
dirtylog_v1.log.0000000F
dirtylog_v1.checkpoint.0000000F