aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorse <se@FreeBSD.org>2006-06-12 02:41:57 +0800
committerse <se@FreeBSD.org>2006-06-12 02:41:57 +0800
commite0f3611f41640adef70b0ca8daec55ab368f36c9 (patch)
tree359b279e2bb37d4f775ccd0c2e6d8d401fd935d5
parentc8637ea5c4d2bb647108dd788ab878196bd0a4d0 (diff)
downloadfreebsd-ports-gnome-e0f3611f41640adef70b0ca8daec55ab368f36c9.tar.gz
freebsd-ports-gnome-e0f3611f41640adef70b0ca8daec55ab368f36c9.tar.zst
freebsd-ports-gnome-e0f3611f41640adef70b0ca8daec55ab368f36c9.zip
Fix two bugs affecting bonnie runs with large data files:
- A printf format specified a long operand but received an offset_t value. - The random numbers for large seek ranges were computed without regard for operator precedence and could become negative (for file sizes larger than 4GB, which was a wrong test for "large", since it did not account for the chunk size). The problems were found by etc at fluffles dot net (Enlightenment). Thanks for the detailed report. Guess there aren't many Bonnie users with multi- terabyte RAID systems; these bugs had been found long ago, else ...
-rw-r--r--benchmarks/bonnie/files/patch-ab17
1 files changed, 13 insertions, 4 deletions
diff --git a/benchmarks/bonnie/files/patch-ab b/benchmarks/bonnie/files/patch-ab
index f083a7e7270b..2a1a1800057f 100644
--- a/benchmarks/bonnie/files/patch-ab
+++ b/benchmarks/bonnie/files/patch-ab
@@ -1,5 +1,5 @@
---- Bonnie.c.orig Wed Aug 28 09:23:49 1996
-+++ Bonnie.c Tue Aug 27 09:12:19 2002
+--- Bonnie.c.orig Wed Aug 28 18:23:49 1996
++++ Bonnie.c Sun Jun 11 20:26:29 2006
@@ -49,7 +49,7 @@
#define Seeks (4000)
#define UpdateSeek (10)
@@ -9,6 +9,15 @@
/* labels for the tests, used as an array index */
typedef enum
+@@ -146,7 +146,7 @@
+ /* size is in meg, rounded down to multiple of Chunk */
+ size *= (1024 * 1024);
+ size = Chunk * (size / Chunk);
+- fprintf(stderr, "File '%s', size: %ld\n", name, size);
++ fprintf(stderr, "File '%s', size: %qd\n", name, (int64_t) size);
+
+ /* Fill up a file, writing it a char at a time with the stdio putc() call */
+ fprintf(stderr, "Writing with putc()...");
@@ -179,7 +179,7 @@
if (bufindex == Chunk / IntSize)
bufindex = 0;
@@ -32,10 +41,10 @@
{ /* until Mom says stop */
- doseek((long) (random() % (size / Chunk)), fd,
+ off_t seekto;
-+ if (size < ((off_t)1 << 32))
++ if (size / Chunk < (1 << 25))
+ seekto = random() % (size / Chunk);
+ else
-+ seekto = ((off_t)random() << 32 + random()) % (size / Chunk);
++ seekto = (((off_t)random() << 31) + random()) % (size / Chunk);
+ doseek(seekto, fd,
((lseek_count++ % UpdateSeek) == 0));
if (read(seek_control[0], seek_tickets, 1) != 1)