engines/glfs_async: add trim support
[fio.git] / engines / glusterfs_async.c
index 599bc5dfbfc0acc1e3efe72a74d606cdf249e3b8..f2b9818a66634026636170cef0145b81b4c5e991 100644 (file)
@@ -67,7 +67,7 @@ static void fio_gf_io_u_free(struct thread_data *td, struct io_u *io_u)
                io_u->engine_data = NULL;
                free(io);
        }
-       fprintf(stderr, "issued %lu finished %lu\n", issued, cb_count);
+       log_err("issued %lu finished %lu\n", issued, cb_count);
 }
 
 static int fio_gf_io_u_init(struct thread_data *td, struct io_u *io_u)
@@ -120,6 +120,11 @@ static int fio_gf_async_queue(struct thread_data fio_unused * td,
                r = glfs_pwrite_async(g->fd, io_u->xfer_buf, io_u->xfer_buflen,
                                      io_u->offset, 0, gf_async_cb,
                                      (void *)io_u);
+#if defined(CONFIG_GF_TRIM)
+       else if (io_u->ddir == DDIR_TRIM)
+               r = glfs_discard_async(g->fd, io_u->offset, io_u->xfer_buflen,
+                                      gf_async_cb, io_u);
+#endif
        else if (io_u->ddir == DDIR_SYNC) {
                r = glfs_fsync_async(g->fd, gf_async_cb, (void *)io_u);
        } else {
@@ -145,8 +150,9 @@ int fio_gf_async_setup(struct thread_data *td)
 {
        int r = 0;
        struct gf_data *g = NULL;
+
 #if defined(NOT_YET)
-       fprintf(stderr, "the async interface is still very experimental...\n");
+       log_err("the async interface is still very experimental...\n");
 #endif
        r = fio_gf_setup(td);
        if (r) {