/* Description: Insert a fully prepared request at the back of the I/O scheduler queue for execution and wait for completion.  */
int blk_execute_rq(struct request_queue *q, struct gendisk *bd_disk, struct request *rq, int at_head)
/* Description: Insert a fully prepared request at the back of the I/O scheduler queue for execution and wait for completion.  */
int blk_execute_rq(struct request_queue *q, struct gendisk *bd_disk, struct request *rq, int at_head)
{
	DECLARE_COMPLETION_ONSTACK(wait);
	char sense[SCSI_SENSE_BUFFERSIZE];
	int err = 0;
	rq->ref_count++;
	if (!rq->sense) {
		memset(sense, 0, sizeof(sense));
		rq->sense = sense;
		rq->sense_len = 0;
	}
	rq->end_io_data = &wait;
	blk_execute_rq_nowait(q, bd_disk, rq, at_head, blk_end_sync_rq);
	wait_for_completion(&wait);
	if (rq->errors)
		err = -EIO;
	return err;
}