X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=engines%2Fe4defrag.c;h=e53636eb26e382b3e318abef48bd3b211d2695f1;hb=33477b4b5f61c2ba57bc3346b8968d9be8b56fc4;hp=6063e6c80c01dc36f82779297a28462e2ddff7a0;hpb=ef5f5a3a63f8b7c472f30484c520265aba6ef162;p=fio.git diff --git a/engines/e4defrag.c b/engines/e4defrag.c index 6063e6c8..e53636eb 100644 --- a/engines/e4defrag.c +++ b/engines/e4defrag.c @@ -17,6 +17,7 @@ #include #include "../fio.h" +#include "../optgroup.h" #ifndef EXT4_IOC_MOVE_EXT #define EXT4_IOC_MOVE_EXT _IOWR('f', 15, struct move_extent) @@ -36,7 +37,7 @@ struct e4defrag_data { }; struct e4defrag_options { - struct thread_data *td; + void *pad; unsigned int inplace; char * donor_name; }; @@ -44,17 +45,23 @@ struct e4defrag_options { static struct fio_option options[] = { { .name = "donorname", + .lname = "Donor Name", .type = FIO_OPT_STR_STORE, .off1 = offsetof(struct e4defrag_options, donor_name), .help = "File used as a block donor", + .category = FIO_OPT_C_ENGINE, + .group = FIO_OPT_G_E4DEFRAG, }, { .name = "inplace", + .lname = "In Place", .type = FIO_OPT_INT, .off1 = offsetof(struct e4defrag_options, inplace), .minval = 0, .maxval = 1, .help = "Alloc and free space inside defrag event", + .category = FIO_OPT_C_ENGINE, + .group = FIO_OPT_G_E4DEFRAG, }, { .name = NULL, @@ -76,7 +83,7 @@ static int fio_e4defrag_init(struct thread_data *td) ed = malloc(sizeof(*ed)); if (!ed) { - td_verror(td, -ENOMEM, "io_queue_init"); + td_verror(td, ENOMEM, "io_queue_init"); return 1; } memset(ed, 0 ,sizeof(*ed)); @@ -87,15 +94,15 @@ 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, ed->donor_fd, "io_queue_init"); - log_err("Can't open donor file %s err:%d", ed->donor_fd); + td_verror(td, errno, "io_queue_init"); + log_err("Can't open donor file %s err:%d", donor_name, ed->donor_fd); free(ed); return 1; } if (!o->inplace) { - long long len = td->o.file_size_high - td->o.start_offset; - r = fallocate(ed->donor_fd, 0, td->o.start_offset, len); + long long __len = td->o.file_size_high - td->o.start_offset; + r = fallocate(ed->donor_fd, 0, td->o.start_offset, __len); if (r) goto err; } @@ -104,7 +111,7 @@ static int fio_e4defrag_init(struct thread_data *td) goto err; ed->bsz = stub.st_blksize; - td->io_ops->data = ed; + td->io_ops_data = ed; return 0; err: td_verror(td, errno, "io_queue_init"); @@ -115,7 +122,7 @@ err: static void fio_e4defrag_cleanup(struct thread_data *td) { - struct e4defrag_data *ed = td->io_ops->data; + struct e4defrag_data *ed = td->io_ops_data; if (ed) { if (ed->donor_fd >= 0) close(ed->donor_fd); @@ -131,7 +138,7 @@ static int fio_e4defrag_queue(struct thread_data *td, struct io_u *io_u) unsigned long long len; struct move_extent me; struct fio_file *f = io_u->file; - struct e4defrag_data *ed = td->io_ops->data; + struct e4defrag_data *ed = td->io_ops_data; struct e4defrag_options *o = td->eo; fio_ro_check(td, io_u);