Drop EXTFLAG and lib references
[fio.git] / engines / e4defrag.c
index 5affaa0848f48139961daa5b5e76abfe31ab2fc5..6063e6c80c01dc36f82779297a28462e2ddff7a0 100644 (file)
@@ -141,16 +141,14 @@ static int fio_e4defrag_queue(struct thread_data *td, struct io_u *io_u)
         * in order to satisfy strict read only access pattern
         */
        if (io_u->ddir != DDIR_WRITE) {
-               io_u->error = errno;
+               io_u->error = EINVAL;
                return FIO_Q_COMPLETED;
        }
 
        if (o->inplace) {
                ret = fallocate(ed->donor_fd, 0, io_u->offset, io_u->xfer_buflen);
-               if (ret) {
-                       io_u->error = errno;
+               if (ret)
                        goto out;
-               }
        }
 
        memset(&me, 0, sizeof(me));
@@ -163,9 +161,6 @@ static int fio_e4defrag_queue(struct thread_data *td, struct io_u *io_u)
        ret = ioctl(f->fd, EXT4_IOC_MOVE_EXT, &me);
        len = me.moved_len * ed->bsz;
 
-       if (io_u->file && len >= 0 && ddir_rw(io_u->ddir))
-               io_u->file->file_pos = io_u->offset + len;
-
        if (len > io_u->xfer_buflen)
                len = io_u->xfer_buflen;
 
@@ -175,16 +170,12 @@ static int fio_e4defrag_queue(struct thread_data *td, struct io_u *io_u)
        }
        if (ret)
                io_u->error = errno;
-       
-       if (o->inplace) {
+
+       if (o->inplace)
                ret = ftruncate(ed->donor_fd, 0);
-               if (ret)
-                       io_u->error = errno;
-       }
 out:
-       if (io_u->error)
-               td_verror(td, errno, "xfer");
-
+       if (ret && !io_u->error)
+               io_u->error = errno;
 
        return FIO_Q_COMPLETED;
 }