Lines Matching refs:cmd
171 static void free_cmd(struct nullb_cmd *cmd) in free_cmd() argument
173 put_tag(cmd->nq, cmd->tag); in free_cmd()
178 struct nullb_cmd *cmd; in __alloc_cmd() local
183 cmd = &nq->cmds[tag]; in __alloc_cmd()
184 cmd->tag = tag; in __alloc_cmd()
185 cmd->nq = nq; in __alloc_cmd()
186 return cmd; in __alloc_cmd()
194 struct nullb_cmd *cmd; in alloc_cmd() local
197 cmd = __alloc_cmd(nq); in alloc_cmd()
198 if (cmd || !can_wait) in alloc_cmd()
199 return cmd; in alloc_cmd()
203 cmd = __alloc_cmd(nq); in alloc_cmd()
204 if (cmd) in alloc_cmd()
211 return cmd; in alloc_cmd()
214 static void end_cmd(struct nullb_cmd *cmd) in end_cmd() argument
218 blk_mq_end_request(cmd->rq, 0); in end_cmd()
221 INIT_LIST_HEAD(&cmd->rq->queuelist); in end_cmd()
222 blk_end_request_all(cmd->rq, 0); in end_cmd()
225 bio_endio(cmd->bio, 0); in end_cmd()
229 free_cmd(cmd); in end_cmd()
236 struct nullb_cmd *cmd; in null_cmd_timer_expired() local
243 cmd = container_of(entry, struct nullb_cmd, ll_list); in null_cmd_timer_expired()
245 end_cmd(cmd); in null_cmd_timer_expired()
252 static void null_cmd_end_timer(struct nullb_cmd *cmd) in null_cmd_end_timer() argument
256 cmd->ll_list.next = NULL; in null_cmd_end_timer()
257 if (llist_add(&cmd->ll_list, &cq->list)) { in null_cmd_end_timer()
274 static inline void null_handle_cmd(struct nullb_cmd *cmd) in null_handle_cmd() argument
281 blk_mq_complete_request(cmd->rq); in null_handle_cmd()
284 blk_complete_request(cmd->rq); in null_handle_cmd()
290 end_cmd(cmd); in null_handle_cmd()
295 end_cmd(cmd); in null_handle_cmd()
298 null_cmd_end_timer(cmd); in null_handle_cmd()
317 struct nullb_cmd *cmd; in null_queue_bio() local
319 cmd = alloc_cmd(nq, 1); in null_queue_bio()
320 cmd->bio = bio; in null_queue_bio()
322 null_handle_cmd(cmd); in null_queue_bio()
329 struct nullb_cmd *cmd; in null_rq_prep_fn() local
331 cmd = alloc_cmd(nq, 0); in null_rq_prep_fn()
332 if (cmd) { in null_rq_prep_fn()
333 cmd->rq = req; in null_rq_prep_fn()
334 req->special = cmd; in null_rq_prep_fn()
346 struct nullb_cmd *cmd = rq->special; in null_request_fn() local
349 null_handle_cmd(cmd); in null_request_fn()
357 struct nullb_cmd *cmd = blk_mq_rq_to_pdu(bd->rq); in null_queue_rq() local
359 cmd->rq = bd->rq; in null_queue_rq()
360 cmd->nq = hctx->driver_data; in null_queue_rq()
364 null_handle_cmd(cmd); in null_queue_rq()
426 struct nullb_cmd *cmd; in setup_commands() local
429 nq->cmds = kzalloc(nq->queue_depth * sizeof(*cmd), GFP_KERNEL); in setup_commands()
441 cmd = &nq->cmds[i]; in setup_commands()
442 INIT_LIST_HEAD(&cmd->list); in setup_commands()
443 cmd->ll_list.next = NULL; in setup_commands()
444 cmd->tag = -1U; in setup_commands()