The request functions for cciss and cpqarray drivers do not update
statistics upon request completion. This would normally be done in
end_that_request_first(), but this function is not used by these
drivers, so the number of sectors read/written (as reported
in /proc/diskstat and consequently also by utilities like iostat) is
always zero.
The following patch adds correct statistics for both drivers.
Signed-off-by: Petr Tesarik <[email protected]>
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 6ffe2b2..235ecce 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -1298,6 +1298,12 @@ static void cciss_softirq_done(struct re
pci_unmap_page(h->pdev, temp64.val, cmd->SG[i].Len, ddir);
}
+ if (blk_fs_request(rq)) {
+ const int rw = rq_data_dir(rq);
+
+ disk_stat_add(rq->rq_disk, sectors[rw], bio_sectors(rq->bio));
+ }
+
complete_buffers(rq->bio, rq->errors);
#ifdef CCISS_DEBUG
diff --git a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c
index 570d2f0..902155d 100644
--- a/drivers/block/cpqarray.c
+++ b/drivers/block/cpqarray.c
@@ -998,6 +998,7 @@ static inline void complete_buffers(stru
*/
static inline void complete_command(cmdlist_t *cmd, int timeout)
{
+ struct request *rq = cmd->rq;
int ok=1;
int i, ddir;
@@ -1029,12 +1030,18 @@ static inline void complete_command(cmdl
pci_unmap_page(hba[cmd->ctlr]->pci_dev, cmd->req.sg[i].addr,
cmd->req.sg[i].size, ddir);
- complete_buffers(cmd->rq->bio, ok);
+ if (blk_fs_request(rq)) {
+ const int rw = rq_data_dir(rq);
- add_disk_randomness(cmd->rq->rq_disk);
+ disk_stat_add(rq->rq_disk, sectors[rw], bio_sectors(rq->bio));
+ }
+
+ complete_buffers(rq->bio, ok);
+
+ add_disk_randomness(rq->rq_disk);
- DBGPX(printk("Done with %p\n", cmd->rq););
- end_that_request_last(cmd->rq, ok ? 1 : -EIO);
+ DBGPX(printk("Done with %p\n", rq););
+ end_that_request_last(rq, ok ? 1 : -EIO);
}
/*
On Mon, Nov 13 2006, Petr Tesa??k wrote:
> The request functions for cciss and cpqarray drivers do not update
> statistics upon request completion. This would normally be done in
> end_that_request_first(), but this function is not used by these
> drivers, so the number of sectors read/written (as reported
> in /proc/diskstat and consequently also by utilities like iostat) is
> always zero.
>
> The following patch adds correct statistics for both drivers.
A similar patch was already posted last week and is pending inclusion.
--
Jens Axboe