Re: Block Device Caching

From: Helge Hafting
Date: Wed Jun 30 2004 - 03:29:47 EST


Timothy Miller wrote:



Markus Schaber wrote:

This lead us to the conclusion that block devices do not cache, but the
filesystem does. But subsequently, I ran some tests on my developer
machine (Pentium 4 Mobile Laptop).



I had kernel experts repeatedly insist to me that block devices were cached, while all of my tests (using dd to or from, say, /dev/sda1 or whatever) indicated that there was absolutely no caching whatsoever.

Well, any cache is dropped when the device is closed. "dd" closes the device
when it finishes.

Try a program that reads the same two blocks (spaced videly apart)
over and over from the same open file descriptor. With _no_ caching you'll see
the drive seeking all the time. With caching, you won't.

Helge Hafting
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/