Well, it's easy, the ramdisk driver uses (used) the buffer cache to
store the ramdisk blocks. On a block read, it initializes the bh that
is assigned by a higher level caching routine to zeros (since it's a new
block formerly not used), and on write, it simply marks the bh as
"protected", so it won't get thrown away by any memory pressure.
Further, on reads approaching this area, the buffer cache simply returns
the "cached" data in the bh, which then contains the up-to-date data..
At least, that's how it worked. Once, there was an idea to get rid of
the BH_Protected flag, since using the counters have the same effect (if
in use, noone can dump it), but I don't think that happened yet. On the
other hand, maybe the buffer/page cache changes mistreat some of the
assumed behavior, but I can't test it right now...
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to firstname.lastname@example.org
Please read the FAQ at http://www.tux.org/lkml/