public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [2.6 patch] include/linux/bio.h: "extern inline" -> "static inline"
@ 2005-07-26 14:53 Adrian Bunk
  2005-07-27  1:49 ` Horst von Brand
  2005-07-27 14:29 ` Jens Axboe
  0 siblings, 2 replies; 7+ messages in thread
From: Adrian Bunk @ 2005-07-26 14:53 UTC (permalink / raw)
  To: axboe; +Cc: linux-kernel

"extern inline" doesn't make much sense.


Signed-off-by: Adrian Bunk <bunk@stusta.de>

---

 include/linux/bio.h |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

--- linux-2.6.13-rc3-mm1-full/include/linux/bio.h.old	2005-07-26 13:40:47.000000000 +0200
+++ linux-2.6.13-rc3-mm1-full/include/linux/bio.h	2005-07-26 13:41:13.000000000 +0200
@@ -314,9 +314,8 @@
  * bvec_kmap_irq and bvec_kunmap_irq!!
  *
  * This function MUST be inlined - it plays with the CPU interrupt flags.
- * Hence the `extern inline'.
  */
-extern inline char *bvec_kmap_irq(struct bio_vec *bvec, unsigned long *flags)
+static inline char *bvec_kmap_irq(struct bio_vec *bvec, unsigned long *flags)
 {
 	unsigned long addr;
 
@@ -332,7 +331,7 @@
 	return (char *) addr + bvec->bv_offset;
 }
 
-extern inline void bvec_kunmap_irq(char *buffer, unsigned long *flags)
+static inline void bvec_kunmap_irq(char *buffer, unsigned long *flags)
 {
 	unsigned long ptr = (unsigned long) buffer & PAGE_MASK;
 
@@ -345,7 +344,7 @@
 #define bvec_kunmap_irq(buf, flags)	do { *(flags) = 0; } while (0)
 #endif
 
-extern inline char *__bio_kmap_irq(struct bio *bio, unsigned short idx,
+static inline char *__bio_kmap_irq(struct bio *bio, unsigned short idx,
 				   unsigned long *flags)
 {
 	return bvec_kmap_irq(bio_iovec_idx(bio, idx), flags);


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

* Re: [2.6 patch] include/linux/bio.h: "extern inline" -> "static inline"
  2005-07-26 14:53 Adrian Bunk
@ 2005-07-27  1:49 ` Horst von Brand
  2005-07-27 12:05   ` Adrian Bunk
  2005-07-27 14:29 ` Jens Axboe
  1 sibling, 1 reply; 7+ messages in thread
From: Horst von Brand @ 2005-07-27  1:49 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: axboe, linux-kernel

Adrian Bunk <bunk@stusta.de> wrote:
> "extern inline" doesn't make much sense.

The gcc info here (4.0.1-4 on Fedora rawhide) says it means that the
function should be inlined, and no local copy should be generated
ever. This way the build will bomb out when something isn't inlined.

It also says you should use:

   static inline void foo(some args) __attribute__((always_inline));

as a prototype in this case for future proofing (gcc inlining is not C99
compatible!), but I don't know if that is supported as far back as 2.95.3
(as per Documentation/Changes the required compiler).

Side question: Is there anybody still seriously using such ancient
compilers? I'd guess almost everybody is using newer versions, so this
would really be not a supported combination anymore.
-- 
Dr. Horst H. von Brand                   User #22616 counter.li.org
Departamento de Informatica                     Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria              +56 32 654239
Casilla 110-V, Valparaiso, Chile                Fax:  +56 32 797513




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

* Re: [2.6 patch] include/linux/bio.h: "extern inline" -> "static inline"
  2005-07-27  1:49 ` Horst von Brand
@ 2005-07-27 12:05   ` Adrian Bunk
  0 siblings, 0 replies; 7+ messages in thread
From: Adrian Bunk @ 2005-07-27 12:05 UTC (permalink / raw)
  To: Horst von Brand; +Cc: axboe, linux-kernel

On Tue, Jul 26, 2005 at 09:49:02PM -0400, Horst von Brand wrote:
> Adrian Bunk <bunk@stusta.de> wrote:
> > "extern inline" doesn't make much sense.
> 
> The gcc info here (4.0.1-4 on Fedora rawhide) says it means that the
> function should be inlined, and no local copy should be generated
> ever. This way the build will bomb out when something isn't inlined.
> 
> It also says you should use:
> 
>    static inline void foo(some args) __attribute__((always_inline));

We are already doing this automatically.

> as a prototype in this case for future proofing (gcc inlining is not C99
> compatible!), but I don't know if that is supported as far back as 2.95.3
> (as per Documentation/Changes the required compiler).

__attribute__((always_inline)) is supported since gcc 3.1 .

> Side question: Is there anybody still seriously using such ancient
> compilers? I'd guess almost everybody is using newer versions, so this
> would really be not a supported combination anymore.

gcc 2.95 is still a 100% supported compiler.

Compilation of the complete kernel sources usually works [1] and I know 
several people still using gcc 2.95 for several reasons.

cu
Adrian

[1] on i386

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed


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

* Re: [2.6 patch] include/linux/bio.h: "extern inline" -> "static inline"
  2005-07-26 14:53 Adrian Bunk
  2005-07-27  1:49 ` Horst von Brand
@ 2005-07-27 14:29 ` Jens Axboe
  2005-07-27 14:59   ` Kimball Murray
  1 sibling, 1 reply; 7+ messages in thread
From: Jens Axboe @ 2005-07-27 14:29 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: linux-kernel

On Tue, Jul 26 2005, Adrian Bunk wrote:
> "extern inline" doesn't make much sense.

Yep, thanks.

-- 
Jens Axboe


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

* Re: [2.6 patch] include/linux/bio.h: "extern inline" -> "static inline"
  2005-07-27 14:29 ` Jens Axboe
