summaryrefslogtreecommitdiff
path: root/drivers/xen/xen-scsiback.c
diff options
context:
space:
mode:
authorMatthew Wilcox <willy@infradead.org>2018-06-12 22:05:44 +0300
committerMartin K. Petersen <martin.petersen@oracle.com>2018-06-20 05:02:25 +0300
commit10e9cbb6b531117be0c4a79f2c7fa9a45a0dd532 (patch)
treeea333b10d3aa71849264ab3fe6147b0e0d4420da /drivers/xen/xen-scsiback.c
parent83c2b54b9295a5fc0d9c8f1751aaf8099d1760f6 (diff)
downloadlinux-10e9cbb6b531117be0c4a79f2c7fa9a45a0dd532.tar.xz
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>
Diffstat (limited to 'drivers/xen/xen-scsiback.c')
-rw-r--r--drivers/xen/xen-scsiback.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c
index ec6635258ed8..764dd9aa0131 100644
--- a/drivers/xen/xen-scsiback.c
+++ b/drivers/xen/xen-scsiback.c
@@ -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;