linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] AOE: fix up the block device registration so that it actually works now.
@ 2005-01-19  0:09 Greg KH
  2005-01-19 14:08 ` Ed L Cashin
  2005-01-19 20:43 ` Ed L Cashin
  0 siblings, 2 replies; 6+ messages in thread
From: Greg KH @ 2005-01-19  0:09 UTC (permalink / raw)
  To: Ed L Cashin; +Cc: linux-kernel

Ed, I need the following patch against the latest -bk tree in order to
get the aoe code to load and work properly.  Does it look good to you?

thanks,

greg k-h

-------------

AOE: fix up the block device registration so that it actually works now.

Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>

diff -Nru a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c
--- a/drivers/block/aoe/aoeblk.c	2005-01-18 16:06:57 -08:00
+++ b/drivers/block/aoe/aoeblk.c	2005-01-18 16:06:57 -08:00
@@ -249,6 +249,7 @@
 aoeblk_exit(void)
 {
 	kmem_cache_destroy(buf_pool_cache);
+	unregister_blkdev(AOE_MAJOR, DEVICE_NAME);
 }
 
 int __init
diff -Nru a/drivers/block/aoe/aoemain.c b/drivers/block/aoe/aoemain.c
--- a/drivers/block/aoe/aoemain.c	2005-01-18 16:06:57 -08:00
+++ b/drivers/block/aoe/aoemain.c	2005-01-18 16:06:57 -08:00
@@ -82,11 +82,6 @@
 	ret = aoenet_init();
 	if (ret)
 		goto net_fail;
-	ret = register_blkdev(AOE_MAJOR, DEVICE_NAME);
-	if (ret < 0) {
-		printk(KERN_ERR "aoe: aoeblk_init: can't register major\n");
-		goto blkreg_fail;
-	}
 
 	printk(KERN_INFO
 	       "aoe: aoe_init: AoE v2.6-%s initialised.\n",

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] AOE: fix up the block device registration so that it actually works now.
  2005-01-19  0:09 [PATCH] AOE: fix up the block device registration so that it actually works now Greg KH
@ 2005-01-19 14:08 ` Ed L Cashin
  2005-01-19 21:56   ` Greg KH
  2005-01-19 20:43 ` Ed L Cashin
  1 sibling, 1 reply; 6+ messages in thread
From: Ed L Cashin @ 2005-01-19 14:08 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-kernel

Greg KH <greg@kroah.com> writes:

> Ed, I need the following patch against the latest -bk tree in order to
> get the aoe code to load and work properly.  Does it look good to you?

I'm having trouble seeing what's in -bk.  I have a clone of
bk://linux.bkbits.net/linux-2.5, but when I "bk pull" there it says
"Nothing to pull."  And my clone doesn't have all the aoe patches I've
seen get pushed to -bk.

...
> -------------
>
> AOE: fix up the block device registration so that it actually works now.
>
> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
>
> diff -Nru a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c
> --- a/drivers/block/aoe/aoeblk.c	2005-01-18 16:06:57 -08:00
> +++ b/drivers/block/aoe/aoeblk.c	2005-01-18 16:06:57 -08:00
> @@ -249,6 +249,7 @@
>  aoeblk_exit(void)
>  {
>  	kmem_cache_destroy(buf_pool_cache);
> +	unregister_blkdev(AOE_MAJOR, DEVICE_NAME);
>  }

The unregister_blkdev should already be in aoemain.c:aoe_exit.

static void
aoe_exit(void)
{
	discover_timer(TKILL);

	aoenet_exit();
	unregister_blkdev(AOE_MAJOR, DEVICE_NAME);
	aoechr_exit();
	aoedev_exit();
	aoeblk_exit();		/* free cache after de-allocating bufs */
}


>  int __init
> diff -Nru a/drivers/block/aoe/aoemain.c b/drivers/block/aoe/aoemain.c
> --- a/drivers/block/aoe/aoemain.c	2005-01-18 16:06:57 -08:00
> +++ b/drivers/block/aoe/aoemain.c	2005-01-18 16:06:57 -08:00
> @@ -82,11 +82,6 @@
>  	ret = aoenet_init();
>  	if (ret)
>  		goto net_fail;
> -	ret = register_blkdev(AOE_MAJOR, DEVICE_NAME);
> -	if (ret < 0) {
> -		printk(KERN_ERR "aoe: aoeblk_init: can't register major\n");
> -		goto blkreg_fail;
> -	}
>  
>  	printk(KERN_INFO
>  	       "aoe: aoe_init: AoE v2.6-%s initialised.\n",

Hmm.  I'll try to send a patch against usb, since I can pull from
there.

-- 
  Ed L Cashin <ecashin@coraid.com>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] AOE: fix up the block device registration so that it actually works now.
  2005-01-19  0:09 [PATCH] AOE: fix up the block device registration so that it actually works now Greg KH
  2005-01-19 14:08 ` Ed L Cashin
