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