diff options
author | Jens Axboe <axboe@fb.com> | 2014-06-06 09:57:37 -0400 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2014-06-06 09:57:37 -0400 |
commit | f27b087b81b70513b8c61ec20596c868f7b93474 (patch) | |
tree | 5dbdf3552f2289c28e65b0fee4490803bff87d42 /block/bsg.c | |
parent | 762380ad9322951cea4ce9d24864265f9c66a916 (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/bsg.c')
-rw-r--r-- | block/bsg.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/block/bsg.c b/block/bsg.c index e5214c148096..ff46addde5d8 100644 --- a/block/bsg.c +++ b/block/bsg.c | |||
@@ -196,7 +196,6 @@ static int blk_fill_sgv4_hdr_rq(struct request_queue *q, struct request *rq, | |||
196 | * fill in request structure | 196 | * fill in request structure |
197 | */ | 197 | */ |
198 | rq->cmd_len = hdr->request_len; | 198 | rq->cmd_len = hdr->request_len; |
199 | rq->cmd_type = REQ_TYPE_BLOCK_PC; | ||
200 | 199 | ||
201 | rq->timeout = msecs_to_jiffies(hdr->timeout); | 200 | rq->timeout = msecs_to_jiffies(hdr->timeout); |
202 | if (!rq->timeout) | 201 | if (!rq->timeout) |
@@ -273,6 +272,8 @@ bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm, | |||
273 | rq = blk_get_request(q, rw, GFP_KERNEL); | 272 | rq = blk_get_request(q, rw, GFP_KERNEL); |
274 | if (!rq) | 273 | if (!rq) |
275 | return ERR_PTR(-ENOMEM); | 274 | return ERR_PTR(-ENOMEM); |
275 | blk_rq_set_block_pc(rq); | ||
276 | |||
276 | ret = blk_fill_sgv4_hdr_rq(q, rq, hdr, bd, has_write_perm); | 277 | ret = blk_fill_sgv4_hdr_rq(q, rq, hdr, bd, has_write_perm); |
277 | if (ret) | 278 | if (ret) |
278 | goto out; | 279 | goto out; |