Merge branch 'master' into gfio
authorJens Axboe <axboe@kernel.dk>
Thu, 5 Apr 2012 14:58:31 +0000 (08:58 -0600)
committerJens Axboe <axboe@kernel.dk>
Thu, 5 Apr 2012 14:58:31 +0000 (08:58 -0600)
Conflicts:
fio.c
fio.h

Signed-off-by: Jens Axboe <axboe@kernel.dk>
HOWTO
engines/windowsaio.c
fio.h
iolog.c
libfio.c
os/os-windows.h
os/windows/posix.c
stat.c

diff --git a/HOWTO b/HOWTO
index 3a0fdd558abd42fdd2952e7bc5811f4f8a3ce559..eeaddbac69520f3997bebd5cc8c8f79149e23626 100644 (file)
--- a/HOWTO
+++ b/HOWTO
@@ -1381,7 +1381,8 @@ runt=             The runtime of that thread
                latency, since queue/complete is one operation there. This
                value can be in milliseconds or microseconds, fio will choose
                the most appropriate base and print that. In the example
-               above, milliseconds is the best scale.
+               above, milliseconds is the best scale. Note: in --minimal mode
+               latencies are always expressed in microseconds.
        clat=   Completion latency. Same names as slat, this denotes the
                time from submission to completion of the io pieces. For
                sync io, clat will usually be equal (or very close) to 0,
@@ -1473,14 +1474,14 @@ Split up, the format is as follows:
                Completion latency: min, max, mean, deviation (usec)
                Completion latency percentiles: 20 fields (see below)
                Total latency: min, max, mean, deviation (usec)
-               Bw: min, max, aggregate percentage of total, mean, deviation
+               Bw (KB/s): min, max, aggregate percentage of total, mean, deviation
        WRITE status:
                Total IO (KB), bandwidth (KB/sec), IOPS, runtime (msec)
                Submission latency: min, max, mean, deviation (usec)
                Completion latency: min, max, mean, deviation (usec)
                Completion latency percentiles: 20 fields (see below)
                Total latency: min, max, mean, deviation (usec)
-               Bw: min, max, aggregate percentage of total, mean, deviation
+               Bw (KB/s): min, max, aggregate percentage of total, mean, deviation
        CPU usage: user, system, context switches, major faults, minor faults
        IO depths: <=1, 2, 4, 8, 16, 32, >=64
        IO latencies microseconds: <=2, 4, 10, 20, 50, 100, 250, 500, 750, 1000
