patch-2.3.99-pre6 linux/drivers/scsi/scsi_merge.c

Next file: linux/drivers/scsi/scsi_obsolete.c
Previous file: linux/drivers/scsi/scsi_lib.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.99-pre5/linux/drivers/scsi/scsi_merge.c linux/drivers/scsi/scsi_merge.c
@@ -282,7 +282,7 @@
  *		This can come up if you get a MEDIUM_ERROR, for example,
  *		as we will have "completed" all of the sectors up to and
  *		including the bad sector, and the leftover bit is what
- *		we have to do now.  This tends to be a rare occurence, so
+ *		we have to do now.  This tends to be a rare occurrence, so
  *		we aren't busting our butts to instantiate separate versions
  *		of this function for the 4 different flag values.  We
  *		probably should, however.
@@ -320,7 +320,7 @@
 	 * scsi.c allocates for this purpose
 	 * min(64,sg_tablesize) entries.
 	 */
-	if (req->nr_segments >= max_segments &&
+	if (req->nr_segments >= max_segments ||
 	    req->nr_segments >= SHpnt->sg_tablesize)
 		return 0;
 	req->nr_segments++;
@@ -339,8 +339,7 @@
 	 * check if things fit into sg_tablesize.
 	 */
 	if (req->nr_hw_segments >= SHpnt->sg_tablesize ||
-	    (req->nr_segments >= max_segments &&
-	     req->nr_segments >= SHpnt->sg_tablesize))
+	     req->nr_segments >= SHpnt->sg_tablesize)
 		return 0;
 	if (req->nr_segments >= max_segments)
 		return 0;
@@ -609,7 +608,7 @@
 	/* If it would not fit into prepared memory space for sg chain,
 	 * then don't allow the merge.
 	 */
-	if (req->nr_segments + next->nr_segments - 1 > max_segments &&
+	if (req->nr_segments + next->nr_segments - 1 > max_segments ||
 	    req->nr_segments + next->nr_segments - 1 > SHpnt->sg_tablesize) {
 		return 0;
 	}
@@ -674,7 +673,7 @@
 	}
       dont_combine:
 #ifdef DMA_CHUNK_SIZE
-	if (req->nr_segments + next->nr_segments > max_segments &&
+	if (req->nr_segments + next->nr_segments > max_segments ||
 	    req->nr_segments + next->nr_segments > SHpnt->sg_tablesize) {
 		return 0;
 	}
@@ -697,7 +696,7 @@
 	 * Make sure we can fix something that is the sum of the two.
 	 * A slightly stricter test than we had above.
 	 */
-	if (req->nr_segments + next->nr_segments > max_segments &&
+	if (req->nr_segments + next->nr_segments > max_segments ||
 	    req->nr_segments + next->nr_segments > SHpnt->sg_tablesize) {
 		return 0;
 	} else {

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)