Re: [noob q. on block layer] block IO read-ahead during sequential *write*?

From: JÃrn Engel
Date: Mon Jan 07 2008 - 07:55:53 EST


On Mon, 7 January 2008 13:25:09 +0100, Frantisek Rysanek wrote:
>
> let me start with a simple example. The following commands:
>
> cp /dev/zero /dev/hda
> dd if=/dev/zero of=/dev/hda [bs=512]
>
> both have one common side-effect: apart from the disk being properly
> overwritten with zeroes, the kernel seems to keep reading sectors
> ahead of the current seek position of the sequential write.

Block devices are cached in the page cache. If you write less than a
full page, any remainder has to be read from the device.

If you retry the dd with bs=4096 (or whatever your architecture's page
size happens to be), does this still occur?

JÃrn

--
Chance favors only the prepared mind.
-- Louis Pasteur
--
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/