X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=engines%2Fe4defrag.c;h=8f71d02caa947867339d980e0f2722c9a5751b8d;hb=ce4d13ca162df4127ec3b5911553802c53396705;hp=01b084e9699907b97abc7dbb33295e17dacf58c3;hpb=dda13f44d6d97a2c0865f6fbfed70c45071592b3;p=fio.git diff --git a/engines/e4defrag.c b/engines/e4defrag.c index 01b084e9..8f71d02c 100644 --- a/engines/e4defrag.c +++ b/engines/e4defrag.c @@ -9,11 +9,7 @@ #include #include #include -#include -#include -#include #include -#include #include #include "../fio.h" @@ -54,7 +50,7 @@ static struct fio_option options[] = { }, { .name = "inplace", - .name = "In Place", + .lname = "In Place", .type = FIO_OPT_INT, .off1 = offsetof(struct e4defrag_options, inplace), .minval = 0, @@ -95,7 +91,7 @@ static int fio_e4defrag_init(struct thread_data *td) ed->donor_fd = open(donor_name, O_CREAT|O_WRONLY, 0644); if (ed->donor_fd < 0) { td_verror(td, errno, "io_queue_init"); - log_err("Can't open donor file %s err:%d", donor_name, ed->donor_fd); + log_err("Can't open donor file %s err:%d\n", donor_name, ed->donor_fd); free(ed); return 1; } @@ -131,7 +127,8 @@ static void fio_e4defrag_cleanup(struct thread_data *td) } -static int fio_e4defrag_queue(struct thread_data *td, struct io_u *io_u) +static enum fio_q_status fio_e4defrag_queue(struct thread_data *td, + struct io_u *io_u) { int ret; @@ -172,8 +169,13 @@ static int fio_e4defrag_queue(struct thread_data *td, struct io_u *io_u) len = io_u->xfer_buflen; if (len != io_u->xfer_buflen) { - io_u->resid = io_u->xfer_buflen - len; - io_u->error = 0; + if (len) { + io_u->resid = io_u->xfer_buflen - len; + io_u->error = 0; + } else { + /* access beyond i_size */ + io_u->error = EINVAL; + } } if (ret) io_u->error = errno;