Add strong madvise() hint for cache pruning
[fio.git] / engines / solarisaio.c
index dfaa375a1e0aa6a06c91d97a6e54d93d9fb87041..069cda5347c903d9f458772508b2f6eed0d2fc39 100644 (file)
@@ -62,7 +62,7 @@ static void wait_for_event(struct timeval *tv)
                io_u->resid = io_u->xfer_buflen - io_u->resultp.aio_return;
                io_u->error = 0;
        } else
-               io_u->error = io_u->resultp.aio_return;
+               io_u->error = io_u->resultp.aio_errno;
 
        /*
         * For SIGIO, we need a write barrier between the two, so that
@@ -74,11 +74,6 @@ static void wait_for_event(struct timeval *tv)
        sd->nr--;
 }
 
-static void fio_solarisaio_sigio(int sig)
-{
-       wait_for_event(NULL);
-}
-
 static int fio_solarisaio_getevents(struct thread_data *td, unsigned int min,
                                    unsigned int max, struct timespec *t)
 {
@@ -131,6 +126,15 @@ static int fio_solarisaio_queue(struct thread_data fio_unused *td,
                return FIO_Q_COMPLETED;
        }
 
+       if (io_u->ddir == DDIR_DATASYNC) {
+               if (sd->nr)
+                       return FIO_Q_BUSY;
+               if (fdatasync(f->fd) < 0)
+                       io_u->error = errno;
+
+               return FIO_Q_COMPLETED;
+       }
+
        if (sd->nr == sd->max_depth)
                return FIO_Q_BUSY;
 
@@ -164,17 +168,22 @@ static void fio_solarisaio_cleanup(struct thread_data *td)
 /*
  * Set USE_SIGNAL_COMPLETIONS to use SIGIO as completion events.
  */
+#ifdef USE_SIGNAL_COMPLETIONS
+static void fio_solarisaio_sigio(int sig)
+{
+       wait_for_event(NULL);
+}
+
 static void fio_solarisaio_init_sigio(void)
 {
-#ifdef USE_SIGNAL_COMPLETIONS
        struct sigaction act;
 
        memset(&act, 0, sizeof(act));
        act.sa_handler = fio_solarisaio_sigio;
        act.sa_flags = SA_RESTART;
        sigaction(SIGIO, &act, NULL);
-#endif
 }
+#endif
 
 static int fio_solarisaio_init(struct thread_data *td)
 {
@@ -193,7 +202,9 @@ static int fio_solarisaio_init(struct thread_data *td)
        memset(sd->aio_events, 0, max_depth * sizeof(struct io_u *));
        sd->max_depth = max_depth;
 
+#ifdef USE_SIGNAL_COMPLETIONS
        fio_solarisaio_init_sigio();
+#endif
 
        td->io_ops->data = sd;
        return 0;
@@ -211,6 +222,7 @@ static struct ioengine_ops ioengine = {
        .cleanup        = fio_solarisaio_cleanup,
        .open_file      = generic_open_file,
        .close_file     = generic_close_file,
+       .get_file_size  = generic_get_file_size,
 };
 
 #else /* FIO_HAVE_SOLARISAIO */