linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Rob Evers <revers@redhat.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH V5 3/3] scsi: Retry report-luns when reported LU count requres more memory
Date: Mon, 15 Dec 2014 07:47:53 -0800	[thread overview]
Message-ID: <20141215154753.GC29357@infradead.org> (raw)
In-Reply-To: <1417808263-5632-4-git-send-email-revers@redhat.com>

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 <hch@lst.de>

  reply	other threads:[~2014-12-15 15:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-05 19:37 [PATCH V5 0/3] scsi: Configure number of LUs reported by 'report-luns' Rob Evers
2014-12-05 19:37 ` [PATCH V5 1/3] scsi: Avoid unnecessary GFP_ATOMIC allocation in scsi_report_lun_scan Rob Evers
2014-12-15 15:43   ` Christoph Hellwig
2014-12-05 19:37 ` [PATCH V5 2/3] scsi: Use set/get_unaligned_be32 in report_luns Rob Evers
2014-12-15 15:45   ` Christoph Hellwig
2014-12-05 19:37 ` [PATCH V5 3/3] scsi: Retry report-luns when reported LU count requres more memory Rob Evers
2014-12-15 15:47   ` Christoph Hellwig [this message]
2014-12-08 13:04 ` [PATCH V5 0/3] scsi: Configure number of LUs reported by 'report-luns' Rob Evers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141215154753.GC29357@infradead.org \
    --to=hch@infradead.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=revers@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).