Commit 27646a08 authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Tomasz Zawadzki
Browse files

vhost/scsi: Use spdk_scsi_dev_get_first/next_lun() to iterate LUNs.



This is the same effort as lib/iscsi.

By using spdk_scsi_dev_get_first_lun() and spdk_scsi_dev_get_next_lun(),
remove the dependency on SPDK_SCSI_DEV_MAX_LUN from lib/vhost.

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


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 avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 356df804
Loading
Loading
Loading
Loading
+2 −7
Original line number Diff line number Diff line
@@ -1527,7 +1527,6 @@ vhost_scsi_dump_info_json(struct spdk_vhost_dev *vdev, struct spdk_json_write_ct
	struct spdk_scsi_dev *sdev;
	struct spdk_scsi_lun *lun;
	uint32_t dev_idx;
	uint32_t lun_idx;

	assert(vdev != NULL);
	spdk_json_write_named_array_begin(w, "scsi");
@@ -1547,12 +1546,8 @@ vhost_scsi_dump_info_json(struct spdk_vhost_dev *vdev, struct spdk_json_write_ct

		spdk_json_write_named_array_begin(w, "luns");

		for (lun_idx = 0; lun_idx < SPDK_SCSI_DEV_MAX_LUN; lun_idx++) {
			lun = spdk_scsi_dev_get_lun(sdev, lun_idx);
			if (!lun) {
				continue;
			}

		for (lun = spdk_scsi_dev_get_first_lun(sdev); lun != NULL;
		     lun = spdk_scsi_dev_get_next_lun(lun)) {
			spdk_json_write_object_begin(w);

			spdk_json_write_named_int32(w, "id", spdk_scsi_lun_get_id(lun));