A friend's machine recently logged a "Running low on SCSI DMA buffers"
warning, and being curious I located the two kernel source files that
output this message, these being drivers/scsi/s[dr].c.
There's a section of code (starting at around line 861 of sr.c, and
line 764 of sd.c, kernel 2.0.18) that performs the test that can cause
this message to be output. I noticed that the conditional tests are
slightly different, and I wondered if one was perhaps wrong.
The test in sr.c reads:
if (((long) sgpnt[count].address) + sgpnt[count].length >
ISA_DMA_THRESHOLD && SCpnt->host->unchecked_isa_dma)
while in sd.c it reads:
if (((long) sgpnt[count].address) + sgpnt[count].length - 1 >
ISA_DMA_THRESHOLD && (SCpnt->host->unchecked_isa_dma) &&
!sgpnt[count].alt_address)
It seems that an off by one error was corrected in sd.c, but the
change never made it to sr.c. I searched back through the patches,
and found that the two tests became different in the 1.1.2 patch
(i.e. nearly 2.5 years ago :-).
I don't know how important the difference is, but I thought I'd point
it out to you SCSI hackers (Drew, Eric, Leonard, ...) - I just want
the kernel to be perfect ;-)
You are indeed correct, and sr.c should be corrected. Thanks for noticing
this. A patch will be on its way to Linus shortly.
Leonard