summaryrefslogtreecommitdiffstats
path: root/include/scsi
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2008-10-27 19:20:59 +0100
committerJens Axboe <jens.axboe@oracle.com>2008-10-27 19:25:30 +0100
commit3070f69b66b7ab2f02d8a2500edae07039c38508 (patch)
tree508c5f64ac507d8248f591d9e1a6da93379004e5 /include/scsi
parent1d63e726408dfdb3e10ed8f00c383b30ebb333d3 (diff)
downloadkernel-crypto-3070f69b66b7ab2f02d8a2500edae07039c38508.tar.gz
kernel-crypto-3070f69b66b7ab2f02d8a2500edae07039c38508.tar.xz
kernel-crypto-3070f69b66b7ab2f02d8a2500edae07039c38508.zip
scsi: make sure that scsi_init_shared_tag_map() doesn't overwrite existing map
Right now callers have to check whether scsi_host->bqt is already set up, it's much cleaner to just have scsi_init_shared_tag_map() does this check on its own. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'include/scsi')
-rw-r--r--include/scsi/scsi_tcq.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/include/scsi/scsi_tcq.h b/include/scsi/scsi_tcq.h
index cf4c219c0b5..17231385cb3 100644
--- a/include/scsi/scsi_tcq.h
+++ b/include/scsi/scsi_tcq.h
@@ -140,8 +140,18 @@ static inline struct scsi_cmnd *scsi_find_tag(struct scsi_device *sdev, int tag)
*/
static inline int scsi_init_shared_tag_map(struct Scsi_Host *shost, int depth)
{
- shost->bqt = blk_init_tags(depth);
- return shost->bqt ? 0 : -ENOMEM;
+ /*
+ * If the shared tag map isn't already initialized, do it now.
+ * This saves callers from having to check ->bqt when setting up
+ * devices on the shared host (for libata)
+ */
+ if (!shost->bqt) {
+ shost->bqt = blk_init_tags(depth);
+ if (!shost->bqt)
+ return -ENOMEM;
+ }
+
+ return 0;
}
/**