public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: mikem@beardog.cca.cpqcorp.ne
Cc: mike.miller@hp.com, axboe@suse.de, linux-kernel@vger.kernel.org,
	linux-scsi@vger.kernel.org
Subject: Re: [PATCH 3/8] cciss: new disk register/deregister routines
Date: Fri, 9 Sep 2005 18:59:25 -0700	[thread overview]
Message-ID: <20050909185925.2ae69954.akpm@osdl.org> (raw)
In-Reply-To: <20050909220435.GC4616@beardog.cca.cpqcorp.net>

mike.miller@hp.com wrote:
>
> Patch 3 of 8
> This patch removes a couple of functions dealing  with configuration and
> replaces them with new functions. This implementation fixes some bugs
> associated with the ACUXE. It also allows a logical volume to be removed
> from the middle without deleting all volumes behind it.
> If a user has 5 logical volumes and decides he wants to reconfigure volume
> number 3, he can now do that without removing volumes 4 & 5 first. This
> code has been tested in our labs against all application software.
> Please consider this for inclusion.
> 
> ...
>
> +static void cciss_update_drive_info(int ctlr, int drv_index)
> +  {
> +	ctlr_info_t *h = hba[ctlr];
> +	struct gendisk *disk;
> +	ReadCapdata_struct *size_buff = NULL;
> +	InquiryData_struct *inq_buff = NULL;
> +	unsigned int block_size;
> +	unsigned int total_size;
> +	unsigned long flags = 0;
> +	int ret = 0;
> +
> +	/* if the disk already exists then deregister it before proceeding*/
> +	if (h->drv[drv_index].raid_level != -1){
> +		spin_lock_irqsave(CCISS_LOCK(h->ctlr), flags);
> +		h->drv[drv_index].busy_configuring = 1;
> +		spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags);

I always get worried when I see a spinlock around a simple assignment like
this - it often doesn't make a lot of sense and can indicate that
something's wrong.

> ...
> +
> +	/* Get information about the disk and modify the driver sturcture */
> +	size_buff = kmalloc(sizeof( ReadCapdata_struct), GFP_KERNEL);
> +        if (size_buff == NULL)
> +		goto mem_msg;
> +	inq_buff = kmalloc(sizeof( InquiryData_struct), GFP_KERNEL);
> +       	if (inq_buff == NULL)
> +		goto mem_msg;

Indenting went wrong.

urgh, maybe it just looks wrong because someone's being inserting spaces
instead of tabs.

> +		ld_buff = kmalloc(sizeof(ReportLunData_struct), GFP_KERNEL);
> +		if (ld_buff == NULL)
> +			goto mem_msg;
> +		memset(ld_buff, 0, sizeof(ReportLunData_struct));

We have kzalloc() now.

>  	/* make sure logical volume is NOT is use */
> -	if( drv->usage_count > 1) {
> -		spin_unlock_irqrestore(CCISS_LOCK(ctlr), flags);
> +	if(clear_all || (h->gendisk[0] == disk)) {
> +                if (drv->usage_count > 1)
>                  return -EBUSY;

Again, it looks wrong but is probably OK due to broken tab key.

Do you want the code to go in like this or do you want to clean it up?

  reply	other threads:[~2005-09-10  2:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-09 22:04 [PATCH 3/8] cciss: new disk register/deregister routines mike.miller
2005-09-10  1:59 ` Andrew Morton [this message]
  -- strict thread matches above, loose matches on Subject: below --
2005-09-12 14:36 mike.miller

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=20050909185925.2ae69954.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=axboe@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mike.miller@hp.com \
    --cc=mikem@beardog.cca.cpqcorp.ne \
    /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