summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/hosts.c
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2008-01-16 13:32:17 +0900
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-01-23 11:37:37 -0600
commitde25deb18016f66dcdede165d07654559bb332bc (patch)
treeb566c2a369d3dce85507ab28ea20ffee020e0c06 /drivers/scsi/hosts.c
parentb30c2fc1113edfb2371427c10503ff942b0a0370 (diff)
downloadlinux-de25deb18016f66dcdede165d07654559bb332bc.tar.bz2
[SCSI] use dynamically allocated sense buffer
This removes static array sense_buffer in scsi_cmnd and uses dynamically allocated sense_buffer (with GFP_DMA). The reason for doing this is that some architectures need cacheline aligned buffer for DMA: http://lkml.org/lkml/2007/11/19/2 The problems are that scsi_eh_prep_cmnd puts scsi_cmnd::sense_buffer to sglist and some LLDs directly DMA to scsi_cmnd::sense_buffer. It's necessary to DMA to scsi_cmnd::sense_buffer safely. This patch solves these issues. __scsi_get_command allocates sense_buffer via kmem_cache_alloc and attaches it to a scsi_cmnd so everything just work as before. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/hosts.c')
-rw-r--r--drivers/scsi/hosts.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index 9a10b4335e76..f5d3fbb55717 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -268,6 +268,7 @@ static void scsi_host_dev_release(struct device *dev)
}
scsi_destroy_command_freelist(shost);
+ scsi_destroy_command_sense_buffer(shost);
if (shost->bqt)
blk_free_tags(shost->bqt);
@@ -372,10 +373,14 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
else
shost->dma_boundary = 0xffffffff;
- rval = scsi_setup_command_freelist(shost);
+ rval = scsi_setup_command_sense_buffer(shost);
if (rval)
goto fail_kfree;
+ rval = scsi_setup_command_freelist(shost);
+ if (rval)
+ goto fail_destroy_sense;
+
device_initialize(&shost->shost_gendev);
snprintf(shost->shost_gendev.bus_id, BUS_ID_SIZE, "host%d",
shost->host_no);
@@ -399,6 +404,8 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
fail_destroy_freelist:
scsi_destroy_command_freelist(shost);
+ fail_destroy_sense:
+ scsi_destroy_command_sense_buffer(shost);
fail_kfree:
kfree(shost);
return NULL;