Re: IDE block i/o & ordering

Benjamin Herrenschmidt (bh40@calva.net)
Mon, 20 Dec 1999 19:18:26 +0100


On Mon, Dec 20, 1999, Helge Hafting <helge.hafting@idb.hist.no> wrote:

>What is sector N used for? Part of a file opened by several processes?
>If two processes open a file, one reading and another writing then
>they may execute in parallell (particularly on SMP systems).
>If the "reader" reads a sector that the "writer" is busy writing to,
>then the reader may end up reading half "old" stuff and half "freshly
>written" stuff from that sector.
>
>Not forcing synchronization gives better performance, and it is
>consistent with the bigger picture: If the writer writes a million
>sectors and the reader reads a million sectors then the reader
>may get several old and several new sectors on any os.
>Linux merely lets this happen on the byte level too.
>This is designed into the page cache, and may happen on
>any platform, with any kind of block device.
>
>An application that needs synchronization must handle the issues
>itself. fsync may help but not necessarily; the "reader" may read
>while the writer is in the middle of writing "B", before the writer
>does the fsync. You really need a semaphore.

No, to my knowledge, the block driver in the emulator uses a single
thread of all i/os to the device. The file is a raw IDE block device
(/dev/hdaX). The problem was reproduced with 2.2.13, we didn't have time
to check with a recent 2.2.14pre15 yet.

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