engine: fix error handling for e4defrag/falloc
At the time I've wrote this code i don't quite understand difference
between td->error and io_u->error. It is appeared that engine should
not have to explicitly assign td->error. Just initialize io_u->error and
backed will do proper handling.
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/engines/e4defrag.c b/engines/e4defrag.c
index 5affaa0..cc88493 100644
--- a/engines/e4defrag.c
+++ b/engines/e4defrag.c
@@ -141,16 +141,14 @@
* 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));
@@ -175,16 +173,12 @@
}
if (ret)
io_u->error = errno;
-
- 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 (o->inplace)
+ ret = ftruncate(ed->donor_fd, 0);
+out:
+ if (ret && !io_u->error)
+ io_u->error = errno;
return FIO_Q_COMPLETED;
}