On Mon, 19 Nov 2007, RTE wrote:
> On Fri, 16 Nov 2007 22:31:20 +0300, Alan Stern wrote:
>
> > Okay, that's good. Now here's a comparable patch for 2.6.17-git22
>
>
> 2.6.17-git22 with patch
> after copying 700 MB file from flash to HDD
> the copied file contains errors
> /var/log/kernel/info:
> 19:49:14 localhost kernel: driver_byte 8, sense key 3
> 19:49:14 localhost kernel: error_sector 0, req_sector 33116, resid 26624,
> underflow 122880
> 19:49:14 localhost kernel: Adjusted good_bytes from 122880 to -16955392
Good work. This shows exactly where the problem is.
Below is another test patch for 2.6.17-git22. It includes new code to
try and fix the problem. If it works, I'll make an analogous patch for
you to try with 2.6.23.
Alan Stern
--- 2.6.17/drivers/scsi/sd.c1 2007-10-11 15:53:20.000000000 -0400
+++ 2.6.17/drivers/scsi/sd.c 2007-11-19 15:15:04.000000000 -0500
@@ -904,6 +904,8 @@ static void sd_rw_intr(struct scsi_cmnd
sense_valid = scsi_command_normalize_sense(SCpnt, &sshdr);
if (sense_valid)
sense_deferred = scsi_sense_is_deferred(&sshdr);
+printk(KERN_INFO "driver_byte %x, sense key %x\n", driver_byte(result),
+sshdr.sense_key);
}
#ifdef CONFIG_SCSI_LOGGING
SCSI_LOG_HLCOMPLETE(1, printk("sd_rw_intr: %s: res=0x%x\n",
@@ -953,7 +955,20 @@ static void sd_rw_intr(struct scsi_cmnd
/* This computation should always be done in terms of
* the resolution of the device's medium.
*/
- good_bytes = (bad_lba - start_lba)*SCpnt->device->sector_size;
+ if (start_lba <= bad_lba && bad_lba < start_lba +
+ (xfer_size / SCpnt->device->sector_size))
+ good_bytes = SCpnt->device->sector_size *
+ (unsigned int) (bad_lba - start_lba);
+
+ /* If the bad_lba value is no good, maybe the residue value
+ * is better.
+ */
+ else if (SCpnt->resid > 0 && SCpnt->resid < xfer_size)
+ good_bytes = (xfer_size - SCpnt->resid) &
+ (- SCpnt->device->sector_size);
+printk(KERN_INFO "error_sector %d, req_sector %d, resid %d, underflow %d\n",
+(int) bad_lba, (int) start_lba, (int) SCpnt->resid,
+(int) SCpnt->underflow);
break;
case RECOVERED_ERROR:
case NO_SENSE:
@@ -979,6 +994,9 @@ static void sd_rw_intr(struct scsi_cmnd
break;
}
out:
+if (good_bytes != xfer_size)
+printk(KERN_INFO "Adjusted good_bytes from %d to %d\n",
+xfer_size, good_bytes);
scsi_io_completion(SCpnt, good_bytes);
}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-users