Skip to content

Commit

Permalink
scsi: make sure that scsi_init_shared_tag_map() doesn't overwrite exi…
Browse files Browse the repository at this point in the history
…sting 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>
  • Loading branch information
Jens Axboe committed Oct 27, 2008
1 parent 1d63e72 commit 3070f69
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions include/scsi/scsi_tcq.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down

0 comments on commit 3070f69

Please sign in to comment.