@ 2005-01-19 20:43 ` Ed L Cashin
  1 sibling, 0 replies; 6+ messages in thread
From: Ed L Cashin @ 2005-01-19 20:43 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 445 bytes --]

Greg KH <greg@kroah.com> writes:

> Ed, I need the following patch against the latest -bk tree in order to
> get the aoe code to load and work properly.  Does it look good to you?

I hadn't submitted all my changes correctly, sorry.  Here's a patch
against block-2.6 that rectifies the omission.


Remove allow aoeblk_exit to be called from __init code, and move
register_blkdev into aoe_init.

Signed-off-by: Ed L. Cashin <ecashin@coraid.com>


[-- Attachment #2: diff-block-2.6 --]
[-- Type: text/plain, Size: 845 bytes --]

diff -uprN block-2.6-export-a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c
--- block-2.6-export-a/drivers/block/aoe/aoeblk.c	2005-01-19 14:29:31.000000000 -0500
+++ patch-block-2.6-20050119-export/linux/drivers/block/aoe/aoeblk.c	2005-01-19 15:21:53.000000000 -0500
@@ -245,7 +252,7 @@ aoeblk_gdalloc(void *vp)
 		d->fw_ver, (long long)d->ssize);
 }
 
-void __exit
+void
 aoeblk_exit(void)
 {
 	kmem_cache_destroy(buf_pool_cache);
@@ -254,19 +261,12 @@ aoeblk_exit(void)
 int __init
 aoeblk_init(void)
 {
-	int n;
-
 	buf_pool_cache = kmem_cache_create("aoe_bufs", 
 					   sizeof(struct buf),
 					   0, 0, NULL, NULL);
 	if (buf_pool_cache == NULL)
 		return -ENOMEM;
 
-	n = register_blkdev(AOE_MAJOR, DEVICE_NAME);
-	if (n < 0) {
-		printk(KERN_ERR "aoe: aoeblk_init: can't register major\n");
-		return n;
-	}
 	return 0;
 }
 

[-- Attachment #3: Type: text/plain, Size: 41 bytes --]



-- 
  Ed L Cashin <ecashin@coraid.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] AOE: fix up the block device registration so that it actually works now.
  2005-01-19 14:08 ` Ed L Cashin
@ 2005-01-19 21:56   ` Greg KH
  2005-01-20 13:35     ` Ed L Cashin
  0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2005-01-19 21:56 UTC (permalink / raw)
  To: Ed L Cashin; +Cc: linux-kernel

On Wed, Jan 19, 2005 at 09:08:14AM -0500, Ed L Cashin wrote:
> > diff -Nru a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c
> > --- a/drivers/block/aoe/aoeblk.c	2005-01-18 16:06:57 -08:00
> > +++ b/drivers/block/aoe/aoeblk.c	2005-01-18 16:06:57 -08:00
> > @@ -249,6 +249,7 @@
> >  aoeblk_exit(void)
> >  {
> >  	kmem_cache_destroy(buf_pool_cache);
> > +	unregister_blkdev(AOE_MAJOR, DEVICE_NAME);
> >  }
> 
> The unregister_blkdev should already be in aoemain.c:aoe_exit.

