iscsi: iSCSI target uses spdk_scsi_dev_get_first/next_lun() to iterate LUNs
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: I99cc770c3637d79689d61f996ae40bb4be25cb00 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9626 Community-CI: Mellanox Build Bot Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> 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
8215c0acef
commit
594f46d7a9
@ -1226,16 +1226,11 @@ int
|
||||
iscsi_tgt_node_cleanup_luns(struct spdk_iscsi_conn *conn,
|
||||
struct spdk_iscsi_tgt_node *target)
|
||||
{
|
||||
int i;
|
||||
struct spdk_scsi_lun *lun;
|
||||
struct spdk_iscsi_task *task;
|
||||
|
||||
for (i = 0; i < SPDK_SCSI_DEV_MAX_LUN; i++) {
|
||||
struct spdk_scsi_lun *lun = spdk_scsi_dev_get_lun(target->dev, i);
|
||||
|
||||
if (!lun) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (lun = spdk_scsi_dev_get_first_lun(target->dev); lun != NULL;
|
||||
lun = spdk_scsi_dev_get_next_lun(lun)) {
|
||||
/* we create a fake management task per LUN to cleanup */
|
||||
task = iscsi_task_get(conn, NULL, iscsi_task_mgmt_cpl);
|
||||
if (!task) {
|
||||
@ -1329,7 +1324,7 @@ iscsi_tgt_node_info_json(struct spdk_iscsi_tgt_node *target,
|
||||
{
|
||||
struct spdk_iscsi_pg_map *pg_map;
|
||||
struct spdk_iscsi_ig_map *ig_map;
|
||||
int i;
|
||||
struct spdk_scsi_lun *lun;
|
||||
|
||||
spdk_json_write_object_begin(w);
|
||||
|
||||
@ -1351,15 +1346,12 @@ iscsi_tgt_node_info_json(struct spdk_iscsi_tgt_node *target,
|
||||
spdk_json_write_array_end(w);
|
||||
|
||||
spdk_json_write_named_array_begin(w, "luns");
|
||||
for (i = 0; i < SPDK_SCSI_DEV_MAX_LUN; i++) {
|
||||
struct spdk_scsi_lun *lun = spdk_scsi_dev_get_lun(target->dev, i);
|
||||
|
||||
if (lun) {
|
||||
spdk_json_write_object_begin(w);
|
||||
spdk_json_write_named_string(w, "bdev_name", spdk_scsi_lun_get_bdev_name(lun));
|
||||
spdk_json_write_named_int32(w, "lun_id", spdk_scsi_lun_get_id(lun));
|
||||
spdk_json_write_object_end(w);
|
||||
}
|
||||
for (lun = spdk_scsi_dev_get_first_lun(target->dev); lun != NULL;
|
||||
lun = spdk_scsi_dev_get_next_lun(lun)) {
|
||||
spdk_json_write_object_begin(w);
|
||||
spdk_json_write_named_string(w, "bdev_name", spdk_scsi_lun_get_bdev_name(lun));
|
||||
spdk_json_write_named_int32(w, "lun_id", spdk_scsi_lun_get_id(lun));
|
||||
spdk_json_write_object_end(w);
|
||||
}
|
||||
spdk_json_write_array_end(w);
|
||||
|
||||
|
@ -110,6 +110,16 @@ spdk_scsi_dev_add_lun(struct spdk_scsi_dev *dev, const char *bdev_name, int lun_
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
static void
|
||||
add_lun_test_cases(void)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user