aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_error.c
diff options
context:
space:
mode:
authorMike Christie <michaelc@cs.wisc.edu>2005-11-11 06:30:27 -0500
committerJames Bottomley <jejb@mulgrave.(none)>2005-12-14 22:03:35 -0500
commit6e68af666f5336254b5715dca591026b7324499a (patch)
tree5640209b6e2b75659149460f14531cfecffe2f5d /drivers/scsi/scsi_error.c
parent6e39b69e7ea9205c5f80aeac3ef999ab8fb1a4cc (diff)
[SCSI] Convert SCSI mid-layer to scsi_execute_async
Add scsi helpers to create really-large-requests and convert scsi-ml to scsi_execute_async(). Per Jens's previous comments, I placed this function in scsi_lib.c. I made it follow all the queue's limits - I think I did at least :), so I removed the warning on the function header. I think the scsi_execute_* functions should eventually take a request_queue and be placed some place where the dm-multipath hw_handler can use them if that failover code is going to stay in the kernel. That conversion patch will be sent in another mail though. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/scsi_error.c')
-rw-r--r--drivers/scsi/scsi_error.c47
1 files changed, 9 insertions, 38 deletions
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 18c5d2523014..53ea62d3b53d 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -1315,23 +1315,6 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd)
1315} 1315}
1316 1316
1317/** 1317/**
1318 * scsi_eh_lock_done - done function for eh door lock request
1319 * @scmd: SCSI command block for the door lock request
1320 *
1321 * Notes:
1322 * We completed the asynchronous door lock request, and it has either
1323 * locked the door or failed. We must free the command structures
1324 * associated with this request.
1325 **/
1326static void scsi_eh_lock_done(struct scsi_cmnd *scmd)
1327{
1328 struct scsi_request *sreq = scmd->sc_request;
1329
1330 scsi_release_request(sreq);
1331}
1332
1333
1334/**
1335 * scsi_eh_lock_door - Prevent medium removal for the specified device 1318 * scsi_eh_lock_door - Prevent medium removal for the specified device
1336 * @sdev: SCSI device to prevent medium removal 1319 * @sdev: SCSI device to prevent medium removal
1337 * 1320 *
@@ -1353,29 +1336,17 @@ static void scsi_eh_lock_done(struct scsi_cmnd *scmd)
1353 **/ 1336 **/
1354static void scsi_eh_lock_door(struct scsi_device *sdev) 1337static void scsi_eh_lock_door(struct scsi_device *sdev)
1355{ 1338{
1356 struct scsi_request *sreq = scsi_allocate_request(sdev, GFP_KERNEL); 1339 unsigned char cmnd[MAX_COMMAND_SIZE];
1357 1340
1358 if (unlikely(!sreq)) { 1341 cmnd[0] = ALLOW_MEDIUM_REMOVAL;
1359 printk(KERN_ERR "%s: request allocate failed," 1342 cmnd[1] = 0;
1360 "prevent media removal cmd not sent\n", __FUNCTION__); 1343 cmnd[2] = 0;
1361 return; 1344 cmnd[3] = 0;
1362 } 1345 cmnd[4] = SCSI_REMOVAL_PREVENT;
1346 cmnd[5] = 0;
1363 1347
1364 sreq->sr_cmnd[0] = ALLOW_MEDIUM_REMOVAL; 1348 scsi_execute_async(sdev, cmnd, DMA_NONE, NULL, 0, 0, 10 * HZ,
1365 sreq->sr_cmnd[1] = 0; 1349 5, NULL, NULL, GFP_KERNEL);
1366 sreq->sr_cmnd[2] = 0;
1367 sreq->sr_cmnd[3] = 0;
1368 sreq->sr_cmnd[4] = SCSI_REMOVAL_PREVENT;
1369 sreq->sr_cmnd[5] = 0;
1370 sreq->sr_data_direction = DMA_NONE;
1371 sreq->sr_bufflen = 0;
1372 sreq->sr_buffer = NULL;
1373 sreq->sr_allowed = 5;
1374 sreq->sr_done = scsi_eh_lock_done;
1375 sreq->sr_timeout_per_command = 10 * HZ;
1376 sreq->sr_cmd_len = COMMAND_SIZE(sreq->sr_cmnd[0]);
1377
1378 scsi_insert_special_req(sreq, 1);
1379} 1350}
1380 1351
1381 1352