public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Update disk statistics for cciss and cpqarray devices
@ 2006-11-13 10:40 Petr Tesařík
  2006-11-13 10:48 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Petr Tesařík @ 2006-11-13 10:40 UTC (permalink / raw)
  To: iss_storagedev; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2066 bytes --]

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 <ptesarik@suse.cz>

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);
 }
 
 /*


[-- Attachment #2: Toto je digitálně podepsaná část zprávy --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-11-13 10:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-13 10:40 [PATCH] Update disk statistics for cciss and cpqarray devices Petr Tesařík
2006-11-13 10:48 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox