X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fscsi%2Fscsi_tgt_lib.c;h=d402aff5f314a4b2728da2d2d3c8f1c063092958;hb=bef986502fa398b1785a3979b1aa17cd902d3527;hp=39da5cd6fb6f829e037f84645744693764cca113;hpb=5a55c2596f55e3a60f7502d0dfcfa0d20241e5ac;p=linux-2.6-omap-h63xx.git diff --git a/drivers/scsi/scsi_tgt_lib.c b/drivers/scsi/scsi_tgt_lib.c index 39da5cd6fb6..d402aff5f31 100644 --- a/drivers/scsi/scsi_tgt_lib.c +++ b/drivers/scsi/scsi_tgt_lib.c @@ -33,7 +33,7 @@ #include "scsi_tgt_priv.h" static struct workqueue_struct *scsi_tgtd; -static kmem_cache_t *scsi_tgt_cmd_cache; +static struct kmem_cache *scsi_tgt_cmd_cache; /* * TODO: this struct will be killed when the block layer supports large bios @@ -185,10 +185,11 @@ static void cmd_hashlist_del(struct scsi_cmnd *cmd) spin_unlock_irqrestore(&qdata->cmd_hash_lock, flags); } -static void scsi_tgt_cmd_destroy(void *data) +static void scsi_tgt_cmd_destroy(struct work_struct *work) { - struct scsi_cmnd *cmd = data; - struct scsi_tgt_cmd *tcmd = cmd->request->end_io_data; + struct scsi_tgt_cmd *tcmd = + container_of(work, struct scsi_tgt_cmd, work); + struct scsi_cmnd *cmd = tcmd->rq->special; dprintk("cmd %p %d %lu\n", cmd, cmd->sc_data_direction, rq_data_dir(cmd->request)); @@ -214,6 +215,7 @@ static void init_scsi_tgt_cmd(struct request *rq, struct scsi_tgt_cmd *tcmd, struct list_head *head; tcmd->tag = tag; + INIT_WORK(&tcmd->work, scsi_tgt_cmd_destroy); spin_lock_irqsave(&qdata->cmd_hash_lock, flags); head = &qdata->cmd_hash[cmd_hashfn(tag)]; list_add(&tcmd->hash_list, head); @@ -303,7 +305,7 @@ void scsi_tgt_free_queue(struct Scsi_Host *shost) cmd = tcmd->rq->special; shost->hostt->eh_abort_handler(cmd); - scsi_tgt_cmd_destroy(cmd); + scsi_tgt_cmd_destroy(&tcmd->work); } } EXPORT_SYMBOL_GPL(scsi_tgt_free_queue); @@ -347,7 +349,6 @@ static void scsi_tgt_cmd_done(struct scsi_cmnd *cmd) dprintk("cmd %p %lu\n", cmd, rq_data_dir(cmd->request)); scsi_tgt_uspace_send_status(cmd, tcmd->tag); - INIT_WORK(&tcmd->work, scsi_tgt_cmd_destroy, cmd); queue_work(scsi_tgtd, &tcmd->work); } @@ -549,13 +550,15 @@ static int scsi_tgt_copy_sense(struct scsi_cmnd *cmd, unsigned long uaddr, static int scsi_tgt_abort_cmd(struct Scsi_Host *shost, struct scsi_cmnd *cmd) { + struct scsi_tgt_cmd *tcmd; int err; err = shost->hostt->eh_abort_handler(cmd); if (err) eprintk("fail to abort %p\n", cmd); - scsi_tgt_cmd_destroy(cmd); + tcmd = cmd->request->end_io_data; + scsi_tgt_cmd_destroy(&tcmd->work); return err; }