Lines Matching refs:rq
220 static int blk_fill_sghdr_rq(struct request_queue *q, struct request *rq, in blk_fill_sghdr_rq() argument
223 struct scsi_request *req = scsi_req(rq); in blk_fill_sghdr_rq()
235 rq->timeout = msecs_to_jiffies(hdr->timeout); in blk_fill_sghdr_rq()
236 if (!rq->timeout) in blk_fill_sghdr_rq()
237 rq->timeout = q->sg_timeout; in blk_fill_sghdr_rq()
238 if (!rq->timeout) in blk_fill_sghdr_rq()
239 rq->timeout = BLK_DEFAULT_SG_TIMEOUT; in blk_fill_sghdr_rq()
240 if (rq->timeout < BLK_MIN_SG_TIMEOUT) in blk_fill_sghdr_rq()
241 rq->timeout = BLK_MIN_SG_TIMEOUT; in blk_fill_sghdr_rq()
246 static int blk_complete_sghdr_rq(struct request *rq, struct sg_io_hdr *hdr, in blk_complete_sghdr_rq() argument
249 struct scsi_request *req = scsi_req(rq); in blk_complete_sghdr_rq()
289 struct request *rq; in sg_io() local
314 rq = blk_get_request(q, writing ? REQ_OP_SCSI_OUT : REQ_OP_SCSI_IN, 0); in sg_io()
315 if (IS_ERR(rq)) in sg_io()
316 return PTR_ERR(rq); in sg_io()
317 req = scsi_req(rq); in sg_io()
325 ret = blk_fill_sghdr_rq(q, rq, hdr, mode); in sg_io()
334 ret = import_iovec(rq_data_dir(rq), hdr->dxferp, in sg_io()
342 ret = blk_rq_map_user_iov(q, rq, NULL, &i, GFP_KERNEL); in sg_io()
345 ret = blk_rq_map_user(q, rq, NULL, hdr->dxferp, hdr->dxfer_len, in sg_io()
351 bio = rq->bio; in sg_io()
360 blk_execute_rq(q, bd_disk, rq, at_head); in sg_io()
364 ret = blk_complete_sghdr_rq(rq, hdr, bio); in sg_io()
369 blk_put_request(rq); in sg_io()
411 struct request *rq; in sg_scsi_ioctl() local
440 rq = blk_get_request(q, in_len ? REQ_OP_SCSI_OUT : REQ_OP_SCSI_IN, 0); in sg_scsi_ioctl()
441 if (IS_ERR(rq)) { in sg_scsi_ioctl()
442 err = PTR_ERR(rq); in sg_scsi_ioctl()
445 req = scsi_req(rq); in sg_scsi_ioctl()
470 rq->timeout = FORMAT_UNIT_TIMEOUT; in sg_scsi_ioctl()
474 rq->timeout = START_STOP_TIMEOUT; in sg_scsi_ioctl()
477 rq->timeout = MOVE_MEDIUM_TIMEOUT; in sg_scsi_ioctl()
480 rq->timeout = READ_ELEMENT_STATUS_TIMEOUT; in sg_scsi_ioctl()
483 rq->timeout = READ_DEFECT_DATA_TIMEOUT; in sg_scsi_ioctl()
487 rq->timeout = BLK_DEFAULT_SG_TIMEOUT; in sg_scsi_ioctl()
491 if (bytes && blk_rq_map_kern(q, rq, buffer, bytes, GFP_NOIO)) { in sg_scsi_ioctl()
496 blk_execute_rq(q, disk, rq, 0); in sg_scsi_ioctl()
512 blk_put_request(rq); in sg_scsi_ioctl()
525 struct request *rq; in __blk_send_generic() local
528 rq = blk_get_request(q, REQ_OP_SCSI_OUT, 0); in __blk_send_generic()
529 if (IS_ERR(rq)) in __blk_send_generic()
530 return PTR_ERR(rq); in __blk_send_generic()
531 rq->timeout = BLK_DEFAULT_SG_TIMEOUT; in __blk_send_generic()
532 scsi_req(rq)->cmd[0] = cmd; in __blk_send_generic()
533 scsi_req(rq)->cmd[4] = data; in __blk_send_generic()
534 scsi_req(rq)->cmd_len = 6; in __blk_send_generic()
535 blk_execute_rq(q, bd_disk, rq, 0); in __blk_send_generic()
536 err = scsi_req(rq)->result ? -EIO : 0; in __blk_send_generic()
537 blk_put_request(rq); in __blk_send_generic()