public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: bo yang <bo.yang@lsi.com>
Cc: linux-scsi@vger.kernel.org, James.Bottomley@SteelEye.com,
	akpm@osdl.org, linux-kernel@vger.kernel.org,
	Sumant.patro@lsi.com
Subject: Re: PATCH [2/8] scsi: megaraid_sas - add module param fast_load
Date: Tue, 30 Oct 2007 17:36:45 +0000	[thread overview]
Message-ID: <20071030173645.GA16455@infradead.org> (raw)
In-Reply-To: <1191253611.5850.8.camel@dhcp-75-534.se.lsil.com>

On Mon, Oct 01, 2007 at 11:46:51AM -0400, bo yang wrote:
> +/*
> + * Fast driver load option, skip scanning for physical devices during
> + * load.  This would result in physical devices being skipped during
> + * driver load time. These can be later added though,
> + * using /proc/scsi/scsi
> + */

/proc/scsi/scsi is deprecated, so please don't recommend it here.
The proper way is the scan attribute of the scsi host.

> +static unsigned int fast_load;
> +module_param_named(fast_load, fast_load, int, 0);
> +MODULE_PARM_DESC(fast_load,
> +	"megasas: Faster loading of the driver, skips physical devices! "\
> +	"(default = 0)");

This should show up in sysfs.

> +static struct megasas_instance *megasas_lookup_instance(u16 host_no)
> +{
> +	int i;
> +
> +	for (i = 0; i < megasas_mgmt_info.max_index; i++) {
> +		if ((megasas_mgmt_info.instance[i]) &&
> +			(megasas_mgmt_info.instance[i]->host->host_no
> +			== host_no))

no need for the braces here.  This should be:

		if (megasas_mgmt_info.instance[i] &&
		    megasas_mgmt_info.instance[i]->host->host_no == host_no)

> +static int megasas_slave_alloc(struct scsi_device *sdev)
> +{
> +	struct megasas_instance *instance;
> +	int tmp_fastload = fast_load;
> +
> +	instance = megasas_lookup_instance(sdev->host->host_no);
> +
> +	if (tmp_fastload && sdev->channel < MEGASAS_MAX_PD_CHANNELS) {
> +		if ((sdev->id == MEGASAS_MAX_DEV_PER_CHANNEL -1) &&
> +			(sdev->channel == MEGASAS_MAX_PD_CHANNELS - 1)) {
> +
> +		/*
> +		 * If fast load option was set and scan for last device is
> +		 * over, reset the fast_load flag so that during a possible
> +		 * next scan, devices can be made available
> +		 */
> +			fast_load = 0;
> +		}
> +		return -ENXIO;
> +	}
> +
> +	return 0;
> +}

This is a rather complicated and fragile way to implement this feature.

I'd recomment to change the call to scsi_scan_host in megasas_io_attach
to something like:

	if (fast_load) {
		int channel;

		for (channel = 0; channel < MEGASAS_MAX_PD_CHANNELS;
		     channel++) {
			scsi_scan_host_selected(host, channel, SCAN_WILD_CARD,
						SCAN_WILD_CARD, 0);
		}
	} else {
		scsi_scan_host(host);
	}


  reply	other threads:[~2007-10-30 17:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-01 15:46 PATCH [2/8] scsi: megaraid_sas - add module param fast_load bo yang
2007-10-30 17:36 ` Christoph Hellwig [this message]
2007-11-06 19:04   ` Yang, Bo
2007-11-07 17:39     ` Christoph Hellwig
2007-11-09 20:43       ` Yang, Bo
  -- strict thread matches above, loose matches on Subject: below --
2007-09-26 15:22 bo yang
2007-09-28 20:32 ` Randy Dunlap

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=20071030173645.GA16455@infradead.org \
    --to=hch@infradead.org \
    --cc=James.Bottomley@SteelEye.com \
    --cc=Sumant.patro@lsi.com \
    --cc=akpm@osdl.org \
    --cc=bo.yang@lsi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    /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