diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/block/ub.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/block/ub.c b/drivers/block/ub.c index e322cce8c12d..b87ad77e5bb5 100644 --- a/drivers/block/ub.c +++ b/drivers/block/ub.c | |||
@@ -205,6 +205,7 @@ struct ub_scsi_cmd { | |||
205 | unsigned char key, asc, ascq; /* May be valid if error==-EIO */ | 205 | unsigned char key, asc, ascq; /* May be valid if error==-EIO */ |
206 | 206 | ||
207 | int stat_count; /* Retries getting status. */ | 207 | int stat_count; /* Retries getting status. */ |
208 | unsigned int timeo; /* jiffies until rq->timeout changes */ | ||
208 | 209 | ||
209 | unsigned int len; /* Requested length */ | 210 | unsigned int len; /* Requested length */ |
210 | unsigned int current_sg; | 211 | unsigned int current_sg; |
@@ -764,6 +765,12 @@ static void ub_cmd_build_packet(struct ub_dev *sc, struct ub_lun *lun, | |||
764 | cmd->cdb_len = rq->cmd_len; | 765 | cmd->cdb_len = rq->cmd_len; |
765 | 766 | ||
766 | cmd->len = rq->data_len; | 767 | cmd->len = rq->data_len; |
768 | |||
769 | /* | ||
770 | * To reapply this to every URB is not as incorrect as it looks. | ||
771 | * In return, we avoid any complicated tracking calculations. | ||
772 | */ | ||
773 | cmd->timeo = rq->timeout; | ||
767 | } | 774 | } |
768 | 775 | ||
769 | static void ub_rw_cmd_done(struct ub_dev *sc, struct ub_scsi_cmd *cmd) | 776 | static void ub_rw_cmd_done(struct ub_dev *sc, struct ub_scsi_cmd *cmd) |
@@ -1336,7 +1343,10 @@ static void ub_data_start(struct ub_dev *sc, struct ub_scsi_cmd *cmd) | |||
1336 | return; | 1343 | return; |
1337 | } | 1344 | } |
1338 | 1345 | ||
1339 | sc->work_timer.expires = jiffies + UB_DATA_TIMEOUT; | 1346 | if (cmd->timeo) |
1347 | sc->work_timer.expires = jiffies + cmd->timeo; | ||
1348 | else | ||
1349 | sc->work_timer.expires = jiffies + UB_DATA_TIMEOUT; | ||
1340 | add_timer(&sc->work_timer); | 1350 | add_timer(&sc->work_timer); |
1341 | 1351 | ||
1342 | cmd->state = UB_CMDST_DATA; | 1352 | cmd->state = UB_CMDST_DATA; |
@@ -1376,7 +1386,10 @@ static int __ub_state_stat(struct ub_dev *sc, struct ub_scsi_cmd *cmd) | |||
1376 | return -1; | 1386 | return -1; |
1377 | } | 1387 | } |
1378 | 1388 | ||
1379 | sc->work_timer.expires = jiffies + UB_STAT_TIMEOUT; | 1389 | if (cmd->timeo) |
1390 | sc->work_timer.expires = jiffies + cmd->timeo; | ||
1391 | else | ||
1392 | sc->work_timer.expires = jiffies + UB_STAT_TIMEOUT; | ||
1380 | add_timer(&sc->work_timer); | 1393 | add_timer(&sc->work_timer); |
1381 | return 0; | 1394 | return 0; |
1382 | } | 1395 | } |