August 15th
Finished the allocation table structure, read and commit functionalities, and most of the snapshot handling. The last needs a bit more testing, if all is well I'll be submitting it tomorrow.
July 17th
Write and rollback functionalities were tested and they work. What I'm working on right now is the allocation table structure to keep track of what's in the log file, and all related operations (add element, retrieve an element, save part of list to disk if it's too big for memory). I decided on the hash-table-like structure with the offset range (every 100 MB at the moment) as the key and list of all data entries within that offset range as value. I've reformatted the data that is written to the log file so that the allocation table can be read from the file in case the geom is stopped without a commit or a rollback, and added a header to the log file so that the log utility can recognize it .
Also, I decided to use compression for log file (will likely be using this library for it), but for now that's just a "To Do" thing as uncompressed data make testing easier.
July 10th
Basic write code ready for testing, now trying to configure the created geom for accepting such requests (right now, the attempt to write to it results in "Operation not permitted" - probably I forgot something in geom configuration). Also started to implement a data structure to keep track of what's on the disk and what's in the log file for read requests, I'm using TAILQ list of structs that contain location on the disk (where the data would be if on the disk), offset in the file and size of the data. It should eventually be made into a list of lists to make it faster. I heard this could be done with a tree (the fastest way), but it's not immediately obvious how. In case of system being shut down without commit or rollback event, this structure should be saved to the disk.
Bugs found
- memory leak after kldunload (32 bytes) - forgot to free() something?
- kldunload without the geom being stopped previously crashes when attempting g_wither_geom