Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752891AbYHNFWS (ORCPT ); Thu, 14 Aug 2008 01:22:18 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751272AbYHNFWH (ORCPT ); Thu, 14 Aug 2008 01:22:07 -0400 Received: from serv2.oss.ntt.co.jp ([222.151.198.100]:43120 "EHLO serv2.oss.ntt.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751156AbYHNFWG (ORCPT ); Thu, 14 Aug 2008 01:22:06 -0400 Subject: [PATCH] virtio_blk: use a wrapper function to access io context information of IO requests From: Fernando Luis =?ISO-8859-1?Q?V=E1zquez?= Cao To: Rusty Russell Cc: Jens Axboe , linux-kernel@vger.kernel.org, =?UTF-8?Q?=E5=90=89=E5=B7=9D_=E6=8B=93=E5=93=89?= , dpshah@google.com In-Reply-To: <1218691031.31285.20.camel@sebastian.kern.oss.ntt.co.jp> References: <1218014196.4419.44.camel@sebastian.kern.oss.ntt.co.jp> <1218611163.8001.108.camel@sebastian.kern.oss.ntt.co.jp> <1218615271.16667.38.camel@sebastian.kern.oss.ntt.co.jp> <200808141442.09633.rusty@rustcorp.com.au> <1218691031.31285.20.camel@sebastian.kern.oss.ntt.co.jp> Content-Type: text/plain Organization: NTT Open Source Software Center Date: Thu, 14 Aug 2008 14:22:03 +0900 Message-Id: <1218691323.31285.31.camel@sebastian.kern.oss.ntt.co.jp> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2585 Lines: 61 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 Acked-by: Rusty Russell --- diff -urNp linux-2.6.27-rc3/drivers/block/virtio_blk.c linux-2.6.27-rc3-fixes/drivers/block/virtio_blk.c --- linux-2.6.27-rc3/drivers/block/virtio_blk.c 2008-08-14 13:51:38.000000000 +0900 +++ linux-2.6.27-rc3-fixes/drivers/block/virtio_blk.c 2008-08-14 13:53:13.000000000 +0900 @@ -84,11 +84,11 @@ static bool do_req(struct request_queue if (blk_fs_request(vbr->req)) { vbr->out_hdr.type = 0; vbr->out_hdr.sector = vbr->req->sector; - vbr->out_hdr.ioprio = vbr->req->ioprio; + vbr->out_hdr.ioprio = req_get_ioprio(vbr->req); } else if (blk_pc_request(vbr->req)) { vbr->out_hdr.type = VIRTIO_BLK_T_SCSI_CMD; vbr->out_hdr.sector = 0; - vbr->out_hdr.ioprio = vbr->req->ioprio; + vbr->out_hdr.ioprio = req_get_ioprio(vbr->req); } else { /* We don't put anything else in the queue. */ BUG(); diff -urNp linux-2.6.27-rc3/include/linux/blkdev.h linux-2.6.27-rc3-fixes/include/linux/blkdev.h --- linux-2.6.27-rc3/include/linux/blkdev.h 2008-08-14 13:51:47.000000000 +0900 +++ linux-2.6.27-rc3-fixes/include/linux/blkdev.h 2008-08-14 13:53:34.000000000 +0900 @@ -233,6 +233,11 @@ struct request { struct request *next_rq; }; +static inline unsigned short req_get_ioprio(struct request *req) +{ + return req->ioprio; +} + /* * State information carried for REQ_TYPE_PM_SUSPEND and REQ_TYPE_PM_RESUME * requests. Some step values could eventually be made generic. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/