Commit c3bc40a6 authored by Roman Sudarikov's avatar Roman Sudarikov Committed by Jim Harris
Browse files

io_channel: add return value to pollers



This will be used to track time used in pollers - each poller can now
indicate if it found any work to do or not.

For cases where it was obvious and the infrastructure was already in
place, existing pollers have been modified to return 0 or a positive
value to indicate whether work was done.  Other pollers have been
modified to return -1 by default, indicating that the poller isn't
indicating anything about whether work was performed.  This will allow
us to find un-annotated pollers easily in the future and fix them
incrementally.

Change-Id: Ifebfa56604a38434fac5c76ba7263267574ff199
Signed-off-by: default avatarRoman Sudarikov <roman.sudarikov@intel.com>
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/391042


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent abe4c73f
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -47,6 +47,12 @@ option, but instead returns SPDK_APP_PARSE_ARGS_HELP and
SPDK_APP_PARSE_ARGS_FAIL, respectively, and SPDK_APP_PARSE_ARGS_SUCCESS
on success.

### I/O Channels

The prototype for spdk_poller_fn() has been modified; it now returns a value indicating
whether or not the poller did any work.  Existing pollers will need to be updated to
return a value.

## v18.01: Blobstore Thin Provisioning

### Build System
+9 −1
Original line number Diff line number Diff line
@@ -54,7 +54,15 @@ typedef void (*spdk_thread_fn)(void *ctx);
typedef void (*spdk_thread_pass_msg)(spdk_thread_fn fn, void *ctx,
				     void *thread_ctx);

typedef void (*spdk_poller_fn)(void *ctx);
/**
 * Callback function for a poller.
 *
 * \param ctx Context passed as arg to spdk_poller_register()
 * \return 0 to indicate that polling took place but no events were found;
 *         positive to indicate that polling took place and some events were processed;
 *         negative if the poller does not provide spin-wait information.
 */
typedef int (*spdk_poller_fn)(void *ctx);
typedef struct spdk_poller *(*spdk_start_poller)(void *thread_ctx,
		spdk_poller_fn fn,
		void *arg,
+8 −5
Original line number Diff line number Diff line
@@ -209,7 +209,7 @@ bdev_aio_initialize_io_channel(struct bdev_aio_io_channel *ch)
	return 0;
}

static void
static int
bdev_aio_poll(void *arg)
{
	struct bdev_aio_io_channel *ch = arg;
@@ -227,7 +227,7 @@ bdev_aio_poll(void *arg)

	if (nr < 0) {
		SPDK_ERRLOG("%s: io_getevents returned %d\n", __func__, nr);
		return;
		return -1;
	}

	for (i = 0; i < nr; i++) {
@@ -241,6 +241,8 @@ bdev_aio_poll(void *arg)
		spdk_bdev_io_complete(spdk_bdev_io_from_ctx(aio_task), status);
		ch->io_inflight--;
	}

	return nr;
}

static void
@@ -257,8 +259,7 @@ _bdev_aio_get_io_inflight(struct spdk_io_channel_iter *i)
	spdk_for_each_channel_continue(i, 0);
}

static void
bdev_aio_reset_retry_timer(void *arg);
static int bdev_aio_reset_retry_timer(void *arg);

static void
_bdev_aio_get_io_inflight_done(struct spdk_io_channel_iter *i, int status)
@@ -273,7 +274,7 @@ _bdev_aio_get_io_inflight_done(struct spdk_io_channel_iter *i, int status)
	spdk_bdev_io_complete(spdk_bdev_io_from_ctx(fdisk->reset_task), SPDK_BDEV_IO_STATUS_SUCCESS);
}

static void
static int
bdev_aio_reset_retry_timer(void *arg)
{
	struct file_disk *fdisk = arg;
@@ -286,6 +287,8 @@ bdev_aio_reset_retry_timer(void *arg)
			      _bdev_aio_get_io_inflight,
			      fdisk,
			      _bdev_aio_get_io_inflight_done);

	return -1;
}

static void
+3 −1
Original line number Diff line number Diff line
@@ -955,7 +955,7 @@ spdk_bdev_qos_get_max_ios_per_timeslice(struct spdk_bdev *bdev)
			SPDK_BDEV_QOS_MIN_IO_PER_TIMESLICE);
}

static void
static int
spdk_bdev_channel_poll_qos(void *arg)
{
	struct spdk_bdev_channel	*ch = arg;
@@ -966,6 +966,8 @@ spdk_bdev_channel_poll_qos(void *arg)
	spdk_bdev_qos_get_max_ios_per_timeslice(bdev);

	_spdk_bdev_qos_io_submit(ch);

	return -1;
}

static void
+7 −1
Original line number Diff line number Diff line
@@ -192,7 +192,7 @@ create_null_bdev(const char *name, const struct spdk_uuid *uuid,
	return &bdev->bdev;
}

static void
static int
null_io_poll(void *arg)
{
	struct null_io_channel		*ch = arg;
@@ -202,11 +202,17 @@ null_io_poll(void *arg)
	TAILQ_INIT(&io);
	TAILQ_SWAP(&ch->io, &io, spdk_bdev_io, module_link);

	if (TAILQ_EMPTY(&io)) {
		return 0;
	}

	while (!TAILQ_EMPTY(&io)) {
		bdev_io = TAILQ_FIRST(&io);
		TAILQ_REMOVE(&io, bdev_io, module_link);
		spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_SUCCESS);
	}

	return 1;
}

static int
Loading