- if (io_u->ddir == DDIR_READ)
- iocb->opcode = IORING_OP_READ;
- else
- iocb->opcode = IORING_OP_WRITE;
- iocb->off = io_u->offset;
- iocb->addr = io_u->xfer_buf;
- iocb->len = io_u->xfer_buflen;
- } else if (ddir_sync(io_u->ddir))
- iocb->opcode = IORING_OP_FSYNC;
+ if (o->fixedbufs) {
+ sqe->opcode = fixed_ddir_to_op[io_u->ddir];
+ sqe->addr = (unsigned long) io_u->xfer_buf;
+ sqe->len = io_u->xfer_buflen;
+ sqe->buf_index = io_u->index;
+ } else {
+ struct iovec *iov = &ld->iovecs[io_u->index];
+
+ /*
+ * Update based on actual io_u, requeue could have
+ * adjusted these
+ */
+ iov->iov_base = io_u->xfer_buf;
+ iov->iov_len = io_u->xfer_buflen;
+
+ sqe->opcode = ddir_to_op[io_u->ddir][!!o->nonvectored];
+ if (o->nonvectored) {
+ sqe->addr = (unsigned long) iov->iov_base;
+ sqe->len = iov->iov_len;
+ } else {
+ sqe->addr = (unsigned long) iov;
+ sqe->len = 1;
+ }
+ }
+ if (!td->o.odirect && o->uncached)
+ sqe->rw_flags = RWF_UNCACHED;
+ if (o->nowait)
+ sqe->rw_flags |= RWF_NOWAIT;
+ if (ld->ioprio_class_set)
+ sqe->ioprio = td->o.ioprio_class << 13;
+ if (ld->ioprio_set)
+ sqe->ioprio |= td->o.ioprio;
+ sqe->off = io_u->offset;
+ sqe->rw_flags = 0;
+ } else if (ddir_sync(io_u->ddir)) {
+ sqe->ioprio = 0;
+ if (io_u->ddir == DDIR_SYNC_FILE_RANGE) {
+ sqe->off = f->first_write;
+ sqe->len = f->last_write - f->first_write;
+ sqe->sync_range_flags = td->o.sync_file_range;
+ sqe->opcode = IORING_OP_SYNC_FILE_RANGE;
+ } else {
+ sqe->off = 0;
+ sqe->addr = 0;
+ sqe->len = 0;
+ if (io_u->ddir == DDIR_DATASYNC)
+ sqe->fsync_flags |= IORING_FSYNC_DATASYNC;
+ sqe->opcode = IORING_OP_FSYNC;
+ }
+ }