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: Roman Sudarikov <roman.sudarikov@intel.com> Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-on: https://review.gerrithub.io/391042 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
abe4c73f40
commit
c3bc40a6ef
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -196,14 +196,14 @@ bdev_nvme_writev(struct nvme_bdev *nbdev, struct spdk_io_channel *ch,
|
||||
iov, iovcnt, lba_count, lba);
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
bdev_nvme_poll(void *arg)
|
||||
{
|
||||
struct nvme_io_channel *ch = arg;
|
||||
int32_t num_completions;
|
||||
|
||||
if (ch->qpair == NULL) {
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ch->collect_spin_stat && ch->start_ticks == 0) {
|
||||
@ -223,14 +223,16 @@ bdev_nvme_poll(void *arg)
|
||||
ch->end_ticks = spdk_get_ticks();
|
||||
}
|
||||
}
|
||||
|
||||
return num_completions;
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
bdev_nvme_poll_adminq(void *arg)
|
||||
{
|
||||
struct spdk_nvme_ctrlr *ctrlr = arg;
|
||||
|
||||
spdk_nvme_ctrlr_process_admin_completions(ctrlr);
|
||||
return spdk_nvme_ctrlr_process_admin_completions(ctrlr);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -880,12 +882,14 @@ remove_cb(void *cb_ctx, struct spdk_nvme_ctrlr *ctrlr)
|
||||
pthread_mutex_unlock(&g_bdev_nvme_mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
bdev_nvme_hotplug(void *arg)
|
||||
{
|
||||
if (spdk_nvme_probe(NULL, NULL, hotplug_probe_cb, attach_cb, remove_cb) != 0) {
|
||||
SPDK_ERRLOG("spdk_nvme_probe() failed\n");
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -274,7 +274,7 @@ bdev_rbd_flush(struct bdev_rbd *disk, struct spdk_io_channel *ch,
|
||||
return bdev_rbd_start_aio(rbdio_ch->image, bdev_io, NULL, offset, nbytes);
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
bdev_rbd_reset_timer(void *arg)
|
||||
{
|
||||
struct bdev_rbd *disk = arg;
|
||||
@ -286,6 +286,8 @@ bdev_rbd_reset_timer(void *arg)
|
||||
spdk_bdev_io_complete(disk->reset_bdev_io, SPDK_BDEV_IO_STATUS_SUCCESS);
|
||||
spdk_poller_unregister(&disk->reset_timer);
|
||||
disk->reset_bdev_io = NULL;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int
|
||||
@ -384,7 +386,7 @@ bdev_rbd_io_type_supported(void *ctx, enum spdk_bdev_io_type io_type)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
bdev_rbd_io_poll(void *arg)
|
||||
{
|
||||
struct bdev_rbd_io_channel *ch = arg;
|
||||
@ -397,7 +399,7 @@ bdev_rbd_io_poll(void *arg)
|
||||
|
||||
/* check the return value of poll since we have only one fd for each channel */
|
||||
if (rc != 1) {
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
rc = rbd_poll_io_events(ch->image, comps, SPDK_RBD_QUEUE_DEPTH);
|
||||
@ -432,6 +434,8 @@ bdev_rbd_io_poll(void *arg)
|
||||
rbd_io->failed ? SPDK_BDEV_IO_STATUS_FAILED : SPDK_BDEV_IO_STATUS_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -254,7 +254,7 @@ bdev_virtio_io_cpl(struct spdk_bdev_io *bdev_io)
|
||||
SPDK_BDEV_IO_STATUS_SUCCESS : SPDK_BDEV_IO_STATUS_FAILED);
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
bdev_virtio_poll(void *arg)
|
||||
{
|
||||
struct bdev_virtio_blk_io_channel *ch = arg;
|
||||
@ -266,6 +266,8 @@ bdev_virtio_poll(void *arg)
|
||||
for (i = 0; i < cnt; ++i) {
|
||||
bdev_virtio_io_cpl(io[i]);
|
||||
}
|
||||
|
||||
return cnt;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -193,7 +193,7 @@ static void virtio_scsi_dev_remove(struct virtio_scsi_dev *svdev,
|
||||
static int bdev_virtio_scsi_ch_create_cb(void *io_device, void *ctx_buf);
|
||||
static void bdev_virtio_scsi_ch_destroy_cb(void *io_device, void *ctx_buf);
|
||||
static void process_scan_resp(struct virtio_scsi_scan_base *base);
|
||||
static void bdev_virtio_mgmt_poll(void *arg);
|
||||
static int bdev_virtio_mgmt_poll(void *arg);
|
||||
|
||||
static int
|
||||
virtio_scsi_dev_send_eventq_io(struct virtqueue *vq, struct virtio_scsi_eventq_io *io)
|
||||
@ -724,7 +724,7 @@ bdev_virtio_io_cpl(struct spdk_bdev_io *bdev_io)
|
||||
spdk_bdev_io_complete_scsi_status(bdev_io, io_ctx->resp.status, sk, asc, ascq);
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
bdev_virtio_poll(void *arg)
|
||||
{
|
||||
struct bdev_virtio_io_channel *ch = arg;
|
||||
@ -740,7 +740,7 @@ bdev_virtio_poll(void *arg)
|
||||
if (spdk_unlikely(scan_ctx && io[i] == &scan_ctx->io_ctx)) {
|
||||
if (svdev->removed) {
|
||||
_virtio_scsi_dev_scan_finish(scan_ctx, -EINTR);
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (scan_ctx->restart) {
|
||||
@ -760,9 +760,9 @@ bdev_virtio_poll(void *arg)
|
||||
if (spdk_unlikely(scan_ctx && scan_ctx->needs_resend)) {
|
||||
if (svdev->removed) {
|
||||
_virtio_scsi_dev_scan_finish(scan_ctx, -EINTR);
|
||||
return;
|
||||
return -1;
|
||||
} else if (cnt == 0) {
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
rc = send_scan_io(scan_ctx);
|
||||
@ -775,6 +775,8 @@ bdev_virtio_poll(void *arg)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return cnt;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -886,7 +888,7 @@ bdev_virtio_send_tmf_io(struct virtqueue *ctrlq, struct spdk_bdev_io *bdev_io)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
bdev_virtio_mgmt_poll(void *arg)
|
||||
{
|
||||
struct virtio_scsi_dev *svdev = arg;
|
||||
@ -898,8 +900,10 @@ bdev_virtio_mgmt_poll(void *arg)
|
||||
uint32_t io_len[16];
|
||||
uint16_t i, cnt;
|
||||
int rc;
|
||||
int total = 0;
|
||||
|
||||
cnt = spdk_ring_dequeue(send_ring, io, SPDK_COUNTOF(io));
|
||||
total += cnt;
|
||||
for (i = 0; i < cnt; ++i) {
|
||||
rc = bdev_virtio_send_tmf_io(ctrlq, io[i]);
|
||||
if (rc != 0) {
|
||||
@ -908,14 +912,18 @@ bdev_virtio_mgmt_poll(void *arg)
|
||||
}
|
||||
|
||||
cnt = virtio_recv_pkts(ctrlq, io, io_len, SPDK_COUNTOF(io));
|
||||
total += cnt;
|
||||
for (i = 0; i < cnt; ++i) {
|
||||
bdev_virtio_tmf_cpl(io[i]);
|
||||
}
|
||||
|
||||
cnt = virtio_recv_pkts(eventq, io, io_len, SPDK_COUNTOF(io));
|
||||
total += cnt;
|
||||
for (i = 0; i < cnt; ++i) {
|
||||
bdev_virtio_eventq_io_cpl(svdev, io[i]);
|
||||
}
|
||||
|
||||
return total;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -174,12 +174,14 @@ ioat_copy_submit_fill(void *cb_arg, struct spdk_io_channel *ch, void *dst, uint8
|
||||
return spdk_ioat_submit_fill(ioat_ch->ioat_ch, ioat_task, ioat_done, dst, fill64, nbytes);
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
ioat_poll(void *arg)
|
||||
{
|
||||
struct spdk_ioat_chan *chan = arg;
|
||||
|
||||
spdk_ioat_process_events(chan);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static struct spdk_io_channel *ioat_get_io_channel(void);
|
||||
|
@ -316,14 +316,14 @@ _spdk_reactor_stop_poller(struct spdk_poller *poller, void *thread_ctx)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
get_rusage(void *arg)
|
||||
{
|
||||
struct spdk_reactor *reactor = arg;
|
||||
struct rusage rusage;
|
||||
|
||||
if (getrusage(RUSAGE_THREAD, &rusage) != 0) {
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (rusage.ru_nvcsw != reactor->rusage.ru_nvcsw || rusage.ru_nivcsw != reactor->rusage.ru_nivcsw) {
|
||||
@ -333,6 +333,8 @@ get_rusage(void *arg)
|
||||
rusage.ru_nivcsw - reactor->rusage.ru_nivcsw);
|
||||
}
|
||||
reactor->rusage = rusage;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -45,10 +45,11 @@
|
||||
|
||||
static struct spdk_poller *g_rpc_poller = NULL;
|
||||
|
||||
static void
|
||||
static int
|
||||
spdk_rpc_subsystem_poll(void *arg)
|
||||
{
|
||||
spdk_rpc_accept();
|
||||
return -1;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -133,12 +133,14 @@ new_qpair(struct spdk_nvmf_qpair *qpair)
|
||||
spdk_event_call(event);
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
acceptor_poll(void *arg)
|
||||
{
|
||||
struct spdk_nvmf_tgt *tgt = arg;
|
||||
|
||||
spdk_nvmf_tgt_accept(tgt, new_qpair);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -45,15 +45,16 @@
|
||||
|
||||
#define ACCEPT_TIMEOUT_US 1000 /* 1ms */
|
||||
|
||||
static void
|
||||
static int
|
||||
spdk_iscsi_portal_accept(void *arg)
|
||||
{
|
||||
struct spdk_iscsi_portal *portal = arg;
|
||||
struct spdk_sock *sock;
|
||||
int rc;
|
||||
int count = 0;
|
||||
|
||||
if (portal->sock == NULL) {
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
@ -65,6 +66,7 @@ spdk_iscsi_portal_accept(void *arg)
|
||||
SPDK_ERRLOG("spdk_iscsi_connection_construct() failed\n");
|
||||
break;
|
||||
}
|
||||
count++;
|
||||
} else {
|
||||
if (errno != EAGAIN && errno != EWOULDBLOCK) {
|
||||
SPDK_ERRLOG("accept error(%d): %s\n", errno, spdk_strerror(errno));
|
||||
@ -72,6 +74,8 @@ spdk_iscsi_portal_accept(void *arg)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -493,7 +493,7 @@ _spdk_iscsi_conn_free(struct spdk_iscsi_conn *conn)
|
||||
pthread_mutex_unlock(&g_conns_mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
_spdk_iscsi_conn_check_shutdown(void *arg)
|
||||
{
|
||||
struct spdk_iscsi_conn *conn = arg;
|
||||
@ -501,13 +501,15 @@ _spdk_iscsi_conn_check_shutdown(void *arg)
|
||||
|
||||
rc = spdk_iscsi_conn_free_tasks(conn);
|
||||
if (rc < 0) {
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
spdk_poller_unregister(&conn->shutdown_timer);
|
||||
|
||||
spdk_iscsi_conn_stop(conn);
|
||||
_spdk_iscsi_conn_free(conn);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void
|
||||
@ -576,7 +578,7 @@ spdk_iscsi_conn_check_shutdown_cb(void *arg1, void *arg2)
|
||||
spdk_shutdown_iscsi_conns_done();
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
spdk_iscsi_conn_check_shutdown(void *arg)
|
||||
{
|
||||
struct spdk_event *event;
|
||||
@ -587,6 +589,8 @@ spdk_iscsi_conn_check_shutdown(void *arg)
|
||||
NULL);
|
||||
spdk_event_call(event);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1064,7 +1068,7 @@ spdk_iscsi_conn_flush_pdus_internal(struct spdk_iscsi_conn *conn)
|
||||
* Returns -1 for an exceptional error indicating the TCP connection
|
||||
* should be closed.
|
||||
*/
|
||||
static void
|
||||
static int
|
||||
spdk_iscsi_conn_flush_pdus(void *_conn)
|
||||
{
|
||||
struct spdk_iscsi_conn *conn = _conn;
|
||||
@ -1097,6 +1101,8 @@ spdk_iscsi_conn_flush_pdus(void *_conn)
|
||||
*/
|
||||
conn->state = ISCSI_CONN_STATE_EXITING;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void
|
||||
@ -1265,12 +1271,14 @@ spdk_iscsi_conn_allocate_reactor(const struct spdk_cpuset *cpumask)
|
||||
return selected_core;
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
logout_timeout(void *arg)
|
||||
{
|
||||
struct spdk_iscsi_conn *conn = arg;
|
||||
|
||||
spdk_iscsi_conn_destruct(conn);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -855,7 +855,7 @@ spdk_iscsi_init_complete(int rc)
|
||||
cb_fn(cb_arg, rc);
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
spdk_iscsi_poll_group_poll(void *ctx)
|
||||
{
|
||||
struct spdk_iscsi_poll_group *group = ctx;
|
||||
@ -874,9 +874,11 @@ spdk_iscsi_poll_group_poll(void *ctx)
|
||||
spdk_iscsi_conn_destruct(conn);
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
spdk_iscsi_poll_group_handle_nop(void *ctx)
|
||||
{
|
||||
struct spdk_iscsi_poll_group *group = ctx;
|
||||
@ -885,6 +887,8 @@ spdk_iscsi_poll_group_handle_nop(void *ctx)
|
||||
STAILQ_FOREACH_SAFE(conn, &group->connections, link, tmp) {
|
||||
spdk_iscsi_conn_handle_nop(conn);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -726,7 +726,7 @@ _spdk_nbd_poll(struct spdk_nbd_disk *nbd)
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
spdk_nbd_poll(void *arg)
|
||||
{
|
||||
struct spdk_nbd_disk *nbd = arg;
|
||||
@ -738,6 +738,8 @@ spdk_nbd_poll(void *arg)
|
||||
spdk_strerror(-rc), rc);
|
||||
spdk_nbd_stop(nbd);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void *
|
||||
|
@ -62,19 +62,23 @@ spdk_nvmf_tgt_opts_init(struct spdk_nvmf_tgt_opts *opts)
|
||||
opts->max_io_size = SPDK_NVMF_DEFAULT_MAX_IO_SIZE;
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
spdk_nvmf_poll_group_poll(void *ctx)
|
||||
{
|
||||
struct spdk_nvmf_poll_group *group = ctx;
|
||||
int rc;
|
||||
int count = 0;
|
||||
struct spdk_nvmf_transport_poll_group *tgroup;
|
||||
|
||||
TAILQ_FOREACH(tgroup, &group->tgroups, link) {
|
||||
rc = spdk_nvmf_transport_poll_group_poll(tgroup);
|
||||
if (rc < 0) {
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
count += rc;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -181,7 +181,7 @@ spdk_scsi_lun_execute_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *tas
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
spdk_scsi_lun_hotplug(void *arg)
|
||||
{
|
||||
struct spdk_scsi_lun *lun = (struct spdk_scsi_lun *)arg;
|
||||
@ -195,6 +195,8 @@ spdk_scsi_lun_hotplug(void *arg)
|
||||
spdk_scsi_dev_delete_lun(lun->dev, lun);
|
||||
free(lun);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -327,7 +327,7 @@ process_vq(struct spdk_vhost_blk_dev *bvdev, struct spdk_vhost_virtqueue *vq)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
vdev_worker(void *arg)
|
||||
{
|
||||
struct spdk_vhost_blk_dev *bvdev = arg;
|
||||
@ -338,6 +338,8 @@ vdev_worker(void *arg)
|
||||
}
|
||||
|
||||
spdk_vhost_dev_used_signal(&bvdev->vdev);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -360,7 +362,7 @@ no_bdev_process_vq(struct spdk_vhost_blk_dev *bvdev, struct spdk_vhost_virtqueue
|
||||
spdk_vhost_vq_used_ring_enqueue(&bvdev->vdev, vq, req_idx, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
no_bdev_vdev_worker(void *arg)
|
||||
{
|
||||
struct spdk_vhost_blk_dev *bvdev = arg;
|
||||
@ -371,6 +373,8 @@ no_bdev_vdev_worker(void *arg)
|
||||
}
|
||||
|
||||
spdk_vhost_dev_used_signal(&bvdev->vdev);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static struct spdk_vhost_blk_dev *
|
||||
@ -528,7 +532,7 @@ struct spdk_vhost_dev_destroy_ctx {
|
||||
void *event_ctx;
|
||||
};
|
||||
|
||||
static void
|
||||
static int
|
||||
destroy_device_poller_cb(void *arg)
|
||||
{
|
||||
struct spdk_vhost_dev_destroy_ctx *ctx = arg;
|
||||
@ -536,7 +540,7 @@ destroy_device_poller_cb(void *arg)
|
||||
int i;
|
||||
|
||||
if (bvdev->vdev.task_cnt > 0) {
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i = 0; i < bvdev->vdev.num_queues; i++) {
|
||||
@ -557,6 +561,8 @@ destroy_device_poller_cb(void *arg)
|
||||
spdk_poller_unregister(&ctx->poller);
|
||||
spdk_vhost_dev_backend_event_done(ctx->event_ctx, 0);
|
||||
spdk_dma_free(ctx);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -645,7 +645,7 @@ process_requestq(struct spdk_vhost_scsi_dev *svdev, struct spdk_vhost_virtqueue
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
vdev_mgmt_worker(void *arg)
|
||||
{
|
||||
struct spdk_vhost_scsi_dev *svdev = arg;
|
||||
@ -655,9 +655,11 @@ vdev_mgmt_worker(void *arg)
|
||||
|
||||
process_controlq(svdev, &svdev->vdev.virtqueue[VIRTIO_SCSI_CONTROLQ]);
|
||||
spdk_vhost_vq_used_signal(&svdev->vdev, &svdev->vdev.virtqueue[VIRTIO_SCSI_CONTROLQ]);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
vdev_worker(void *arg)
|
||||
{
|
||||
struct spdk_vhost_scsi_dev *svdev = arg;
|
||||
@ -668,6 +670,8 @@ vdev_worker(void *arg)
|
||||
}
|
||||
|
||||
spdk_vhost_dev_used_signal(&svdev->vdev);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static struct spdk_vhost_scsi_dev *
|
||||
@ -1094,7 +1098,7 @@ struct spdk_vhost_dev_destroy_ctx {
|
||||
void *event_ctx;
|
||||
};
|
||||
|
||||
static void
|
||||
static int
|
||||
destroy_device_poller_cb(void *arg)
|
||||
{
|
||||
struct spdk_vhost_dev_destroy_ctx *ctx = arg;
|
||||
@ -1102,7 +1106,7 @@ destroy_device_poller_cb(void *arg)
|
||||
uint32_t i;
|
||||
|
||||
if (svdev->vdev.task_cnt > 0) {
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@ -1125,6 +1129,8 @@ destroy_device_poller_cb(void *arg)
|
||||
spdk_poller_unregister(&ctx->poller);
|
||||
spdk_vhost_dev_backend_event_done(ctx->event_ctx, 0);
|
||||
spdk_dma_free(ctx);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -468,7 +468,7 @@ bdevperf_submit_io(struct io_target *target, int queue_depth)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
end_target(void *arg)
|
||||
{
|
||||
struct io_target *target = arg;
|
||||
@ -479,9 +479,11 @@ end_target(void *arg)
|
||||
}
|
||||
|
||||
target->is_draining = true;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void reset_target(void *arg);
|
||||
static int reset_target(void *arg);
|
||||
|
||||
static void
|
||||
reset_cb(struct spdk_bdev_io *bdev_io, bool success, void *cb_arg)
|
||||
@ -502,7 +504,7 @@ reset_cb(struct spdk_bdev_io *bdev_io, bool success, void *cb_arg)
|
||||
10 * 1000000);
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
reset_target(void *arg)
|
||||
{
|
||||
struct io_target *target = arg;
|
||||
@ -526,6 +528,8 @@ reset_target(void *arg)
|
||||
target->is_draining = true;
|
||||
g_run_failed = true;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -647,12 +651,13 @@ performance_dump(uint64_t io_time_in_usec, uint64_t ema_period)
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
performance_statistics_thread(void *arg)
|
||||
{
|
||||
g_show_performance_period_num++;
|
||||
performance_dump(g_show_performance_period_num * g_show_performance_period_in_usec,
|
||||
g_show_performance_ema_period);
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -44,7 +44,7 @@ static struct spdk_poller *poller_500ms;
|
||||
static struct spdk_poller *poller_oneshot;
|
||||
static struct spdk_poller *poller_unregister;
|
||||
|
||||
static void
|
||||
static int
|
||||
test_end(void *arg)
|
||||
{
|
||||
printf("test_end\n");
|
||||
@ -55,26 +55,32 @@ test_end(void *arg)
|
||||
spdk_poller_unregister(&poller_500ms);
|
||||
|
||||
spdk_app_stop(0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
tick(void *arg)
|
||||
{
|
||||
uintptr_t period = (uintptr_t)arg;
|
||||
|
||||
printf("tick %" PRIu64 "\n", (uint64_t)period);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
oneshot(void *arg)
|
||||
{
|
||||
printf("oneshot\n");
|
||||
spdk_poller_unregister(&poller_oneshot);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
nop(void *arg)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -42,11 +42,12 @@ static int g_queue_depth;
|
||||
static struct spdk_poller *test_end_poller;
|
||||
static uint64_t g_call_count = 0;
|
||||
|
||||
static void
|
||||
static int
|
||||
__test_end(void *arg)
|
||||
{
|
||||
printf("test_end\n");
|
||||
spdk_app_stop(0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -288,20 +288,24 @@ basic(void)
|
||||
teardown_test();
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
poller_run_done(void *ctx)
|
||||
{
|
||||
bool *poller_run = ctx;
|
||||
|
||||
*poller_run = true;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
poller_run_times_done(void *ctx)
|
||||
{
|
||||
int *poller_run_times = ctx;
|
||||
|
||||
(*poller_run_times)++;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user