Example #1
0
static inline void virtblk_request_done(struct request *req)
{
	struct virtblk_req *vbr = blk_mq_rq_to_pdu(req);
	int error = virtblk_result(vbr);

	if (req->cmd_type == REQ_TYPE_BLOCK_PC) {
		req->resid_len = vbr->in_hdr.residual;
		req->sense_len = vbr->in_hdr.sense_len;
		req->errors = vbr->in_hdr.errors;
	} else if (req->cmd_type == REQ_TYPE_SPECIAL) {
		req->errors = (error != 0);
	}

	blk_mq_end_io(req, error);
}
Example #2
0
static void end_cmd(struct nullb_cmd *cmd)
{
	if (cmd->rq) {
		if (queue_mode == NULL_Q_MQ)
			blk_mq_end_io(cmd->rq, 0);
		else {
			INIT_LIST_HEAD(&cmd->rq->queuelist);
			blk_end_request_all(cmd->rq, 0);
		}
	} else if (cmd->bio)
		bio_endio(cmd->bio, 0);

	if (queue_mode != NULL_Q_MQ)
		free_cmd(cmd);
}
Example #3
0
static void end_cmd(struct nullb_cmd *cmd)
{
	switch (queue_mode)  {
	case NULL_Q_MQ:
		blk_mq_end_io(cmd->rq, 0);
		return;
	case NULL_Q_RQ:
		INIT_LIST_HEAD(&cmd->rq->queuelist);
		blk_end_request_all(cmd->rq, 0);
		break;
	case NULL_Q_BIO:
		bio_endio(cmd->bio, 0);
		break;
	}

	free_cmd(cmd);
}