Re: reading /dev/scd0 blocks sync(2) why ?

Ingo Molnar (mingo@pc5829.hil.siemens.at)
Sun, 12 Jan 1997 19:26:16 +0100 (MET)


On Sun, 12 Jan 1997, Harald Koenig wrote:

> when I'm reading data from a SCSI CDROM e.g. using
>
> dd if=/dev/scd0 bs=2k of=/dev/null
>
> the sync(2) system call is blocked until the "dd" command is terminated.
> why ? dd opens /dev/scd0 read-only; writing to a pipe gives the same
> problem so it's not writing to /dev/null...

'sync' waits for all IO to complete. While the first block has finished, a
new one is started. Does this patch help? It should skip all buffers that
are not dirty (ie. a read is being done most probably). It's against
2.1.20, compiles fine but is untested otherwise.

--- source/linux-2.1.20_orig/fs/buffer.c Wed Jan 1 15:56:21 1997
+++ linux/fs/buffer.c Sun Jan 12 19:22:01 1997
@@ -216,6 +216,8 @@
retry = 1;
continue;
}
+ if (!buffer_dirty(bh))
+ continue;
wait_on_buffer (bh);
goto repeat2;
}