aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFernando Luis Vázquez Cao <fernando@oss.ntt.co.jp>2008-08-14 03:59:13 -0400
committerJens Axboe <jens.axboe@oracle.com>2008-10-09 02:56:02 -0400
commit766ca4428d1239a970926856c447310c9c191af2 (patch)
treeddf5f709a4a0c67aabd4af5166f8735d5228d671
parent1a8e2bddd5c29008f311613e75925fecbf522c5b (diff)
virtio_blk: use a wrapper function to access io context information of IO requests
struct request has an ioprio member but it is never updated because currently bios do not hold io context information. The implication of this is that virtio_blk ends up passing useless information to the backend driver. That said, some IO schedulers such as CFQ do store io context information in struct request, but use private members for that, which means that that information cannot be directly accessed in a IO scheduler-independent way. This patch adds a function to obtain the ioprio of a request. We should avoid accessing ioprio directly and use this function instead, so that its users do not have to care about future changes in block layer structures or what the currently active IO controller is. This patch does not introduce any functional changes but paves the way for future clean-ups and enhancements. Signed-off-by: Fernando Luis Vazquez Cao <fernando@oss.ntt.co.jp> Acked-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-rw-r--r--drivers/block/virtio_blk.c4
-rw-r--r--include/linux/blkdev.h5
2 files changed, 7 insertions, 2 deletions
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 42251095134f..879506a2c234 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -84,11 +84,11 @@ static bool do_req(struct request_queue *q, struct virtio_blk *vblk,
84 if (blk_fs_request(vbr->req)) { 84 if (blk_fs_request(vbr->req)) {
85 vbr->out_hdr.type = 0; 85 vbr->out_hdr.type = 0;
86 vbr->out_hdr.sector = vbr->req->sector; 86 vbr->out_hdr.sector = vbr->req->sector;
87 vbr->out_hdr.ioprio = vbr->req->ioprio; 87 vbr->out_hdr.ioprio = req_get_ioprio(vbr->req);
88 } else if (blk_pc_request(vbr->req)) { 88 } else if (blk_pc_request(vbr->req)) {
89 vbr->out_hdr.type = VIRTIO_BLK_T_SCSI_CMD; 89 vbr->out_hdr.type = VIRTIO_BLK_T_SCSI_CMD;
90 vbr->out_hdr.sector = 0; 90 vbr->out_hdr.sector = 0;
91 vbr->out_hdr.ioprio = vbr->req->ioprio; 91 vbr->out_hdr.ioprio = req_get_ioprio(vbr->req);
92 } else { 92 } else {
93 /* We don't put anything else in the queue. */ 93 /* We don't put anything else in the queue. */
94 BUG(); 94 BUG();
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index f131776f029e..490ce458b031 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -232,6 +232,11 @@ struct request {
232 struct request *next_rq; 232 struct request *next_rq;
233}; 233};
234 234
235static inline unsigned short req_get_ioprio(struct request *req)
236{
237 return req->ioprio;
238}
239
235/* 240/*
236 * State information carried for REQ_TYPE_PM_SUSPEND and REQ_TYPE_PM_RESUME 241 * State information carried for REQ_TYPE_PM_SUSPEND and REQ_TYPE_PM_RESUME
237 * requests. Some step values could eventually be made generic. 242 * requests. Some step values could eventually be made generic.