On Mon, 2007-01-29 at 09:20 -0800, Christoph Lameter wrote:
Sure, apply patches 1 through 9. 10 and up are the write side.
Its all quite simple really; imagine locking the whole tree path
beginning at the root node. This obviously doesn't provide concurrency
since holing the root node locked will avoid all other operations from
starting.
However, as soon as you've locked a node on the next level and can
determine that you will never need to traverse the tree path upwards
from this point, you can drop the lock(s) on the previous level.
In the trivial case where you will never traverse up again, this reduces
to ladder locking.
Perhaps it is best illustrated with a picture (forgive the ASCII art)
A0
B0 B1
C0 C1 C2 C3
D0 D1 D2 D3 D4 D5 D6 D7
Say we need D5, which yield the path: A0, B1, C2, D5.
Ladder locking would end up:
lock A0
lock B1
unlock A0 -> a new operation can start
lock C2
unlock B1
lock D5
unlock C2
** we do stuff to D5
unlock D5
For path locking, this would end up being something like this:
(say we can determine we'll never cross C2 back up)
lock A0
lock B1
lock C2
unlock A0 -> a new operation can start
unlock B1
lock D5
** we do stuff to D5 and walk back up to C2
unlock C2
unlock D5
drivers/mtd/devices/block2mtd.c - fudges with the pagecache, haven't
spend any time in converting that. Shouldn't be hard.
Doesn't compile anymore.
(could use atomic_long_t for mapping::nr_pages I guess)
-