aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/st.c
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2008-12-18 00:49:42 -0500
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2009-01-02 12:55:09 -0500
commit6d4762678b7cbe932e858c62c07c533e1736a8bf (patch)
tree08582c4aafb935b6bca759503a208e9e535580cf /drivers/scsi/st.c
parent13b53b443482623d33fd9446289d320e1c719f02 (diff)
[SCSI] st: convert non-dio path to use st_scsi_execute
This patch converts the non-dio path (fragment buffer path) to use st_scsi_execute. IOW, it removes scsi_execute_async in the non-dio path. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Acked-by: Kai Makisara <Kai.Makisara@kolumbus.fi> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/st.c')
-rw-r--r--drivers/scsi/st.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 084a967b2e78..390689d5fdf3 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -537,6 +537,8 @@ st_do_scsi(struct st_request * SRpnt, struct scsi_tape * STp, unsigned char *cmd
537 int bytes, int direction, int timeout, int retries, int do_wait) 537 int bytes, int direction, int timeout, int retries, int do_wait)
538{ 538{
539 struct completion *waiting; 539 struct completion *waiting;
540 struct rq_map_data *mdata = &STp->buffer->map_data;
541 int ret;
540 542
541 /* if async, make sure there's no command outstanding */ 543 /* if async, make sure there's no command outstanding */
542 if (!do_wait && ((STp->buffer)->last_SRpnt)) { 544 if (!do_wait && ((STp->buffer)->last_SRpnt)) {
@@ -564,21 +566,34 @@ st_do_scsi(struct st_request * SRpnt, struct scsi_tape * STp, unsigned char *cmd
564 init_completion(waiting); 566 init_completion(waiting);
565 SRpnt->waiting = waiting; 567 SRpnt->waiting = waiting;
566 568
567 if (!STp->buffer->do_dio) 569 if (!STp->buffer->do_dio) {
568 buf_to_sg(STp->buffer, bytes); 570 buf_to_sg(STp->buffer, bytes);
569 571
572 mdata->nr_entries =
573 DIV_ROUND_UP(bytes, PAGE_SIZE << mdata->page_order);
574 STp->buffer->map_data.pages = STp->buffer->reserved_pages;
575 STp->buffer->map_data.offset = 0;
576 }
577
570 memcpy(SRpnt->cmd, cmd, sizeof(SRpnt->cmd)); 578 memcpy(SRpnt->cmd, cmd, sizeof(SRpnt->cmd));
571 STp->buffer->cmdstat.have_sense = 0; 579 STp->buffer->cmdstat.have_sense = 0;
572 STp->buffer->syscall_result = 0; 580 STp->buffer->syscall_result = 0;
573 581
574 if (scsi_execute_async(STp->device, cmd, COMMAND_SIZE(cmd[0]), direction, 582 if (STp->buffer->do_dio)
575 &((STp->buffer)->sg[0]), bytes, (STp->buffer)->sg_segs, 583 ret = scsi_execute_async(STp->device, cmd, COMMAND_SIZE(cmd[0]),
576 timeout, retries, SRpnt, st_sleep_done, GFP_KERNEL)) { 584 direction, &((STp->buffer)->sg[0]),
585 bytes, (STp->buffer)->sg_segs, timeout,
586 retries, SRpnt, st_sleep_done,
587 GFP_KERNEL);
588 else
589 ret = st_scsi_execute(SRpnt, cmd, direction, NULL, bytes,
590 timeout, retries);
591
592 if (ret) {
577 /* could not allocate the buffer or request was too large */ 593 /* could not allocate the buffer or request was too large */
578 (STp->buffer)->syscall_result = (-EBUSY); 594 (STp->buffer)->syscall_result = (-EBUSY);
579 (STp->buffer)->last_SRpnt = NULL; 595 (STp->buffer)->last_SRpnt = NULL;
580 } 596 } else if (do_wait) {
581 else if (do_wait) {
582 wait_for_completion(waiting); 597 wait_for_completion(waiting);
583 SRpnt->waiting = NULL; 598 SRpnt->waiting = NULL;
584 (STp->buffer)->syscall_result = st_chk_result(STp, SRpnt); 599 (STp->buffer)->syscall_result = st_chk_result(STp, SRpnt);