fix off-by-one issues in blkiomon.h
authorMartin Peschke <mpeschke@linux.vnet.ibm.com>
Mon, 20 Apr 2009 14:07:11 +0000 (16:07 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Tue, 21 Apr 2009 07:21:55 +0000 (09:21 +0200)
Fix two off-by-one issues. Last bucket of histogram was ommitted by mistake
when being converted to big-endian or when being merged with another bucket.

Signed-off-by: Martin Peschke <mpeschke@linux.vnet.ibm.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
stats.h

diff --git a/stats.h b/stats.h
index e519af48df57c69818f414b431ba9a37c7703455..fdedf27dc940482adb5b928c30cf598b9e93df9a 100644 (file)
--- a/stats.h
+++ b/stats.h
@@ -124,7 +124,7 @@ static inline void histlog2_merge(struct histlog2 *h, __u32 *dst, __u32 *src)
 {
        int i;
 
-       for (i = 0; i < h->num - 1; i++)
+       for (i = 0; i < h->num; i++)
                dst[i] += src[i];
 }
 
@@ -132,7 +132,7 @@ static inline void histlog2_to_be(__u32 a[], struct histlog2 *h)
 {
        int i;
 
-       for (i = 0; i < h->num - 1; i++)
+       for (i = 0; i < h->num; i++)
                a[i] = cpu_to_be32(a[i]);
 }