===== drivers/scsi/hosts.c 1.57 vs edited ===== --- 1.57/drivers/scsi/hosts.c Tue Apr 15 13:20:37 2003 +++ edited/drivers/scsi/hosts.c Thu Apr 24 11:00:29 2003 @@ -427,6 +427,7 @@ shost->max_sectors = shost_tp->max_sectors; shost->use_blk_tcq = shost_tp->use_blk_tcq; + shost->min_xfersize = shost_tp->min_xfersize; spin_lock(&scsi_host_list_lock); /* ===== drivers/scsi/hosts.h 1.58 vs edited ===== --- 1.58/drivers/scsi/hosts.h Mon Mar 24 07:14:28 2003 +++ edited/drivers/scsi/hosts.h Thu Apr 24 11:04:40 2003 @@ -339,6 +339,12 @@ unsigned use_blk_tcq:1; /* + * Minimum transfer length for the device. The mid-layer will + * not ask for fewer bytes than this (user issued commands may) + */ + unsigned char min_xfersize; + + /* * Name of proc directory */ char *proc_name; @@ -458,6 +464,12 @@ unsigned use_clustering:1; unsigned highmem_io:1; unsigned use_blk_tcq:1; + + /* + * Minimum transfer length for the device. The mid-layer will + * not ask for fewer bytes than this (user issued commands may) + */ + unsigned char min_xfersize; /* * Host has requested that no further requests come through for the ===== drivers/scsi/sd.c 1.108 vs edited ===== --- 1.108/drivers/scsi/sd.c Fri Apr 18 11:58:55 2003 +++ edited/drivers/scsi/sd.c Thu Apr 24 11:07:25 2003 @@ -1112,7 +1112,8 @@ * We have to start carefully: some devices hang if we ask * for more than is available. */ - res = sd_do_mode_sense6(sdp, SRpnt, 0, 0x3F, buffer, 4); + res = sd_do_mode_sense6(sdp, SRpnt, 0, 0x3F, buffer, + max(sdp->host->min_xfersize, 4)); /* * Second attempt: ask for page 0 @@ -1120,7 +1121,8 @@ * Sense Key 5: Illegal Request, Sense Code 24: Invalid field in CDB. */ if (res) - res = sd_do_mode_sense6(sdp, SRpnt, 0, 0, buffer, 4); + res = sd_do_mode_sense6(sdp, SRpnt, 0, 0, buffer, + max(sdp->host->min_xfersize, 4)); /* * Third attempt: ask 255 bytes, as we did earlier. @@ -1153,14 +1155,16 @@ const int modepage = 0x08; /* current values, cache page */ /* cautiously ask */ - res = sd_do_mode_sense6(sdp, SRpnt, dbd, modepage, buffer, 4); + res = sd_do_mode_sense6(sdp, SRpnt, dbd, modepage, buffer, + max(sdp->host->min_xfersize, 4)); if (res == 0) { /* that went OK, now ask for the proper length */ len = buffer[0] + 1; if (len > 128) len = 128; - res = sd_do_mode_sense6(sdp, SRpnt, dbd, modepage, buffer, len); + res = sd_do_mode_sense6(sdp, SRpnt, dbd, modepage, buffer, + max(sdp->host->min_xfersize, len)); } if (res == 0 && buffer[3] + 6 < len) {