Skip to contentSkip to conversation

update scsi-ml's scsi_init_io

RFC PATCH In review Mike Christie 1 participant 1 message Jun 4, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 4/4 update scsi-ml's scsi_init_io

All REQ_BLOCK_PC requests are bio backed now.

This patch was made against 2.6.12-rc5 but works with scsi-misc.

drivers/scsi/scsi_lib.c +8 -13
@@ -920,24 +920,19 @@ static int scsi_init_io(struct scsi_cmnd
 	int		   count;
 
 	/*
-	 * if this is a rq->data based REQ_BLOCK_PC, setup for a non-sg xfer
+	 * we use scatter-gather for all requests with data
+	 * (it makes highmem I/O easier to support without kmapping pages)
 	 */
-	if ((req->flags & REQ_BLOCK_PC) && !req->bio) {
-		cmd->request_bufflen = req->data_len;
-		cmd->request_buffer = req->data;
-		req->buffer = req->data;
-		cmd->use_sg = 0;
+	cmd->use_sg = req->nr_phys_segments;
+	if (!cmd->use_sg) {
+		BUG_ON(req->bio || req->data);
+		cmd->request_bufflen = 0;
+		cmd->request_buffer = NULL;
+		req->buffer = NULL;
 		return 0;
 	}
 
 	/*
-	 * we used to not use scatter-gather for single segment request,
-	 * but now we do (it makes highmem I/O easier to support without
-	 * kmapping pages)
-	 */
-	cmd->use_sg = req->nr_phys_segments;
-
-	/*
 	 * if sg table allocation fails, requeue request later.
 	 */
 	sgpnt = scsi_alloc_sgtable(cmd, GFP_ATOMIC);