lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1163414428.14165.4.camel@golias.tesarici.cz>
Date:	Mon, 13 Nov 2006 11:40:27 +0100
From:	Petr Tesařík <ptesarik@...e.cz>
To:	iss_storagedev@...com
Cc:	linux-kernel@...r.kernel.org
Subject: [PATCH] Update disk statistics for cciss and cpqarray devices

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


Download attachment "signature.asc" of type "application/pgp-signature" (190 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