Commit 5bc400f3 authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Tomasz Zawadzki
Browse files

lib/bdev: Add spdk_bdev_io_get_cb_arg() to get cb_arg of bdev_io



bdev_io is passed to the callback to the timeout I/O, but the context
of bdev_io is stored in cb_arg and spdk_bdev_abort() needs cb_arg.

Hence add an new helper function, spdk_bdev_io_get_cb_arg(), to get
cb_arg of bdev_io.

Signed-off-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I5eb25ffdad2467c55a1b55f8cf0accef8799bb4b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2621


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 97a5ea57
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -1648,6 +1648,14 @@ void spdk_bdev_io_get_iovec(struct spdk_bdev_io *bdev_io, struct iovec **iovp, i
 */
void *spdk_bdev_io_get_md_buf(struct spdk_bdev_io *bdev_io);

/**
 * Get the callback argument of bdev_io to abort it by spdk_bdev_abort.
 *
 * \param bdev_io I/O to get the callback argument from.
 * \return Callback argument of bdev_io.
 */
void *spdk_bdev_io_get_cb_arg(struct spdk_bdev_io *bdev_io);

typedef void (*spdk_bdev_histogram_status_cb)(void *cb_arg, int status);
typedef void (*spdk_bdev_histogram_data_cb)(void *cb_arg, int status,
		struct spdk_histogram_data *histogram);
+11 −0
Original line number Diff line number Diff line
@@ -5793,6 +5793,17 @@ spdk_bdev_io_get_md_buf(struct spdk_bdev_io *bdev_io)
	return NULL;
}

void *
spdk_bdev_io_get_cb_arg(struct spdk_bdev_io *bdev_io)
{
	if (bdev_io == NULL) {
		assert(false);
		return NULL;
	}

	return bdev_io->internal.caller_ctx;
}

void
spdk_bdev_module_list_add(struct spdk_bdev_module *bdev_module)
{
+1 −0
Original line number Diff line number Diff line
@@ -86,6 +86,7 @@
	spdk_bdev_io_get_scsi_status;
	spdk_bdev_io_get_iovec;
	spdk_bdev_io_get_md_buf;
	spdk_bdev_io_get_cb_arg;
	spdk_bdev_histogram_enable;
	spdk_bdev_histogram_get;
	spdk_bdev_get_media_events;