scsi: target: Convert target drivers to use sbitmap
The sbitmap and the percpu_ida perform essentially the same task, allocating tags for commands. The sbitmap outperforms the percpu_ida as documented here: https://lkml.org/lkml/2014/4/22/553 The sbitmap interface is a little harder to use, but being able to remove the percpu_ida code and getting better performance justifies the additional complexity. Signed-off-by: Matthew Wilcox <willy@infradead.org> Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com> # f_tcm Reviewed-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:

committed by
Martin K. Petersen

parent
83c2b54b92
commit
10e9cbb6b5
@@ -654,9 +654,9 @@ static struct vscsibk_pend *scsiback_get_pend_req(struct vscsiif_back_ring *ring
|
||||
struct scsiback_nexus *nexus = tpg->tpg_nexus;
|
||||
struct se_session *se_sess = nexus->tvn_se_sess;
|
||||
struct vscsibk_pend *req;
|
||||
int tag, i;
|
||||
int tag, cpu, i;
|
||||
|
||||
tag = percpu_ida_alloc(&se_sess->sess_tag_pool, TASK_RUNNING);
|
||||
tag = sbitmap_queue_get(&se_sess->sess_tag_pool, &cpu);
|
||||
if (tag < 0) {
|
||||
pr_err("Unable to obtain tag for vscsiif_request\n");
|
||||
return ERR_PTR(-ENOMEM);
|
||||
@@ -665,6 +665,7 @@ static struct vscsibk_pend *scsiback_get_pend_req(struct vscsiif_back_ring *ring
|
||||
req = &((struct vscsibk_pend *)se_sess->sess_cmd_map)[tag];
|
||||
memset(req, 0, sizeof(*req));
|
||||
req->se_cmd.map_tag = tag;
|
||||
req->se_cmd.map_cpu = cpu;
|
||||
|
||||
for (i = 0; i < VSCSI_MAX_GRANTS; i++)
|
||||
req->grant_handles[i] = SCSIBACK_INVALID_HANDLE;
|
||||
|
Reference in New Issue
Block a user