On 12/14/2013 12:59 AM, Andy Grover wrote:
> Indicate support for hierarchical LUN addressing.
> 
> Set address method field in each LUN reported by REPORT LUNS to 1, in
> accordance with SCSI SAM specs.
> 
> Signed-off-by: Andy Grover <agro...@redhat.com>
> ---
>  drivers/target/target_core_spc.c  |    8 ++++++--
>  include/target/target_core_base.h |    4 ++--
>  2 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/target/target_core_spc.c 
> b/drivers/target/target_core_spc.c
> index 0b678fc..04690bf 100644
> --- a/drivers/target/target_core_spc.c
> +++ b/drivers/target/target_core_spc.c
> @@ -79,7 +79,7 @@ spc_emulate_inquiry_std(struct se_cmd *cmd, unsigned char 
> *buf)
>       buf[2] = 0x05; /* SPC-3 */
>  
>       /*
> -      * NORMACA and HISUP = 0, RESPONSE DATA FORMAT = 2
> +      * NORMACA = 0, HISUP = 1, RESPONSE DATA FORMAT = 2
>        *
>        * SPC4 says:
>        *   A RESPONSE DATA FORMAT field set to 2h indicates that the
> @@ -88,7 +88,7 @@ spc_emulate_inquiry_std(struct se_cmd *cmd, unsigned char 
> *buf)
>        *   obsolete. Response data format values greater than 2h are
>        *   reserved.
>        */
> -     buf[3] = 2;
> +     buf[3] = 0x12;
>  
>       /*
>        * Enable SCCS and TPGS fields for Emulated ALUA
> @@ -1164,6 +1164,10 @@ sense_reason_t spc_emulate_report_luns(struct se_cmd 
> *cmd)
>                       break;
>  
>               int_to_scsilun(deve->mapped_lun, (struct scsi_lun 
> *)&buf[offset]);
> +
> +             /* Address method 1 for hier flat-space address. see SAM-5 */
> +             buf[offset] |= (1 << 6);
> +
>               offset += 8;
>       }
>       spin_unlock_irq(&sess->se_node_acl->device_list_lock);
> diff --git a/include/target/target_core_base.h 
> b/include/target/target_core_base.h
> index 08ecfed..537cc67 100644
> --- a/include/target/target_core_base.h
> +++ b/include/target/target_core_base.h
> @@ -14,8 +14,8 @@
>  #define TARGET_CORE_VERSION          TARGET_CORE_MOD_VERSION
>  
>  /* Maximum Number of LUNs per Target Portal Group */
> -/* Don't raise above 511 or REPORT_LUNS needs to handle >1 page */
> -#define TRANSPORT_MAX_LUNS_PER_TPG           256
> +/* Don't raise above 16384 or a different format in report_luns is needed */
> +#define TRANSPORT_MAX_LUNS_PER_TPG           16384
>  /*
>   * By default we use 32-byte CDBs in TCM Core and subsystem plugin code.
>   *
> 
NO WAY.

TCM is (currently) keeping the LUNs in a static array.
Which is sort-of-okay if the number of LUNs is somewhat reasonable,
as it was for 256.
But 16k is way beyond any sensible number and will increase the
memory footprint by a massive amount, irrespective whether someone
will actually _use_ such a large number of LUNs.

Before attempting that one would need to convert the LUN array into
something scalable, like a linked list or somesuch.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                   zSeries & Storage
h...@suse.de                          +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to