@ 2005-07-27 14:59   ` Kimball Murray
  2005-07-27 16:23     ` Adrian Bunk
  0 siblings, 1 reply; 7+ messages in thread
From: Kimball Murray @ 2005-07-27 14:59 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Adrian Bunk, linux-kernel

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

Jens Axboe wrote:

>On Tue, Jul 26 2005, Adrian Bunk wrote:
>  
>
>>"extern inline" doesn't make much sense.
>>    
>>
>
>Yep, thanks.
>
>  
>
IIRC, there was a time when the extern inline construct was used to 
catch cases where the compiler did not inline the function (you'd get a 
link error).  Seems like it still works.  Try building the attached 
files in each of the following ways:

gcc -o foo foo.c

    and

gcc -O2 -o foo foo.c

In the first case, you get a link error, because there is no inlining.

-kimball

[-- Attachment #2: foo.c --]
[-- Type: text/plain, Size: 102 bytes --]

#include "bar.h"

void foo(void) {
	bar();
}

int main(int argc, char *argv[])
{
	foo();
	return 0;
}

[-- Attachment #3: bar.h --]
[-- Type: text/plain, Size: 33 bytes --]

extern inline void bar(void)
{
}

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

* Re: [2.6 patch] include/linux/bio.h: "extern inline" -> "static inline"
  2005-07-27 14:59   ` Kimball Murray
@ 2005-07-27 16:23     ` Adrian Bunk
  0 siblings, 0 replies; 7+ messages in thread
From: Adrian Bunk @ 2005-07-27 16:23 UTC (permalink / raw)
  To: Kimball Murray; +Cc: Jens Axboe, linux-kernel

On Wed, Jul 27, 2005 at 10:59:35AM -0400, Kimball Murray wrote:
> Jens Axboe wrote:
> 
> >On Tue, Jul 26 2005, Adrian Bunk wrote:
> > 
> >
> >>"extern inline" doesn't make much sense.
> >>   
> >>
> >
> >Yep, thanks.
> >
> > 
> >
> IIRC, there was a time when the extern inline construct was used to 
> catch cases where the compiler did not inline the function (you'd get a 
> link error).  Seems like it still works.  Try building the attached 
> files in each of the following ways:
> 
> gcc -o foo foo.c
> 
>    and
> 
> gcc -O2 -o foo foo.c
> 
> In the first case, you get a link error, because there is no inlining.

In the kernel, we have a
  # define inline         inline          __attribute__((always_inline))

This doesn't leave gcc any choice to not inline the function.

> -kimball

> #include "bar.h"
> 
> void foo(void) {
> 	bar();
> }
> 
> int main(int argc, char *argv[])
> {
> 	foo();
> 	return 0;
> }

> extern inline void bar(void)
> {
> }

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed


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

* [2.6 patch] include/linux/bio.h: "extern inline" -> "static inline"
@ 2005-07-31 22:26 Adrian Bunk
  0 siblings, 0 replies; 7+ messages in thread
From: Adrian Bunk @ 2005-07-31 22:26 UTC (permalink / raw)
  To: Andrew Morton; +Cc: axboe, linux-kernel

"extern inline" doesn't make much sense.

This patch was already ACK'ed by Jens Axboe.


Signed-off-by: Adrian Bunk <bunk@stusta.de>

---

This patch was already sent on:
- 26 Jul 2005

 include/linux/bio.h |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

--- linux-2.6.13-rc3-mm1-full/include/linux/bio.h.old	2005-07-26 13:40:47.000000000 +0200
+++ linux-2.6.13-rc3-mm1-full/include/linux/bio.h	2005-07-26 13:41:13.000000000 +0200
@@ -314,9 +314,8 @@
  * bvec_kmap_irq and bvec_kunmap_irq!!
  *
  * This function MUST be inlined - it plays with the CPU interrupt flags.
- * Hence the `extern inline'.
  */
-extern inline char *bvec_kmap_irq(struct bio_vec *bvec, unsigned long *flags)
+static inline char *bvec_kmap_irq(struct bio_vec *bvec, unsigned long *flags)
 {
 	unsigned long addr;
 
@@ -332,7 +331,7 @@
 	return (char *) addr + bvec->bv_offset;
 }
 
-extern inline void bvec_kunmap_irq(char *buffer, unsigned long *flags)
+static inline void bvec_kunmap_irq(char *buffer, unsigned long *flags)
 {
 	unsigned long ptr = (unsigned long) buffer & PAGE_MASK;
 
@@ -345,7 +344,7 @@
 #define bvec_kunmap_irq(buf, flags)	do { *(flags) = 0; } while (0)
 #endif
 
-extern inline char *__bio_kmap_irq(struct bio *bio, unsigned short idx,
+static inline char *__bio_kmap_irq(struct bio *bio, unsigned short idx,
 				   unsigned long *flags)
 {
 	return bvec_kmap_irq(bio_iovec_idx(bio, idx), flags);


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

end of thread, other threads:[~2005-07-31 22:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-31 22:26 [2.6 patch] include/linux/bio.h: "extern inline" -> "static inline" Adrian Bunk
  -- strict thread matches above, loose matches on Subject: below --
2005-07-26 14:53 Adrian Bunk
2005-07-27  1:49 ` Horst von Brand
2005-07-27 12:05   ` Adrian Bunk
2005-07-27 14:29 ` Jens Axboe
2005-07-27 14:59   ` Kimball Murray
2005-07-27 16:23     ` Adrian Bunk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox