Lines Matching refs:cmd
168 static void free_cmd(struct nullb_cmd *cmd) in free_cmd() argument
170 put_tag(cmd->nq, cmd->tag); in free_cmd()
177 struct nullb_cmd *cmd; in __alloc_cmd() local
182 cmd = &nq->cmds[tag]; in __alloc_cmd()
183 cmd->tag = tag; in __alloc_cmd()
184 cmd->nq = nq; in __alloc_cmd()
186 hrtimer_init(&cmd->timer, CLOCK_MONOTONIC, in __alloc_cmd()
188 cmd->timer.function = null_cmd_timer_expired; in __alloc_cmd()
190 return cmd; in __alloc_cmd()
198 struct nullb_cmd *cmd; in alloc_cmd() local
201 cmd = __alloc_cmd(nq); in alloc_cmd()
202 if (cmd || !can_wait) in alloc_cmd()
203 return cmd; in alloc_cmd()
207 cmd = __alloc_cmd(nq); in alloc_cmd()
208 if (cmd) in alloc_cmd()
215 return cmd; in alloc_cmd()
218 static void end_cmd(struct nullb_cmd *cmd) in end_cmd() argument
222 if (cmd->rq) in end_cmd()
223 q = cmd->rq->q; in end_cmd()
227 blk_mq_end_request(cmd->rq, 0); in end_cmd()
230 INIT_LIST_HEAD(&cmd->rq->queuelist); in end_cmd()
231 blk_end_request_all(cmd->rq, 0); in end_cmd()
234 bio_endio(cmd->bio); in end_cmd()
238 free_cmd(cmd); in end_cmd()
257 static void null_cmd_end_timer(struct nullb_cmd *cmd) in null_cmd_end_timer() argument
261 hrtimer_start(&cmd->timer, kt, HRTIMER_MODE_REL); in null_cmd_end_timer()
272 static inline void null_handle_cmd(struct nullb_cmd *cmd) in null_handle_cmd() argument
279 blk_mq_complete_request(cmd->rq, cmd->rq->errors); in null_handle_cmd()
282 blk_complete_request(cmd->rq); in null_handle_cmd()
288 end_cmd(cmd); in null_handle_cmd()
293 end_cmd(cmd); in null_handle_cmd()
296 null_cmd_end_timer(cmd); in null_handle_cmd()
315 struct nullb_cmd *cmd; in null_queue_bio() local
317 cmd = alloc_cmd(nq, 1); in null_queue_bio()
318 cmd->bio = bio; in null_queue_bio()
320 null_handle_cmd(cmd); in null_queue_bio()
328 struct nullb_cmd *cmd; in null_rq_prep_fn() local
330 cmd = alloc_cmd(nq, 0); in null_rq_prep_fn()
331 if (cmd) { in null_rq_prep_fn()
332 cmd->rq = req; in null_rq_prep_fn()
333 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
360 hrtimer_init(&cmd->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); in null_queue_rq()
361 cmd->timer.function = null_cmd_timer_expired; in null_queue_rq()
363 cmd->rq = bd->rq; in null_queue_rq()
364 cmd->nq = hctx->driver_data; in null_queue_rq()
368 null_handle_cmd(cmd); in null_queue_rq()
589 struct nullb_cmd *cmd; in setup_commands() local
592 nq->cmds = kzalloc(nq->queue_depth * sizeof(*cmd), GFP_KERNEL); in setup_commands()
604 cmd = &nq->cmds[i]; in setup_commands()
605 INIT_LIST_HEAD(&cmd->list); in setup_commands()
606 cmd->ll_list.next = NULL; in setup_commands()
607 cmd->tag = -1U; in setup_commands()