mirror of
https://github.com/versity/scoutfs.git
synced 2026-01-10 05:37:25 +00:00
cf0199da00db6902a19d6c22d29c39436da599f0
The btree locking so far was a quick interim measure to get the rest of the system going. We want to clean it up both for correctness and performance but also to make way for using the btree for block allocation. We were unconditionally using the buffer head lock for tree block locking. This is bad for at least four reasons: it's invisible to lockdep, it doesn't allow concurrent reads, it doesn't allow reading while a block is being written during the transaction, and it's not necessary at all when the for stable read-only blocks. Instead we add a rwsem to the buffer head private which we use to lock the block when it's writable. We clean up the locking functions to make it clearer that btree_walk holds one lock at a time and either returns it to the caller with the buffer head or unlocks the parent if its returning an error. We also add the missing sibling block locking during splits and merges. Locking the parent prevented walks from descending down our path but it didn't protect against previous walks that were already down at our sibling's level. Getting all this working with lockdep adds a bit more class/subclass plumbing calls but nothing too ornerous. Signed-off-by: Zach Brown <zab@versity.com>
Description
No description provided
Languages
C
87.1%
Shell
9.2%
Roff
2.5%
TeX
0.9%
Makefile
0.3%