I agree, the math for underflow is flawed for block sizes other than 512, but I leave it up to the community to decide if there is some history behind this decision. This math has remained this way 'forever'. The dpt_i2o driver should have the following (and more accurately enclosed) patch to match up with what other sections of code in this driver are doing with regards to the underflow check. Other drivers all appear to be performing the underflow check in this manner. len = cmd->request_bufflen; - if(cmd->underflow && len != cmd->underflow){ + if(cmd->underflow && len < cmd->underflow){ printk(KERN_WARNING"Cmd len %08X Cmd underflow %08X\n", len, cmd->underflow); } Sincerely -- Mark Salyzyn > -----Original Message----- > From: Sakurai Hiroomi [mailto:sakurai_hiro@xxxxxxxxxxxxxxxx] > Sent: Thursday, May 18, 2006 6:39 AM > To: linux-scsi@xxxxxxxxxxxxxxx; Salyzyn, Mark > Subject: dpt_i2o and sd driver's problem > > > Dear Mark, > > When I was using MO device , following messages showed in > our /var/log/messages. > The kernel version is kernel-2.6.16.16. > > kernel: Cmd len 00001000 Cmd underflow 00000400 > > This messages is reported from dpt_i2o driver. > It is reported when request_bufflen member/underflow member > of the Scsi_Cmnd structure is not match. > --------------------------------------- > dpt_i2o.c > static s32 adpt_scsi_to_i2o(adpt_hba* pHba, > Scsi_Cmnd* cmd, struct adpt_device* d) > { > : > len = cmd->request_bufflen; > : > if(cmd->underflow && len != cmd->underflow){ > printk(KERN_WARNING"Cmd len %08X Cmd > underflow %08X\n", > len, cmd->underflow); > } > : > } > --------------------------------------- > > The request_bufflen member/underflow member is set in sd driver. > But, each sector size is not match except 512 bytes. > --------------------------------------- > sd.c > static int sd_init_command(Scsi_Cmnd * SCpnt) > { > : > this_count = SCpnt->request_bufflen >> 9; > : > if (sdp->sector_size == 1024) { > if ((block & 1) || (rq->nr_sectors & 1)) { > printk(KERN_ERR "sd: Bad block number > requested"); > return 0; > } else { > block = block >> 1; > this_count = this_count >> 1; > } > } > if (sdp->sector_size == 2048) { > if ((block & 3) || (rq->nr_sectors & 3)) { > printk(KERN_ERR "sd: Bad block number > requested"); > return 0; > } else { > block = block >> 2; > this_count = this_count >> 2; > } > } > if (sdp->sector_size == 4096) { > if ((block & 7) || (rq->nr_sectors & 7)) { > printk(KERN_ERR "sd: Bad block number > requested"); > return 0; > } else { > block = block >> 3; > this_count = this_count >> 3; > } > } > : > SCpnt->underflow = this_count << 9; > } > --------------------------------------- > > There are no problem for the hard disk because of 512 bytes > in the sector size. > But, when I tested MO media(1.3GB), the sector size was 2048 byte. > > I have 2 questions. > > 1. I think the value of underflow is a calculation mistake. > Is it true? > > 2. What is the purpose to compare the values of > request_bufflen member/underflow member with dpt_i2o driver? > > > I'm not participated in the linux-scsi mailing list. > Please reply to the following addresses. > > E-Mail : sakurai_hiro@xxxxxxxxxxxxxxxx > > Best Regards > Hiroomi Sakurai > > > >
Attachment:
dpt_i2o-underflow.patch
Description: dpt_i2o-underflow.patch