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: Shuhei 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: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: GangCao <gang.cao@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
594f46d7a9
commit
153373a5e7
@ -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;
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user