[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100415054348.15836.88264.stgit@austin.mtv.corp.google.com>
Date: Wed, 14 Apr 2010 22:44:31 -0700
From: Divyesh Shah <dpshah@...gle.com>
To: jens.axboe@...cle.com
Cc: linux-kernel@...r.kernel.org, nauman@...gle.com, rickyb@...gle.com
Subject: [PATCH 1/4] block: Re-introduce rq->__nr_sectors to maintain the
original size of the request right through completion where it will be useful
for the disk performance histograms.
Signed-off-by: Divyesh Shah <dpshah@...gle.com>
---
block/blk-core.c | 4 ++++
block/blk-merge.c | 1 +
include/linux/blkdev.h | 7 +++++++
3 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/block/blk-core.c b/block/blk-core.c
index e9a5ae2..f18e7b7 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1159,6 +1159,7 @@ static int __make_request(struct request_queue *q, struct bio *bio)
struct request *req;
int el_ret;
unsigned int bytes = bio->bi_size;
+ const unsigned int nr_sectors = bio_sectors(bio);
const unsigned short prio = bio_prio(bio);
const bool sync = bio_rw_flagged(bio, BIO_RW_SYNCIO);
const bool unplug = bio_rw_flagged(bio, BIO_RW_UNPLUG);
@@ -1198,6 +1199,7 @@ static int __make_request(struct request_queue *q, struct bio *bio)
req->biotail->bi_next = bio;
req->biotail = bio;
req->__data_len += bytes;
+ req->__nr_sectors += nr_sectors;
req->ioprio = ioprio_best(req->ioprio, prio);
if (!blk_rq_cpu_valid(req))
req->cpu = bio->bi_comp_cpu;
@@ -1232,6 +1234,7 @@ static int __make_request(struct request_queue *q, struct bio *bio)
req->buffer = bio_data(bio);
req->__sector = bio->bi_sector;
req->__data_len += bytes;
+ req->__nr_sectors += nr_sectors;
req->ioprio = ioprio_best(req->ioprio, prio);
if (!blk_rq_cpu_valid(req))
req->cpu = bio->bi_comp_cpu;
@@ -2350,6 +2353,7 @@ void blk_rq_bio_prep(struct request_queue *q, struct request *rq,
}
rq->__data_len = bio->bi_size;
rq->bio = rq->biotail = bio;
+ rq->__nr_sectors = bio_sectors(bio);
if (bio->bi_bdev)
rq->rq_disk = bio->bi_bdev->bd_disk;
diff --git a/block/blk-merge.c b/block/blk-merge.c
index 5e7dc99..ee0bb50 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -411,6 +411,7 @@ static int attempt_merge(struct request_queue *q, struct request *req,
req->biotail = next->biotail;
req->__data_len += blk_rq_bytes(next);
+ req->__nr_sectors += blk_rq_size(next);
elv_merge_requests(q, req, next);
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index d483c49..4cc2cdf 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -170,6 +170,7 @@ struct request {
/* the following two fields are internal, NEVER access directly */
unsigned int __data_len; /* total data len */
sector_t __sector; /* sector cursor */
+ sector_t __nr_sectors; /* Total number of sectors */
struct bio *bio;
struct bio *biotail;
@@ -844,6 +845,7 @@ static inline struct request_queue *bdev_get_queue(struct block_device *bdev)
/*
* blk_rq_pos() : the current sector
+ * blk_rq_size() : the size of the request in sectors
* blk_rq_bytes() : bytes left in the entire request
* blk_rq_cur_bytes() : bytes left in the current segment
* blk_rq_err_bytes() : bytes left till the next error boundary
@@ -855,6 +857,11 @@ static inline sector_t blk_rq_pos(const struct request *rq)
return rq->__sector;
}
+static inline sector_t blk_rq_size(const struct request *rq)
+{
+ return rq->__nr_sectors;
+}
+
static inline unsigned int blk_rq_bytes(const struct request *rq)
{
return rq->__data_len;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists