Change a fixed size array to a linked list to manage LUNs per SCSI device. Keep the linked list sorted by LUN ID because this is necessary to efficiently find the lowest free LUN ID or check the specified LUN is free. To avoid traversing the linked list twice, change scsi_dev_find_free_lun() to return the LUN which comes just before where we want to insert an new LUN. Additionally, previously spdk_scsi_dev_add_lun_ext() had not checked if the specified LUN ID was duplicated. Fix the bug in this patch. Add unit test cases for the function scsi_dev_find_free_lun(). These changes will enable the following patches to increase SPDK_SCSI_DEV_MAX_LUN from 64 to 256 without consuming additional memory. Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: I7f6f070ddc680127cf86ae255055da2d1d29e4ec Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9630 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Community-CI: Mellanox Build Bot Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> |
||
---|---|---|
.. | ||
Makefile | ||
tgt_node_ut.c |