Add the 'zbd' debug level
[fio.git] / engines / fusion-aw.c
index 9092eca8d7d06f94c20b049830d86bc158c34f3a..eb5fdf504ea65ea4cab8ef546d29bde7c44b72d9 100644 (file)
@@ -24,6 +24,8 @@
 
 #include <nvm/nvm_primitives.h>
 
+#define NUM_ATOMIC_CAPABILITIES (5)
+
 struct fas_data {
        nvm_handle_t nvm_handle;
        size_t xfer_buf_align;
@@ -32,10 +34,10 @@ struct fas_data {
        size_t sector_size;
 };
 
-static int queue(struct thread_data *td, struct io_u *io_u)
+static enum fio_q_status queue(struct thread_data *td, struct io_u *io_u)
 {
+       struct fas_data *d = FILE_ENG_DATA(io_u->file);
        int rc;
-       struct fas_data *d = (struct fas_data *) io_u->file->engine_data;
 
        if (io_u->ddir != DDIR_WRITE) {
                td_vmsg(td, EINVAL, "only writes supported", "io_u->ddir");
@@ -82,7 +84,7 @@ static int open_file(struct thread_data *td, struct fio_file *f)
        int fio_unused close_file_rc;
        struct fas_data *d;
        nvm_version_t nvm_version;
-       nvm_capability_t nvm_capability[4];
+       nvm_capability_t nvm_capability[NUM_ATOMIC_CAPABILITIES];
 
 
        d = malloc(sizeof(*d));
@@ -92,7 +94,7 @@ static int open_file(struct thread_data *td, struct fio_file *f)
                goto error;
        }
        d->nvm_handle = -1;
-       f->engine_data = (uintptr_t) d;
+       FILE_SET_ENG_DATA(f, d);
 
        rc = generic_open_file(td, f);
 
@@ -115,12 +117,14 @@ static int open_file(struct thread_data *td, struct fio_file *f)
        nvm_capability[1].cap_id = NVM_CAP_ATOMIC_WRITE_MULTIPLICITY_ID;
        nvm_capability[2].cap_id = NVM_CAP_ATOMIC_WRITE_MAX_VECTOR_SIZE_ID;
        nvm_capability[3].cap_id = NVM_CAP_SECTOR_SIZE_ID;
-       rc = nvm_get_capabilities(d->nvm_handle, nvm_capability, 4, 0);
+       nvm_capability[4].cap_id = NVM_CAP_ATOMIC_MAX_IOV_ID;
+       rc = nvm_get_capabilities(d->nvm_handle, nvm_capability,
+                                  NUM_ATOMIC_CAPABILITIES, false);
        if (rc == -1) {
                td_vmsg(td, errno, "error in getting atomic write capabilities", "nvm_get_capabilities");
                rc = errno;
                goto close_file;
-       } else if (rc < 4) {
+       } else if (rc < NUM_ATOMIC_CAPABILITIES) {
                td_vmsg(td, EINVAL, "couldn't get all the atomic write capabilities" , "nvm_get_capabilities");
                rc = ECANCELED;
                goto close_file;
@@ -129,7 +133,7 @@ static int open_file(struct thread_data *td, struct fio_file *f)
        rc = 0;
        d->xfer_buf_align = nvm_capability[0].cap_value;
        d->xfer_buflen_align = nvm_capability[1].cap_value;
-       d->xfer_buflen_max = d->xfer_buflen_align * nvm_capability[2].cap_value;
+       d->xfer_buflen_max = d->xfer_buflen_align * nvm_capability[2].cap_value * nvm_capability[4].cap_value;
        d->sector_size = nvm_capability[3].cap_value;
 
 out:
@@ -140,19 +144,19 @@ free_engine_data:
        free(d);
 error:
        f->fd = -1;
-       f->engine_data = 0;
+       FILE_SET_ENG_DATA(f, NULL);
        goto out;
 }
 
 static int close_file(struct thread_data *td, struct fio_file *f)
 {
-       struct fas_data *d = (struct fas_data *) f->engine_data;
+       struct fas_data *d = FILE_ENG_DATA(f);
 
        if (d) {
                if (d->nvm_handle != -1)
                        nvm_release_handle(d->nvm_handle);
                free(d);
-               f->engine_data = 0;
+               FILE_SET_ENG_DATA(f, NULL);
        }
 
        return generic_close_file(td, f);