bdev_nvme: start accel_comp_poll poller lazily
With bdev_nvme accel_comp_poll is always created, even if it is not really used e.g bdev_nvme with vfio-user transport. accel_comp_poll poller is registered when accel_channel is created, in order to start it lazily this patch creates accel_channel during first usage. Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com> Change-Id: I5c710a038606ada00c9bfde6a4d9691ee8f6d204 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16957 Community-CI: Mellanox Build Bot Reviewed-by: Jim Harris <james.r.harris@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
This commit is contained in:
parent
dc32e1ba56
commit
d1b2a5c436
@ -2678,9 +2678,18 @@ bdev_nvme_submit_accel_crc32c(void *ctx, uint32_t *dst, struct iovec *iov,
|
||||
struct nvme_poll_group *group = ctx;
|
||||
int rc;
|
||||
|
||||
assert(group->accel_channel != NULL);
|
||||
assert(cb_fn != NULL);
|
||||
|
||||
if (spdk_unlikely(!group->accel_channel)) {
|
||||
group->accel_channel = spdk_accel_get_io_channel();
|
||||
if (!group->accel_channel) {
|
||||
cb_fn(cb_arg, -ENOMEM);
|
||||
SPDK_ERRLOG("Cannot get the accel_channel for bdev nvme polling group=%p\n",
|
||||
group);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
rc = spdk_accel_submit_crc32cv(group->accel_channel, dst, iov, iov_cnt, seed, cb_fn, cb_arg);
|
||||
if (rc) {
|
||||
/* For the two cases, spdk_accel_submit_crc32cv does not call the user's cb_fn */
|
||||
@ -2708,18 +2717,9 @@ bdev_nvme_create_poll_group_cb(void *io_device, void *ctx_buf)
|
||||
return -1;
|
||||
}
|
||||
|
||||
group->accel_channel = spdk_accel_get_io_channel();
|
||||
if (!group->accel_channel) {
|
||||
spdk_nvme_poll_group_destroy(group->group);
|
||||
SPDK_ERRLOG("Cannot get the accel_channel for bdev nvme polling group=%p\n",
|
||||
group);
|
||||
return -1;
|
||||
}
|
||||
|
||||
group->poller = SPDK_POLLER_REGISTER(bdev_nvme_poll, group, g_opts.nvme_ioq_poll_period_us);
|
||||
|
||||
if (group->poller == NULL) {
|
||||
spdk_put_io_channel(group->accel_channel);
|
||||
spdk_nvme_poll_group_destroy(group->group);
|
||||
return -1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user