- io_u->offset, 0, gf_async_cb,
- (void *)io_u);
- else if (io_u->ddir == DDIR_SYNC) {
- r = glfs_fsync_async(g->fd, gf_async_cb, (void *)io_u);
- } else {
- log_err("unsupported operation.\n");
- io_u->error = -EINVAL;
- goto failed;
- }
+ io_u->offset, 0, gf_async_cb, 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_DATASYNC)
+ r = glfs_fdatasync_async(g->fd, gf_async_cb, io_u);
+ else if (io_u->ddir == DDIR_SYNC)
+ r = glfs_fsync_async(g->fd, gf_async_cb, io_u);
+ else
+ r = EINVAL;
+