Re: aligned /dev/scd$n reads less rare how

Pat LaVarre
2003-10-24T14:41:38Z

> Anything easy I can do
> to make aligned reads more common?

Instead we first could/ should ask:

How does Linux align write/read of cd-rw/dvd+rw?

We know 2.6 vs. 2.4 newly connects cd-rw as writeable, by
http://kniggit.net/wwol26.html of l=kernelnewbies. And "everybody
knows" cd-rw needs 64 KiB write alignment, dvd+rw needs 32 KiB write
alignment, and both prefer write alignment in reads, right? How then
does Linux hint at the mounted fs to align write/read to something other
than the 0.5 KiB that was optimal for legacy hdd?

> I ask because often thru /dev/scd$n
> I see seemingly pointless misalignment,
> ...
> $ sudo blockdev --flushbufs /dev/scd0
> $ time sudo dd if=/dev/scd0 bs=1M
> ...
> usb-storage: x 28 00 00 00 00 00 00 00 20 00

Initially we see aligned in address and length to x20 blocks = 64 KiB.

> usb-storage: x 28 00 00 00 00 20 00 00 24 00

Soon we see aligned in address but, whoops, not in length.

> usb-storage: x 28 00 00 00 00 44 00 00 40 00
> usb-storage: x 28 00 00 00 00 84 00 00 40 00
> usb-storage: x 28 00 00 00 00 C4 00 00 40 00
> ...
> usb-storage: x 28 00 00 07 FE C4 00 00 40 00

Mostly we see contiguous after a misaligned access, so not aligned in
address though yes aligned in length. Ouch.

Pat LaVarre