Commit 153373a5 authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Tomasz Zawadzki
Browse files

iscsi: Pass iscsi_lun directly to the callback argument of spdk_scsi_lun_open()



By this change, we will not need to traverse LUN list or tree in the
callback to hot remove.

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


Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarGangCao <gang.cao@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 594f46d7
Loading
Loading
Loading
Loading
+3 −10
Original line number Diff line number Diff line
@@ -525,15 +525,8 @@ _iscsi_conn_hotremove_lun(void *ctx)
static void
iscsi_conn_hotremove_lun(struct spdk_scsi_lun *lun, void *remove_ctx)
{
	struct spdk_iscsi_conn *conn = remove_ctx;
	int lun_id = spdk_scsi_lun_get_id(lun);
	struct spdk_iscsi_lun *iscsi_lun;

	iscsi_lun = conn->luns[lun_id];
	if (iscsi_lun == NULL) {
		SPDK_ERRLOG("LUN hotplug was notified to the unallocated LUN %d.\n", lun_id);
		return;
	}
	struct spdk_iscsi_lun *iscsi_lun = remove_ctx;
	struct spdk_iscsi_conn *conn = iscsi_lun->conn;

	spdk_thread_send_msg(spdk_io_channel_get_thread(spdk_io_channel_from_ctx(conn->pg)),
			     _iscsi_conn_hotremove_lun, iscsi_lun);
@@ -554,7 +547,7 @@ iscsi_conn_open_lun(struct spdk_iscsi_conn *conn, int lun_id,
	iscsi_lun->conn = conn;
	iscsi_lun->lun = lun;

	rc = spdk_scsi_lun_open(lun, iscsi_conn_hotremove_lun, conn, &iscsi_lun->desc);
	rc = spdk_scsi_lun_open(lun, iscsi_conn_hotremove_lun, iscsi_lun, &iscsi_lun->desc);
	if (rc != 0) {
		free(iscsi_lun);
		return rc;
+6 −0
Original line number Diff line number Diff line
@@ -156,6 +156,12 @@ spdk_scsi_task_put(struct spdk_scsi_task *scsi_task)
DEFINE_STUB(spdk_scsi_dev_get_lun, struct spdk_scsi_lun *,
	    (struct spdk_scsi_dev *dev, int lun_id), NULL);

DEFINE_STUB(spdk_scsi_dev_get_first_lun, struct spdk_scsi_lun *,
	    (struct spdk_scsi_dev *dev), NULL);

DEFINE_STUB(spdk_scsi_dev_get_next_lun, struct spdk_scsi_lun *,
	    (struct spdk_scsi_lun *prev_lun), NULL);

DEFINE_STUB(spdk_scsi_dev_has_pending_tasks, bool,
	    (const struct spdk_scsi_dev *dev, const struct spdk_scsi_port *initiator_port),
	    true);