• Home
  • Raw
  • Download

Lines Matching refs:rq

83 	struct request *rq;  member
139 static int blk_fill_sgv4_hdr_rq(struct request_queue *q, struct request *rq, in blk_fill_sgv4_hdr_rq() argument
144 rq->cmd = kzalloc(hdr->request_len, GFP_KERNEL); in blk_fill_sgv4_hdr_rq()
145 if (!rq->cmd) in blk_fill_sgv4_hdr_rq()
149 if (copy_from_user(rq->cmd, (void __user *)(unsigned long)hdr->request, in blk_fill_sgv4_hdr_rq()
154 if (blk_verify_command(rq->cmd, has_write_perm)) in blk_fill_sgv4_hdr_rq()
162 rq->cmd_len = hdr->request_len; in blk_fill_sgv4_hdr_rq()
164 rq->timeout = msecs_to_jiffies(hdr->timeout); in blk_fill_sgv4_hdr_rq()
165 if (!rq->timeout) in blk_fill_sgv4_hdr_rq()
166 rq->timeout = q->sg_timeout; in blk_fill_sgv4_hdr_rq()
167 if (!rq->timeout) in blk_fill_sgv4_hdr_rq()
168 rq->timeout = BLK_DEFAULT_SG_TIMEOUT; in blk_fill_sgv4_hdr_rq()
169 if (rq->timeout < BLK_MIN_SG_TIMEOUT) in blk_fill_sgv4_hdr_rq()
170 rq->timeout = BLK_MIN_SG_TIMEOUT; in blk_fill_sgv4_hdr_rq()
212 struct request *rq, *next_rq = NULL; in bsg_map_hdr() local
236 rq = blk_get_request(q, rw, GFP_KERNEL); in bsg_map_hdr()
237 if (IS_ERR(rq)) in bsg_map_hdr()
238 return rq; in bsg_map_hdr()
239 blk_rq_set_block_pc(rq); in bsg_map_hdr()
241 ret = blk_fill_sgv4_hdr_rq(q, rq, hdr, bd, has_write_perm); in bsg_map_hdr()
257 rq->next_rq = next_rq; in bsg_map_hdr()
258 next_rq->cmd_type = rq->cmd_type; in bsg_map_hdr()
277 ret = blk_rq_map_user(q, rq, NULL, dxferp, dxfer_len, in bsg_map_hdr()
283 rq->sense = sense; in bsg_map_hdr()
284 rq->sense_len = 0; in bsg_map_hdr()
286 return rq; in bsg_map_hdr()
288 if (rq->cmd != rq->__cmd) in bsg_map_hdr()
289 kfree(rq->cmd); in bsg_map_hdr()
290 blk_put_request(rq); in bsg_map_hdr()
302 static void bsg_rq_end_io(struct request *rq, int uptodate) in bsg_rq_end_io() argument
304 struct bsg_command *bc = rq->end_io_data; in bsg_rq_end_io()
309 bd->name, rq, bc, bc->bio, uptodate); in bsg_rq_end_io()
326 struct bsg_command *bc, struct request *rq) in bsg_add_command() argument
333 bc->rq = rq; in bsg_add_command()
334 bc->bio = rq->bio; in bsg_add_command()
335 if (rq->next_rq) in bsg_add_command()
336 bc->bidi_bio = rq->next_rq->bio; in bsg_add_command()
342 dprintk("%s: queueing rq %p, bc %p\n", bd->name, rq, bc); in bsg_add_command()
344 rq->end_io_data = bc; in bsg_add_command()
345 blk_execute_rq_nowait(q, NULL, rq, at_head, bsg_rq_end_io); in bsg_add_command()
393 static int blk_complete_sgv4_hdr_rq(struct request *rq, struct sg_io_v4 *hdr, in blk_complete_sgv4_hdr_rq() argument
398 dprintk("rq %p bio %p 0x%x\n", rq, bio, rq->errors); in blk_complete_sgv4_hdr_rq()
402 hdr->device_status = rq->errors & 0xff; in blk_complete_sgv4_hdr_rq()
403 hdr->transport_status = host_byte(rq->errors); in blk_complete_sgv4_hdr_rq()
404 hdr->driver_status = driver_byte(rq->errors); in blk_complete_sgv4_hdr_rq()
410 if (rq->sense_len && hdr->response) { in blk_complete_sgv4_hdr_rq()
412 rq->sense_len); in blk_complete_sgv4_hdr_rq()
415 rq->sense, len); in blk_complete_sgv4_hdr_rq()
422 if (rq->next_rq) { in blk_complete_sgv4_hdr_rq()
423 hdr->dout_resid = rq->resid_len; in blk_complete_sgv4_hdr_rq()
424 hdr->din_resid = rq->next_rq->resid_len; in blk_complete_sgv4_hdr_rq()
426 blk_put_request(rq->next_rq); in blk_complete_sgv4_hdr_rq()
427 } else if (rq_data_dir(rq) == READ) in blk_complete_sgv4_hdr_rq()
428 hdr->din_resid = rq->resid_len; in blk_complete_sgv4_hdr_rq()
430 hdr->dout_resid = rq->resid_len; in blk_complete_sgv4_hdr_rq()
438 if (!ret && rq->errors < 0) in blk_complete_sgv4_hdr_rq()
439 ret = rq->errors; in blk_complete_sgv4_hdr_rq()
442 if (rq->cmd != rq->__cmd) in blk_complete_sgv4_hdr_rq()
443 kfree(rq->cmd); in blk_complete_sgv4_hdr_rq()
444 blk_put_request(rq); in blk_complete_sgv4_hdr_rq()
501 tret = blk_complete_sgv4_hdr_rq(bc->rq, &bc->hdr, bc->bio, in bsg_complete_all_commands()
536 ret = blk_complete_sgv4_hdr_rq(bc->rq, &bc->hdr, bc->bio, in __bsg_read()
600 struct request *rq; in __bsg_write() local
607 rq = NULL; in __bsg_write()
628 rq = bsg_map_hdr(bd, &bc->hdr, has_write_perm, bc->sense); in __bsg_write()
629 if (IS_ERR(rq)) { in __bsg_write()
630 ret = PTR_ERR(rq); in __bsg_write()
631 rq = NULL; in __bsg_write()
635 bsg_add_command(bd, q, bc, rq); in __bsg_write()
637 rq = NULL; in __bsg_write()
751 struct request_queue *rq, in bsg_add_device() argument
758 if (!blk_get_queue(rq)) in bsg_add_device()
763 blk_put_queue(rq); in bsg_add_device()
767 bd->queue = rq; in bsg_add_device()
775 strncpy(bd->name, dev_name(rq->bsg_dev.class_dev), sizeof(bd->name) - 1); in bsg_add_device()
910 struct request *rq; in bsg_ioctl() local
919 rq = bsg_map_hdr(bd, &hdr, file->f_mode & FMODE_WRITE, sense); in bsg_ioctl()
920 if (IS_ERR(rq)) in bsg_ioctl()
921 return PTR_ERR(rq); in bsg_ioctl()
923 bio = rq->bio; in bsg_ioctl()
924 if (rq->next_rq) in bsg_ioctl()
925 bidi_bio = rq->next_rq->bio; in bsg_ioctl()
928 blk_execute_rq(bd->queue, NULL, rq, at_head); in bsg_ioctl()
929 ret = blk_complete_sgv4_hdr_rq(rq, &hdr, bio, bidi_bio); in bsg_ioctl()