On Fri, Dec 05, 2014 at 02:37:43PM -0500, Rob Evers wrote:
> Update scsi_report_lun_scan to initially always report up to 511 LUs,
> as the previous default max_report_luns did.  Retry in a loop if not
> enough memory is available for the number of LUs reported.  Parameter
> max_report_luns is removed as it is no longer used.
> ---
>  drivers/scsi/scsi_scan.c | 43 ++++++++++++-------------------------------
>  1 file changed, 12 insertions(+), 31 deletions(-)
> 
> diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
> index 8db1f6f..ecd8703 100644
> --- a/drivers/scsi/scsi_scan.c
> +++ b/drivers/scsi/scsi_scan.c
> @@ -80,6 +80,7 @@
>  
>  static const char *scsi_null_device_strs = "nullnullnullnull";
>  
> +#define INITIAL_MAX_SCSI_REPORT_LUNS 511

The name seems very verbose.  Given that it's only used once we might
as well just remove it and add a comment about why this number is chosen
instead.


> -     length = get_unaligned_be32(lun_data->scsi_lun);
> +     if (get_unaligned_be32(lun_data->scsi_lun) +
> +         sizeof(struct scsi_lun) > length) {
> +             length = get_unaligned_be32(lun_data->scsi_lun) +
> +                      sizeof(struct scsi_lun);
> +             kfree(lun_data);
> +             goto retry;
> +     } else
> +             length = get_unaligned_be32(lun_data->scsi_lun);

The else won't be reached due to the goto.  Just remove it and one
level of indentation for the next line.

Otherwise looks good:

Reviewed-by: Christoph Hellwig <h...@lst.de>
--
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