qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [sneak preview] major scsi overhaul


From: Gerd Hoffmann
Subject: Re: [Qemu-devel] [sneak preview] major scsi overhaul
Date: Thu, 26 Nov 2009 15:21:42 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.4pre) Gecko/20091014 Fedora/3.0-2.8.b4.fc11 Lightning/1.0pre Thunderbird/3.0b4

On 11/26/09 12:20, Hannes Reinecke wrote:
Gerd Hoffmann wrote:
/me looks at drivers/scsi/sd.c:sd_done()

I can't see any sane way to tell linux that the request was too big.

residuals is the key:

drivers/scsi/scsi.c:scsi_finish_command()


        good_bytes = scsi_bufflen(cmd);
         if (cmd->request->cmd_type != REQ_TYPE_BLOCK_PC) {
                int old_good_bytes = good_bytes;
                drv = scsi_cmd_to_driver(cmd);
                if (drv->done)
                        good_bytes = drv->done(cmd);

drv->done() actually is sd_done() mentioned above.

sd_done() tries to figure how many sectors it actually got for serious errors. I don't feel signaling "medium error" for the first sector behind our limit just because we'd like to have smaller requests.

                /*
                 * USB may not give sense identifying bad sector and
                 * simply return a residue instead, so subtract off the
                 * residue if drv->done() error processing indicates no
                 * change to the completion length.
                 */
                if (good_bytes == old_good_bytes)
                        good_bytes -= scsi_get_resid(cmd);

Poor mans bad sector identification. Same issue as above IMHO. On top of that I wouldn't expect all other guest OSes having the same quirk in there to handle usb disks.

cheers,
  Gerd




reply via email to

[Prev in Thread] Current Thread [Next in Thread]