Merge branch 'libaio/actual_min_algo_update' of https://github.com/dpronin/fio
[fio.git] / io_u.c
diff --git a/io_u.c b/io_u.c
index eb617e649c1df82dba42259361cd36f3a32e7796..faf512e53a39e6704764777e80f3f8da6a88517c 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -984,10 +984,15 @@ static int fill_io_u(struct thread_data *td, struct io_u *io_u)
        offset = io_u->offset;
        if (td->o.zone_mode == ZONE_MODE_ZBD) {
                ret = zbd_adjust_block(td, io_u);
-               if (ret == io_u_eof)
+               if (ret == io_u_eof) {
+                       dprint(FD_IO, "zbd_adjust_block() returned io_u_eof\n");
                        return 1;
+               }
        }
 
+       if (td->o.fdp)
+               fdp_fill_dspec_data(td, io_u);
+
        if (io_u->offset + io_u->buflen > io_u->file->real_file_size) {
                dprint(FD_IO, "io_u %p, off=0x%llx + len=0x%llx exceeds file size=0x%llx\n",
                        io_u,
@@ -1365,8 +1370,8 @@ static struct fio_file *__get_next_file(struct thread_data *td)
                if (td->o.file_service_type == FIO_FSERVICE_SEQ)
                        goto out;
                if (td->file_service_left) {
-                 td->file_service_left--;
-                 goto out;
+                       td->file_service_left--;
+                       goto out;
                }
        }
 
@@ -2004,7 +2009,7 @@ static void io_completed(struct thread_data *td, struct io_u **io_u_ptr,
        dprint_io_u(io_u, "complete");
 
        assert(io_u->flags & IO_U_F_FLIGHT);
-       io_u_clear(td, io_u, IO_U_F_FLIGHT | IO_U_F_BUSY_OK);
+       io_u_clear(td, io_u, IO_U_F_FLIGHT | IO_U_F_BUSY_OK | IO_U_F_PATTERN_DONE);
 
        /*
         * Mark IO ok to verify
@@ -2022,6 +2027,8 @@ static void io_completed(struct thread_data *td, struct io_u **io_u_ptr,
        }
 
        if (ddir_sync(ddir)) {
+               if (io_u->error)
+                       goto error;
                td->last_was_sync = true;
                if (f) {
                        f->first_write = -1ULL;
@@ -2077,6 +2084,7 @@ static void io_completed(struct thread_data *td, struct io_u **io_u_ptr,
                                icd->error = ret;
                }
        } else if (io_u->error) {
+error:
                icd->error = io_u->error;
                io_u_log_error(td, io_u);
        }
@@ -2371,7 +2379,7 @@ int do_io_u_sync(const struct thread_data *td, struct io_u *io_u)
        return ret;
 }
 
-int do_io_u_trim(const struct thread_data *td, struct io_u *io_u)
+int do_io_u_trim(struct thread_data *td, struct io_u *io_u)
 {
 #ifndef FIO_HAVE_TRIM
        io_u->error = EINVAL;