aboutsummaryrefslogtreecommitdiffstats
path: root/block/scsi_ioctl.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2014-06-06 09:57:37 -0400
committerJens Axboe <axboe@fb.com>2014-06-06 09:57:37 -0400
commitf27b087b81b70513b8c61ec20596c868f7b93474 (patch)
tree5dbdf3552f2289c28e65b0fee4490803bff87d42 /block/scsi_ioctl.c
parent762380ad9322951cea4ce9d24864265f9c66a916 (diff)
block: add blk_rq_set_block_pc()
With the optimizations around not clearing the full request at alloc time, we are leaving some of the needed init for REQ_TYPE_BLOCK_PC up to the user allocating the request. Add a blk_rq_set_block_pc() that sets the command type to REQ_TYPE_BLOCK_PC, and properly initializes the members associated with this type of request. Update callers to use this function instead of manipulating rq->cmd_type directly. Includes fixes from Christoph Hellwig <hch@lst.de> for my half-assed attempt. Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block/scsi_ioctl.c')
-rw-r--r--block/scsi_ioctl.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
index 9c28a5b38042..14695c6221c8 100644
--- a/block/scsi_ioctl.c
+++ b/block/scsi_ioctl.c
@@ -229,7 +229,6 @@ static int blk_fill_sghdr_rq(struct request_queue *q, struct request *rq,
229 * fill in request structure 229 * fill in request structure
230 */ 230 */
231 rq->cmd_len = hdr->cmd_len; 231 rq->cmd_len = hdr->cmd_len;
232 rq->cmd_type = REQ_TYPE_BLOCK_PC;
233 232
234 rq->timeout = msecs_to_jiffies(hdr->timeout); 233 rq->timeout = msecs_to_jiffies(hdr->timeout);
235 if (!rq->timeout) 234 if (!rq->timeout)
@@ -311,6 +310,7 @@ static int sg_io(struct request_queue *q, struct gendisk *bd_disk,
311 rq = blk_get_request(q, writing ? WRITE : READ, GFP_KERNEL); 310 rq = blk_get_request(q, writing ? WRITE : READ, GFP_KERNEL);
312 if (!rq) 311 if (!rq)
313 return -ENOMEM; 312 return -ENOMEM;
313 blk_rq_set_block_pc(rq);
314 314
315 if (blk_fill_sghdr_rq(q, rq, hdr, mode)) { 315 if (blk_fill_sghdr_rq(q, rq, hdr, mode)) {
316 blk_put_request(rq); 316 blk_put_request(rq);
@@ -491,7 +491,7 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode,
491 memset(sense, 0, sizeof(sense)); 491 memset(sense, 0, sizeof(sense));
492 rq->sense = sense; 492 rq->sense = sense;
493 rq->sense_len = 0; 493 rq->sense_len = 0;
494 rq->cmd_type = REQ_TYPE_BLOCK_PC; 494 blk_rq_set_block_pc(rq);
495 495
496 blk_execute_rq(q, disk, rq, 0); 496 blk_execute_rq(q, disk, rq, 0);
497 497
@@ -524,7 +524,7 @@ static int __blk_send_generic(struct request_queue *q, struct gendisk *bd_disk,
524 int err; 524 int err;
525 525
526 rq = blk_get_request(q, WRITE, __GFP_WAIT); 526 rq = blk_get_request(q, WRITE, __GFP_WAIT);
527 rq->cmd_type = REQ_TYPE_BLOCK_PC; 527 blk_rq_set_block_pc(rq);
528 rq->timeout = BLK_DEFAULT_SG_TIMEOUT; 528 rq->timeout = BLK_DEFAULT_SG_TIMEOUT;
529 rq->cmd[0] = cmd; 529 rq->cmd[0] = cmd;
530 rq->cmd[4] = data; 530 rq->cmd[4] = data;