Why?  You do a register_blockdev() in this file, so if something fails,
you should also unregister here.  The big problem is you were trying to
register the same major twice :(

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] AOE: fix up the block device registration so that it actually works now.
  2005-01-19 21:56   ` Greg KH
@ 2005-01-20 13:35     ` Ed L Cashin
  2005-01-20 14:43       ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Ed L Cashin @ 2005-01-20 13:35 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-kernel

Greg KH <greg@kroah.com> writes:

> On Wed, Jan 19, 2005 at 09:08:14AM -0500, Ed L Cashin wrote:
>> > diff -Nru a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c
>> > --- a/drivers/block/aoe/aoeblk.c	2005-01-18 16:06:57 -08:00
>> > +++ b/drivers/block/aoe/aoeblk.c	2005-01-18 16:06:57 -08:00
>> > @@ -249,6 +249,7 @@
>> >  aoeblk_exit(void)
>> >  {
>> >  	kmem_cache_destroy(buf_pool_cache);
>> > +	unregister_blkdev(AOE_MAJOR, DEVICE_NAME);
>> >  }
>> 
>> The unregister_blkdev should already be in aoemain.c:aoe_exit.
>
> Why?  You do a register_blockdev() in this file, so if something fails,
> you should also unregister here.  

No, the register_blkdev that you see in aoeblk.c is the artifact of a
snafu I made in patch submission.  I submitted a small patch yesterday
(ID below) that corrects the snafu and makes block-2.6 the same as the
driver I have.

  Message-ID: <87mzv5m9pl.fsf@coraid.com>

In the current aoe driver, register_blkdev is only in
aoemain.c:aoe_init, and that register_blkdev is the last step in the
initialization sequence.  If register_blkdev fails, then I don't
unregister_blkdev, because presumably I shouldn't undo something that
wasn't done.

> The big problem is you were trying to
> register the same major twice :(

That's because two snippets of my recent fixes got orphaned (my fault)
instead of getting included in the submitted patches, so instead of my
patches moving register_blkdev it got duplicated.  The patch I sent
yesterday corrects the problem and brings block-2.6 back into
accordance with what I've got.  Sorry for the confusion.

-- 
  Ed L Cashin <ecashin@coraid.com>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] AOE: fix up the block device registration so that it actually works now.
  2005-01-20 13:35     ` Ed L Cashin
@ 2005-01-20 14:43       ` Greg KH
  0 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2005-01-20 14:43 UTC (permalink / raw)
  To: Ed L Cashin; +Cc: linux-kernel

On Thu, Jan 20, 2005 at 08:35:06AM -0500, Ed L Cashin wrote:
> Greg KH <greg@kroah.com> writes:
> 
> > On Wed, Jan 19, 2005 at 09:08:14AM -0500, Ed L Cashin wrote:
> >> > diff -Nru a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c
> >> > --- a/drivers/block/aoe/aoeblk.c	2005-01-18 16:06:57 -08:00
> >> > +++ b/drivers/block/aoe/aoeblk.c	2005-01-18 16:06:57 -08:00
> >> > @@ -249,6 +249,7 @@
> >> >  aoeblk_exit(void)
> >> >  {
> >> >  	kmem_cache_destroy(buf_pool_cache);
> >> > +	unregister_blkdev(AOE_MAJOR, DEVICE_NAME);
> >> >  }
> >> 
> >> The unregister_blkdev should already be in aoemain.c:aoe_exit.
> >
> > Why?  You do a register_blockdev() in this file, so if something fails,
> > you should also unregister here.  
> 
> No, the register_blkdev that you see in aoeblk.c is the artifact of a
> snafu I made in patch submission.  I submitted a small patch yesterday
> (ID below) that corrects the snafu and makes block-2.6 the same as the
> driver I have.
> 
>   Message-ID: <87mzv5m9pl.fsf@coraid.com>

Ah, missed that as you didn't CC: me...  I'll apply that one later on
today.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-01-20 14:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-19  0:09 [PATCH] AOE: fix up the block device registration so that it actually works now Greg KH
2005-01-19 14:08 ` Ed L Cashin
2005-01-19 21:56   ` Greg KH
2005-01-20 13:35     ` Ed L Cashin
2005-01-20 14:43       ` Greg KH
2005-01-19 20:43 ` Ed L Cashin

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).