[GSoC 2017 - BTRFS write supports] Third coding period - Final recap
Google Summer of Code 2017 is coming to the end. This is my final report which covers third coding sprint, also read my introduction blog for a brief of my project.
Creating and removing directories are now working. Basically, creating directories involve in inserting new inode (metadata of file) and making links between file name and inode. Because directories don’t hold any data so there isn’t any links between inode and file data, creating new files need to handle it.
I separate the old Find() function into Traverse() and GetEntry(). Traverse fills in the Path along way its finding, GetEntry gets the data from the position got from Path after traversing. This makes more flexible for using, and also optimize finding process because Path caches the nodes from root to leaf.
CopyOnWrite(), which is the core function for any write operations, is finished and works well. It works like this.
- cache original block (block_cache_get).
- allocating new block.
- cache new block to be writable (block_cache_get_writable).
- copy original block to new block.
- make some changes (if neccessary) and then write back to disk (cache_sync_transaction).
Doing this way, somehow is not efficient because we have to copy the whole new block again. The reason is block cache api uses the cached block as write-back block to sync/flush data to disk. If we can separate them the CopyOnWrite() can be simplified, for example I can reimplement like this.
- allocating new block (e.g block b)
- cache original block.(e.g block a, and write to block b)
- modify on original block and then write back to disk.
block cache api provides good way to control blocks in-place and transaction, but in my opinion it is not efficient for COWing or mirroring data. I don’t know if there is any workarounds, I have thought about writing a wrapper for this but it is not a goal for GSoC and also I would lose the transaction feature. So just let it there, if any devs interest :).
What are left to do
- Continue doing the allocator. Allocator now just record initialized chunks and block groups, we need to handle it when disk grows and exceeds the limit. Reading more about this.
- Tree balance functions (split, merge, etc).
- File operations.
- Locks (for now BTRFS is testing only through fs_shell).
- Ton of features of BTRFS.
I learn lots of things in this summer!
- My Git skills gets to next level and I made my first pull request.
- My English is better, I guess, because I spent 3-5 hours for each blogs and have to communicate through email, IRC.
- Contribute to opensource.
- Learn about coding stuffs and some C++.
Also, thanks to Haiku’s mentors, I very appreciate the time you take to mentor and give advices. Although I ran into problem that the abasence of my mentors, but the haiku-gsoc mailing list solved this, I think this is nice and it shows how opensource world operate.
- [GSoC 2017 - BTRFS write supports] Third coding period - Final recap
- [GSoC 2017 - BTRFS write support] Week #9 #10 #11 (Second coding period)
- [GSoC 2017 - BTRFS Write Supports] Week #6 #7 #8
- [GSoC 2017 - BTRFS Write Supports] Week #4 #5
- [GSoC 2017 - BTRFS Write Supports] Week #3
- [GSoC 2017 - BTRFS Write Supports] Week #2
- [GSoC 2017] Adding write supports for Btrfs