summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2019-08-15 16:30:40 +0100
committerJens Axboe <axboe@kernel.dk>2019-08-15 10:42:01 -0600
commit4e8c82b4e9804c52bf2c78327cc5bfca9d8aedfc (patch)
treefe0514104a5f37ec9f24aea8ad56c4c07914a39d
parentcd8920a40ef04625d9e76f63fa09fcaac9e9977e (diff)
nbd: Update for libnbd 0.9.8HEADmaster
As the libnbd API isn't permanently stable until we reach the 1.0 release (expected soon), some code changes are needed to cope with API changes between 0.9.6 and 0.9.8. In this case we made changes to completion handlers after feedback from reviewers. This fix for fio incorporates all the changes needed and bumps the minimum version to libnbd >= 0.9.8. Signed-off-by: Richard W.M. Jones <rjones@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rwxr-xr-xconfigure2
-rw-r--r--engines/nbd.c33
2 files changed, 13 insertions, 22 deletions
diff --git a/configure b/configure
index b11b2dc..b174a6f 100755
--- a/configure
+++ b/configure
@@ -2020,7 +2020,7 @@ print_config "iscsi engine" "$libiscsi"
##########################################
# Check if we have libnbd (for NBD support).
-minimum_libnbd=0.9.6
+minimum_libnbd=0.9.8
if test "$libnbd" = "yes" ; then
if $(pkg-config --atleast-version=$minimum_libnbd libnbd); then
libnbd="yes"
diff --git a/engines/nbd.c b/engines/nbd.c
index f858381..5323792 100644
--- a/engines/nbd.c
+++ b/engines/nbd.c
@@ -152,15 +152,12 @@ static int nbd_init(struct thread_data *td)
}
/* A command in flight has been completed. */
-static int cmd_completed (unsigned valid_flag, void *vp, int *error)
+static int cmd_completed (void *vp, int *error)
{
struct io_u *io_u;
struct nbd_data *nbd_data;
struct io_u **completed;
- if (!(valid_flag & LIBNBD_CALLBACK_VALID))
- return 0;
-
io_u = vp;
nbd_data = io_u->engine_data;
@@ -195,6 +192,8 @@ static enum fio_q_status nbd_queue(struct thread_data *td,
struct io_u *io_u)
{
struct nbd_data *nbd_data = td->io_ops_data;
+ nbd_completion_callback completion = { .callback = cmd_completed,
+ .user_data = io_u };
int r;
fio_ro_check(td, io_u);
@@ -206,32 +205,24 @@ static enum fio_q_status nbd_queue(struct thread_data *td,
switch (io_u->ddir) {
case DDIR_READ:
- r = nbd_aio_pread_callback(nbd_data->nbd,
- io_u->xfer_buf, io_u->xfer_buflen,
- io_u->offset,
- cmd_completed, io_u,
- 0);
+ r = nbd_aio_pread(nbd_data->nbd,
+ io_u->xfer_buf, io_u->xfer_buflen,
+ io_u->offset, completion, 0);
break;
case DDIR_WRITE:
- r = nbd_aio_pwrite_callback(nbd_data->nbd,
- io_u->xfer_buf, io_u->xfer_buflen,
- io_u->offset,
- cmd_completed, io_u,
- 0);
+ r = nbd_aio_pwrite(nbd_data->nbd,
+ io_u->xfer_buf, io_u->xfer_buflen,
+ io_u->offset, completion, 0);
break;
case DDIR_TRIM:
- r = nbd_aio_trim_callback(nbd_data->nbd, io_u->xfer_buflen,
- io_u->offset,
- cmd_completed, io_u,
- 0);
+ r = nbd_aio_trim(nbd_data->nbd, io_u->xfer_buflen,
+ io_u->offset, completion, 0);
break;
case DDIR_SYNC:
/* XXX We could probably also handle
* DDIR_SYNC_FILE_RANGE with a bit of effort.
*/
- r = nbd_aio_flush_callback(nbd_data->nbd,
- cmd_completed, io_u,
- 0);
+ r = nbd_aio_flush(nbd_data->nbd, completion, 0);
break;
default:
io_u->error = EINVAL;