aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi.c
diff options
context:
space:
mode:
authorMatthew Wilcox <matthew@wil.cx>2007-09-25 12:42:04 -0400
committerJames Bottomley <jejb@mulgrave.localdomain>2007-10-12 14:52:46 -0400
commit6f5391c283d7fdcf24bf40786ea79061919d1e1d (patch)
tree32ee9abddf9879445792019e1c03bcd28ce6bd4f /drivers/scsi/scsi.c
parent687d2bc4877081a44c41b5b312e012cc69edda53 (diff)
[SCSI] Get rid of scsi_cmnd->done
The ULD ->done callback moves into the scsi_driver. By moving the call to scsi_io_completion() from scsi_blk_pc_done() to scsi_finish_command(), we can eliminate the latter entirely. By returning 'good_bytes' from the ->done callback (rather than invoking scsi_io_completion()), we can stop exporting scsi_io_completion(). Also move the prototypes from sd.h to sd.c as they're all internal anyway. Rename sd_rw_intr to sd_done and rw_intr to sr_done. Inspired-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: Matthew Wilcox <willy@linux.intel.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/scsi.c')
-rw-r--r--drivers/scsi/scsi.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 07a7c2a70a3f..192948822455 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -59,6 +59,7 @@
59#include <scsi/scsi_cmnd.h> 59#include <scsi/scsi_cmnd.h>
60#include <scsi/scsi_dbg.h> 60#include <scsi/scsi_dbg.h>
61#include <scsi/scsi_device.h> 61#include <scsi/scsi_device.h>
62#include <scsi/scsi_driver.h>
62#include <scsi/scsi_eh.h> 63#include <scsi/scsi_eh.h>
63#include <scsi/scsi_host.h> 64#include <scsi/scsi_host.h>
64#include <scsi/scsi_tcq.h> 65#include <scsi/scsi_tcq.h>
@@ -367,9 +368,8 @@ void scsi_log_send(struct scsi_cmnd *cmd)
367 scsi_print_command(cmd); 368 scsi_print_command(cmd);
368 if (level > 3) { 369 if (level > 3) {
369 printk(KERN_INFO "buffer = 0x%p, bufflen = %d," 370 printk(KERN_INFO "buffer = 0x%p, bufflen = %d,"
370 " done = 0x%p, queuecommand 0x%p\n", 371 " queuecommand 0x%p\n",
371 scsi_sglist(cmd), scsi_bufflen(cmd), 372 scsi_sglist(cmd), scsi_bufflen(cmd),
372 cmd->done,
373 cmd->device->host->hostt->queuecommand); 373 cmd->device->host->hostt->queuecommand);
374 374
375 } 375 }
@@ -654,6 +654,12 @@ void __scsi_done(struct scsi_cmnd *cmd)
654 blk_complete_request(rq); 654 blk_complete_request(rq);
655} 655}
656 656
657/* Move this to a header if it becomes more generally useful */
658static struct scsi_driver *scsi_cmd_to_driver(struct scsi_cmnd *cmd)
659{
660 return *(struct scsi_driver **)cmd->request->rq_disk->private_data;
661}
662
657/* 663/*
658 * Function: scsi_finish_command 664 * Function: scsi_finish_command
659 * 665 *
@@ -665,6 +671,8 @@ void scsi_finish_command(struct scsi_cmnd *cmd)
665{ 671{
666 struct scsi_device *sdev = cmd->device; 672 struct scsi_device *sdev = cmd->device;
667 struct Scsi_Host *shost = sdev->host; 673 struct Scsi_Host *shost = sdev->host;
674 struct scsi_driver *drv;
675 unsigned int good_bytes;
668 676
669 scsi_device_unbusy(sdev); 677 scsi_device_unbusy(sdev);
670 678
@@ -690,7 +698,13 @@ void scsi_finish_command(struct scsi_cmnd *cmd)
690 "Notifying upper driver of completion " 698 "Notifying upper driver of completion "
691 "(result %x)\n", cmd->result)); 699 "(result %x)\n", cmd->result));
692 700
693 cmd->done(cmd); 701 good_bytes = cmd->request_bufflen;
702 if (cmd->request->cmd_type != REQ_TYPE_BLOCK_PC) {
703 drv = scsi_cmd_to_driver(cmd);
704 if (drv->done)
705 good_bytes = drv->done(cmd);
706 }
707 scsi_io_completion(cmd, good_bytes);
694} 708}
695EXPORT_SYMBOL(scsi_finish_command); 709EXPORT_SYMBOL(scsi_finish_command);
696 710