diff options
author | Christoph Hellwig <hch@lst.de> | 2010-08-07 12:17:56 -0400 |
---|---|---|
committer | Jens Axboe <jaxboe@fusionio.com> | 2010-08-07 12:17:56 -0400 |
commit | 33659ebbae262228eef4e0fe990f393d1f0ed941 (patch) | |
tree | fcb537f09359c8dad3a6f6e16dc4319562dc42cc /drivers/block/virtio_blk.c | |
parent | 7e005f79791dcd58436c88ded4a7f5aed1b82147 (diff) |
block: remove wrappers for request type/flags
Remove all the trivial wrappers for the cmd_type and cmd_flags fields in
struct requests. This allows much easier grepping for different request
types instead of unwinding through macros.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'drivers/block/virtio_blk.c')
-rw-r--r-- | drivers/block/virtio_blk.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 258bc2ae2885..774144334ece 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c | |||
@@ -65,13 +65,16 @@ static void blk_done(struct virtqueue *vq) | |||
65 | break; | 65 | break; |
66 | } | 66 | } |
67 | 67 | ||
68 | if (blk_pc_request(vbr->req)) { | 68 | switch (vbr->req->cmd_type) { |
69 | case REQ_TYPE_BLOCK_PC: | ||
69 | vbr->req->resid_len = vbr->in_hdr.residual; | 70 | vbr->req->resid_len = vbr->in_hdr.residual; |
70 | vbr->req->sense_len = vbr->in_hdr.sense_len; | 71 | vbr->req->sense_len = vbr->in_hdr.sense_len; |
71 | vbr->req->errors = vbr->in_hdr.errors; | 72 | vbr->req->errors = vbr->in_hdr.errors; |
72 | } | 73 | break; |
73 | if (blk_special_request(vbr->req)) | 74 | case REQ_TYPE_SPECIAL: |
74 | vbr->req->errors = (error != 0); | 75 | vbr->req->errors = (error != 0); |
76 | break; | ||
77 | } | ||
75 | 78 | ||
76 | __blk_end_request_all(vbr->req, error); | 79 | __blk_end_request_all(vbr->req, error); |
77 | list_del(&vbr->list); | 80 | list_del(&vbr->list); |
@@ -123,7 +126,7 @@ static bool do_req(struct request_queue *q, struct virtio_blk *vblk, | |||
123 | BUG(); | 126 | BUG(); |
124 | } | 127 | } |
125 | 128 | ||
126 | if (blk_barrier_rq(vbr->req)) | 129 | if (vbr->req->cmd_flags & REQ_HARDBARRIER) |
127 | vbr->out_hdr.type |= VIRTIO_BLK_T_BARRIER; | 130 | vbr->out_hdr.type |= VIRTIO_BLK_T_BARRIER; |
128 | 131 | ||
129 | sg_set_buf(&vblk->sg[out++], &vbr->out_hdr, sizeof(vbr->out_hdr)); | 132 | sg_set_buf(&vblk->sg[out++], &vbr->out_hdr, sizeof(vbr->out_hdr)); |
@@ -134,12 +137,12 @@ static bool do_req(struct request_queue *q, struct virtio_blk *vblk, | |||
134 | * block, and before the normal inhdr we put the sense data and the | 137 | * block, and before the normal inhdr we put the sense data and the |
135 | * inhdr with additional status information before the normal inhdr. | 138 | * inhdr with additional status information before the normal inhdr. |
136 | */ | 139 | */ |
137 | if (blk_pc_request(vbr->req)) | 140 | if (vbr->req->cmd_type == REQ_TYPE_BLOCK_PC) |
138 | sg_set_buf(&vblk->sg[out++], vbr->req->cmd, vbr->req->cmd_len); | 141 | sg_set_buf(&vblk->sg[out++], vbr->req->cmd, vbr->req->cmd_len); |
139 | 142 | ||
140 | num = blk_rq_map_sg(q, vbr->req, vblk->sg + out); | 143 | num = blk_rq_map_sg(q, vbr->req, vblk->sg + out); |
141 | 144 | ||
142 | if (blk_pc_request(vbr->req)) { | 145 | if (vbr->req->cmd_type == REQ_TYPE_BLOCK_PC) { |
143 | sg_set_buf(&vblk->sg[num + out + in++], vbr->req->sense, 96); | 146 | sg_set_buf(&vblk->sg[num + out + in++], vbr->req->sense, 96); |
144 | sg_set_buf(&vblk->sg[num + out + in++], &vbr->in_hdr, | 147 | sg_set_buf(&vblk->sg[num + out + in++], &vbr->in_hdr, |
145 | sizeof(vbr->in_hdr)); | 148 | sizeof(vbr->in_hdr)); |