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
@@ -1071,15 +1071,16 @@ static struct usbg_cmd *usbg_get_cmd(struct f_uas *fu,
|
||||
{
|
||||
struct se_session *se_sess = tv_nexus->tvn_se_sess;
|
||||
struct usbg_cmd *cmd;
|
||||
int tag;
|
||||
int tag, cpu;
|
||||
|
||||
tag = percpu_ida_alloc(&se_sess->sess_tag_pool, TASK_RUNNING);
|
||||
tag = sbitmap_queue_get(&se_sess->sess_tag_pool, &cpu);
|
||||
if (tag < 0)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
cmd = &((struct usbg_cmd *)se_sess->sess_cmd_map)[tag];
|
||||
memset(cmd, 0, sizeof(*cmd));
|
||||
cmd->se_cmd.map_tag = tag;
|
||||
cmd->se_cmd.map_cpu = cpu;
|
||||
cmd->se_cmd.tag = cmd->tag = scsi_tag;
|
||||
cmd->fu = fu;
|
||||
|
||||
|
Reference in New Issue
Block a user