Commit 12c26749 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] fix disk IO stats for 512-byte IOs

If you're peforming 512-byte sized IOs.  With, say,

	dd of=/dev/raw/raw1 bs=512

then the `pgpgin' and `pgpgout' accounting just sits on zero.

This is because it counts in kbytes, and 512/1024 is zero.

So change it to count sectors, and divide that by two when we report it
to userspace.
parent 71419dc7
......@@ -1878,7 +1878,7 @@ void generic_make_request(struct bio *bio)
*/
int submit_bio(int rw, struct bio *bio)
{
int count = bio_sectors(bio) >> 1;
int count = bio_sectors(bio);
BUG_ON(!bio->bi_end_io);
BIO_BUG_ON(!bio->bi_size);
......
......@@ -1147,6 +1147,8 @@ static void *vmstat_start(struct seq_file *m, loff_t *pos)
if (!ps)
return ERR_PTR(-ENOMEM);
get_full_page_state(ps);
ps->pgpgin /= 2; /* sectors -> kbytes */
ps->pgpgout /= 2;
return (unsigned long *)ps + *pos;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment