Commit 3070f69b66b7ab2f02d8a2500edae07039c38508
1 parent
1d63e72640
Exists in
master
and in
39 other branches
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>
Showing 1 changed file with 12 additions and 2 deletions Side-by-side Diff
include/scsi/scsi_tcq.h
... | ... | @@ -140,8 +140,18 @@ |
140 | 140 | */ |
141 | 141 | static inline int scsi_init_shared_tag_map(struct Scsi_Host *shost, int depth) |
142 | 142 | { |
143 | - shost->bqt = blk_init_tags(depth); | |
144 | - return shost->bqt ? 0 : -ENOMEM; | |
143 | + /* | |
144 | + * If the shared tag map isn't already initialized, do it now. | |
145 | + * This saves callers from having to check ->bqt when setting up | |
146 | + * devices on the shared host (for libata) | |
147 | + */ | |
148 | + if (!shost->bqt) { | |
149 | + shost->bqt = blk_init_tags(depth); | |
150 | + if (!shost->bqt) | |
151 | + return -ENOMEM; | |
152 | + } | |
153 | + | |
154 | + return 0; | |
145 | 155 | } |
146 | 156 | |
147 | 157 | /** |