The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Ed Cashin <ecashin@coraid.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/7] aoe: support more AoE addresses with dynamic block device minor numbers
Date: Tue, 2 Oct 2012 14:12:30 -0700	[thread overview]
Message-ID: <20121002141230.17f59ed8.akpm@linux-foundation.org> (raw)
In-Reply-To: <3c9c2338b9c963e1d5f19cc9ed51b01cf829eeee.1349104674.git.ecashin@coraid.com>

On Mon, 1 Oct 2012 18:59:12 -0700
Ed Cashin <ecashin@coraid.com> wrote:

> The ATA over Ethernet protocol uses a major (shelf) and
> minor (slot) address to identify a particular storage target.
> These changes remove an artificial limitation the aoe driver
> imposes on the use of AoE addresses.  For example, without these
> changes, the slot address has a maximum of 15, but users commonly
> use slot numbers much greater than that.
> 
> The AoE shelf and slot address space is often used sparsely.
> Instead of using a static mapping between AoE addresses and the
> block device minor number, the block device minor numbers are now
> allocated on demand.
> 
> ...

Very minor things...

>
> ...
>
> +static int
> +minor_get(ulong *minor)
>  {
> -	struct aoedev *d;
>  	ulong flags;
> +	ulong n;
> +	int error = 0;
> +
> +	spin_lock_irqsave(&used_minors_lock, flags);
> +	n = find_first_zero_bit(used_minors, N_DEVS);
> +	if (n < N_DEVS)
> +		set_bit(n, used_minors);
> +	else
> +		error = -1;
> +	spin_unlock_irqrestore(&used_minors_lock, flags);
> +
> +	*minor = n * AOE_PARTITIONS;
> +	return error;
> +}

- can use the more efficient __set_bit() inside that spinlock.

- could avoid setting *minor if we're returning an error.

> -	spin_lock_irqsave(&devlist_lock, flags);
> +static void
> +minor_free(ulong minor)
> +{
> +	ulong flags;
>  
> -	for (d=devlist; d; d=d->next)
> -		if (d->aoemajor == maj && d->aoeminor == min) {
> -			d->ref++;
> -			break;
> -		}
> +	minor /= AOE_PARTITIONS;
> +	BUG_ON(minor >= N_DEVS);
>  
> -	spin_unlock_irqrestore(&devlist_lock, flags);
> -	return d;
> +	spin_lock_irqsave(&used_minors_lock, flags);
> +	BUG_ON(!test_bit(minor, used_minors));
> +	clear_bit(minor, used_minors);
> +	spin_unlock_irqrestore(&used_minors_lock, flags);
>  }

Could use

	BUG_ON(!__test_and_clear_bit(...));

This will work, but I think it's bad form to put an expression with
side-effects inside an assert macro.



  parent reply	other threads:[~2012-10-02 21:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-02  1:59 [PATCH 1/7] aoe: support more AoE addresses with dynamic block device minor numbers Ed Cashin
2012-10-02  2:01 ` [PATCH 2/7] aoe: retain static block device numbers for backwards compatibility Ed Cashin
2012-10-02 21:16   ` Andrew Morton
2012-10-02  2:03 ` [PATCH 3/7] aoe: update and specify AoE address guards and error messages Ed Cashin
2012-10-02  2:05 ` [PATCH 4/7] aoe: make dynamic block minor numbers the default Ed Cashin
2012-10-02 21:17   ` Andrew Morton
2012-10-02 22:50     ` Ed Cashin
2012-10-02  2:07 ` [PATCH 5/7] aoe: remove unused code Ed Cashin
2012-10-02  2:09 ` [PATCH 6/7] aoe: update documentation to better reflect aoe-plus-udev usage Ed Cashin
2012-10-02  2:11 ` [PATCH 7/7] aoe: update aoe-internal version number to 50 Ed Cashin
2012-10-02 10:30 ` [PATCH 1/7] aoe: support more AoE addresses with dynamic block device minor numbers Ed Cashin
2012-10-02 21:12 ` Andrew Morton [this message]
2012-10-03  0:03   ` Ed Cashin

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=20121002141230.17f59ed8.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=ecashin@coraid.com \
    --cc=linux-kernel@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