index 766cc5d4fe6f0b684cfb6f0921a3d4b190aa0c85..ea899698b25e1474406e3c9a1fd7e3ddcc63c5a5 100644 (file)
@@ -82,16 +82,16 @@ static int fio_windowsaio_init(struct thread_data *td)
        }
 
        if (!rc) {
-           for (i = 0; i < td->o.iodepth; i++) {
-               wd->ovls[i].io_free = TRUE;
-               wd->ovls[i].io_complete = FALSE;
+               for (i = 0; i < td->o.iodepth; i++) {
+                       wd->ovls[i].io_free = TRUE;
+                       wd->ovls[i].io_complete = FALSE;
 
                        wd->ovls[i].o.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
                        if (wd->ovls[i].o.hEvent == NULL) {
                                rc = 1;
                                break;
                        }
-           }
+               }
        }
 
        if (!rc) {
@@ -287,6 +287,7 @@ static int fio_windowsaio_getevents(struct thread_data *td, unsigned int min,
                        if (fov->io_complete) {
                                fov->io_complete = FALSE;
                                fov->io_free  = TRUE;
+                               ResetEvent(fov->o.hEvent);
                                wd->aio_events[dequeued] = io_u;
                                dequeued++;
                        }
@@ -297,7 +298,7 @@ static int fio_windowsaio_getevents(struct thread_data *td, unsigned int min,
 
                if (dequeued < min) {
                        status = WaitForSingleObject(wd->iocomplete_event, mswait);
-                       if (status != WAIT_OBJECT_0 && dequeued > 0)
+                       if (status != WAIT_OBJECT_0 && dequeued >= min)
                            break;
                }
 
@@ -322,17 +323,15 @@ static int fio_windowsaio_queue(struct thread_data *td, struct io_u *io_u)
        wd = td->io_ops->data;
 
        for (index = 0; index < td->o.iodepth; index++) {
-               if (wd->ovls[index].io_free) {
-                       wd->ovls[index].io_free = FALSE;
-                       ResetEvent(wd->ovls[index].o.hEvent);
+               if (wd->ovls[index].io_free)
                        break;
-               }
        }
 
        assert(index < td->o.iodepth);
 
-       lpOvl = &wd->ovls[index].o;
+       wd->ovls[index].io_free = FALSE;
        wd->ovls[index].io_u = io_u;
+       lpOvl = &wd->ovls[index].o;
        lpOvl->Internal = STATUS_PENDING;
        lpOvl->InternalHigh = 0;
        lpOvl->Offset = io_u->offset & 0xFFFFFFFF;
diff --git a/fio.h b/fio.h
index 8246e38856a22321fae6bcab9410ed401f64cabd..95d9d77c555b6cc044e9cb485003b25535e8c3e3 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -314,7 +314,7 @@ extern int shm_id;
 extern int groupid;
 extern int terse_output;
 extern int temp_stall_ts;
-extern unsigned long page_mask, page_size;
+extern uintptr_t page_mask, page_size;
 extern int read_only;
 extern int eta_print;
 extern unsigned long done_secs;
diff --git a/iolog.c b/iolog.c
index 0e492363465e9a94ad88433008fbcfdf59485e2f..137c1e9889c8e025a59d8ab71df7378b767ef996 100644 (file)
--- a/iolog.c
+++ b/iolog.c
@@ -238,7 +238,9 @@ restart:
                else if (ipo->offset > __ipo->offset)
                        p = &(*p)->rb_right;
                else {
-                       assert(ipo->len == __ipo->len);
+                       dprint(FD_IO, "iolog: overlap %llu/%lu, %llu/%lu",
+                               __ipo->offset, __ipo->len,
+                               ipo->offset, ipo->len);
                        td->io_hist_len--;
                        rb_erase(parent, &td->io_hist_tree);
                        remove_trim_entry(td, __ipo);
index acdb0ea468a8d3855ecc4affcc395dd086218ee3..36876ddf24dc66c25f9b778fc4141acb122e433f 100644 (file)
--- a/libfio.c
+++ b/libfio.c
@@ -41,8 +41,8 @@ FLIST_HEAD(disk_list);
 
 unsigned long arch_flags = 0;
 
-unsigned long page_mask;
-unsigned long page_size;
+uintptr_t page_mask;
+uintptr_t page_size;
 
 static const char *fio_os_strings[os_nr] = {
        "Invalid",
index 06fe4335beb7bda4095dd3304c8deab454ecfb38..8b801ed5bfabf959236fbf8711060d63e5db7037 100644 (file)
@@ -20,6 +20,7 @@
 #define FIO_HAVE_CHARDEV_SIZE
 #define FIO_HAVE_FDATASYNC
 #define FIO_HAVE_WINDOWSAIO
+#define FIO_HAVE_FALLOCATE
 #define FIO_HAVE_GETTID
 #define FIO_HAVE_CLOCK_MONOTONIC
 #define FIO_USE_GENERIC_RAND
index ba7abb54a97b6fd2473ed975bcbc58cb1f3ae05a..9ef369e1d313af14440e7f38618afddafb8322a2 100755 (executable)
@@ -331,9 +331,43 @@ char *basename(char *path)
 
 int posix_fallocate(int fd, off_t offset, off_t len)
 {
-       log_err("%s is not implemented\n", __func__);
-       errno = ENOSYS;
-       return (-1);
+       const int BUFFER_SIZE = 64*1024*1024;
+       int rc = 0;
+       char *buf;
+       unsigned int write_len;
+       unsigned int bytes_written;
+       off_t bytes_remaining = len;
+
+       if (len == 0 || offset < 0)
+               return EINVAL;
+
+       buf = malloc(BUFFER_SIZE);
+
+       if (buf == NULL)
+               return ENOMEM;
+
+       memset(buf, 0, BUFFER_SIZE);
+
+       if (lseek(fd, offset, SEEK_SET) == -1)
+               return errno;
+
+       while (bytes_remaining > 0) {
+               if (bytes_remaining < BUFFER_SIZE)
+                       write_len = (unsigned int)bytes_remaining;
+               else
+                       write_len = BUFFER_SIZE;
+
+               bytes_written = _write(fd, buf, write_len);
+               if (bytes_written == -1) {
+                       rc = errno;
+                       break;
+               }
+
+               bytes_remaining -= bytes_written;
+       }
+
+       free(buf);
+       return rc;
 }
 
 int ftruncate(int fildes, off_t length)
@@ -545,7 +579,7 @@ int poll(struct pollfd fds[], nfds_t nfds, int timeout)
        int rc;
 
        if (timeout != -1)
-               to = &tv;               
+               to = &tv;
 
        to->tv_sec = timeout / 1000;
        to->tv_usec = (timeout % 1000) * 1000;
@@ -567,7 +601,7 @@ int poll(struct pollfd fds[], nfds_t nfds, int timeout)
                if (fds[i].events & POLLOUT)
                        FD_SET(fds[i].fd, &writefds);
 
-               FD_SET(fds[i].fd, &exceptfds);          
+               FD_SET(fds[i].fd, &exceptfds);
        }
 
        rc = select(nfds, &readfds, &writefds, &exceptfds, to);
diff --git a/stat.c b/stat.c
index f15ebeba6b7a8db2763594f4afe086054e05e25e..eff1a27e4d135acae099bca57513a980f935b44b 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -1010,10 +1010,11 @@ void show_run_stats(void)
 
                        bw = 0;
                        if (ts->runtime[j]) {
-                               unsigned long runt;
+                               unsigned long runt = ts->runtime[j];
+                               unsigned long long kb;
 
-                               runt = ts->runtime[j];
-                               bw = ts->io_bytes[j] / runt;
+                               kb = ts->io_bytes[j] / rs->kb_base;
+                               bw = kb * 1000 / runt;
                        }
                        if (bw < rs->min_bw[j])
                                rs->min_bw[j] = bw;
@@ -1025,16 +1026,12 @@ void show_run_stats(void)
        }
 
        for (i = 0; i < groupid + 1; i++) {
-               unsigned long max_run[2];
-
                rs = &runstats[i];
-               max_run[0] = rs->max_run[0];
-               max_run[1] = rs->max_run[1];
 
                if (rs->max_run[0])
-                       rs->agg[0] = (rs->io_kb[0] * 1000) / max_run[0];
+                       rs->agg[0] = (rs->io_kb[0] * 1000) / rs->max_run[0];
                if (rs->max_run[1])
-                       rs->agg[1] = (rs->io_kb[1] * 1000) / max_run[1];
+                       rs->agg[1] = (rs->io_kb[1] * 1000) / rs->max_run[1];
        }
 
        /*