From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NDfEb-0006xE-G0 for qemu-devel@nongnu.org; Thu, 26 Nov 2009 09:22:13 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NDfEX-0006tJ-TK for qemu-devel@nongnu.org; Thu, 26 Nov 2009 09:22:13 -0500 Received: from [199.232.76.173] (port=43667 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NDfEX-0006tC-LC for qemu-devel@nongnu.org; Thu, 26 Nov 2009 09:22:09 -0500 Received: from mx1.redhat.com ([209.132.183.28]:3595) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NDfEX-0006E3-8z for qemu-devel@nongnu.org; Thu, 26 Nov 2009 09:22:09 -0500 Message-ID: <4B0E8EF6.2080106@redhat.com> Date: Thu, 26 Nov 2009 15:21:42 +0100 From: Gerd Hoffmann MIME-Version: 1.0 Subject: Re: [Qemu-devel] [sneak preview] major scsi overhaul References: <4AF4ACA5.2090701@redhat.com> <200911161853.34668.paul@codesourcery.com> <4B0BCAA1.3090400@redhat.com> <200911241351.03650.paul@codesourcery.com> <4B0D5D36.6080100@redhat.com> <4B0E2EC8.7040309@suse.de> <4B0E3B90.5080001@redhat.com> <4B0E5EFD.6060701@suse.de> <4B0E60AF.9000508@redhat.com> <4B0E6496.1060203@suse.de> In-Reply-To: <4B0E6496.1060203@suse.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Hannes Reinecke Cc: Paul Brook , qemu-devel@nongnu.org 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