Skip to contentSkip to conversation

Fix misleading comment in bio.h

PATCH In review Alberto Bertogli 3 participants 7 messages Feb 2, 2009 – Feb 4, 2009 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Fix misleading comment in bio.h

The comment says "remember to add offset!", but the function already adds it.

---
 include/linux/bio.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
include/linux/bio.h +2 -2
index 18462c5..0c8e3fb 100644
@@ -440,8 +440,8 @@ extern struct biovec_slab bvec_slabs[BIOVEC_NR_POOLS] __read_mostly;
 
 #ifdef CONFIG_HIGHMEM
 /*
- * remember to add offset! and never ever reenable interrupts between a
- * bvec_kmap_irq and bvec_kunmap_irq!!
+ * remember never ever reenable interrupts between a bvec_kmap_irq and
+ * bvec_kunmap_irq!
  *
  * This function MUST be inlined - it plays with the CPU interrupt flags.
  */
Signature · 1 line
1.6.1.1.363.g2a3bd
#1 lore raw

PATCH 2/2 bio.h: If they MUST be inlined, then use __always_inline

bvec_kmap_irq() and bvec_kunmap_irq() comments say they MUST be inlined, so mark them as __always_inline.

---
 include/linux/bio.h |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
include/linux/bio.h +4 -2
index 0c8e3fb..713ec6e 100644
@@ -445,7 +445,8 @@ extern struct biovec_slab bvec_slabs[BIOVEC_NR_POOLS] __read_mostly;
  *
  * This function MUST be inlined - it plays with the CPU interrupt flags.
  */
-static inline char *bvec_kmap_irq(struct bio_vec *bvec, unsigned long *flags)
+static __always_inline char *bvec_kmap_irq(struct bio_vec *bvec,
+		unsigned long *flags)
 {
 	unsigned long addr;
 
@@ -461,7 +462,8 @@ static inline char *bvec_kmap_irq(struct bio_vec *bvec, unsigned long *flags)
 	return (char *) addr + bvec->bv_offset;
 }
 
-static inline void bvec_kunmap_irq(char *buffer, unsigned long *flags)
+static __always_inline void bvec_kunmap_irq(char *buffer,
+		unsigned long *flags)
 {
 	unsigned long ptr = (unsigned long) buffer & PAGE_MASK;
 
Signature · 1 line
1.6.1.1.363.g2a3bd
#2 lore raw

Re: [PATCH 2/2] bio.h: If they MUST be inlined, then use __always_inline

Quoted 2 lines · Alberto Bertogli

bvec_kmap_irq() and bvec_kunmap_irq() comments say they MUST be inlined, so mark them as __always_inline.

Thanks Alberto, applied 1-2.

Signature · 1 line
Jens Axboe
#3 lore raw

Re: [PATCH 2/2] bio.h: If they MUST be inlined, then use __always_inline

In reply to Alberto Bertogli
Quoted 13 lines · On Sun, 1 Feb 2009 22:07:31 -0200 Alberto Bertogli <[email protected]>…

bvec_kmap_irq() and bvec_kunmap_irq() comments say they MUST be inlined, so mark them as __always_inline.

---
 include/linux/bio.h |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
include/linux/bio.h +0 -0
index 0c8e3fb..713ec6e 100644

include/linux/bio.h extern struct biovec_slab bvec_slabs[BIOVEC_NR_POOLS] __read_mostly; · line 449

Quoted 6 lines
include/linux/bio.h +2 -1
@@ -445,7 +445,8 @@ extern struct biovec_slab bvec_slabs[BIOVEC_NR_POOLS] __read_mostly;
  *
  * This function MUST be inlined - it plays with the CPU interrupt flags.
  */
-static inline char *bvec_kmap_irq(struct bio_vec *bvec, unsigned long *flags)
+static __always_inline char *bvec_kmap_irq(struct bio_vec *bvec,
+		unsigned long *flags)

The comment is wrong - this was a sparc requirement, long since removed.

#4 lore raw

Re: [PATCH 2/2] bio.h: If they MUST be inlined, then use __always_inline

Quoted 10 lines · Andrew Morton
Quoted 8 lines · On Sun, 1 Feb 2009 22:07:31 -0200 Alberto Bertogli <[email protected]>…

bvec_kmap_irq() and bvec_kunmap_irq() comments say they MUST be inlined, so mark them as __always_inline.

---
 include/linux/bio.h |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
Quoted 13 lines

include/linux/bio.h extern struct biovec_slab bvec_slabs[BIOVEC_NR_POOLS] __read_mostly; · line 449

Quoted 11 lines
include/linux/bio.h +2 -1
index 0c8e3fb..713ec6e 100644
@@ -445,7 +445,8 @@ extern struct biovec_slab bvec_slabs[BIOVEC_NR_POOLS] __read_mostly;
  *
  * This function MUST be inlined - it plays with the CPU interrupt flags.
  */
-static inline char *bvec_kmap_irq(struct bio_vec *bvec, unsigned long *flags)
+static __always_inline char *bvec_kmap_irq(struct bio_vec *bvec,
+		unsigned long *flags)

The comment is wrong - this was a sparc requirement, long since removed.

The comment probably dates back to around 2001 or so, I wasn't aware that the non-local irq flags requirement had since been voided on sparc.

Signature · 1 line
Jens Axboe
#5 lore raw

PATCH 1/1 Do not __always_inline bvec_kmap_irq() and bvec_kunmap_irq()

Quoted 1 line · Andrew Morton

The comment is wrong - this was a sparc requirement, long since removed.

So remove both the comment and the inline requirement, going back to the inline hint.

---

So I came up with this, but I'm not sure if it's better than just avoid the inline and placing them somewhere else. If you want me to write a different patch, let me know.

Thanks a lot,
Alberto

 include/linux/bio.h |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
include/linux/bio.h +2 -4
index 713ec6e..20bcc51 100644
@@ -442,10 +442,8 @@ extern struct biovec_slab bvec_slabs[BIOVEC_NR_POOLS] __read_mostly;
 /*
  * remember never ever reenable interrupts between a bvec_kmap_irq and
  * bvec_kunmap_irq!
- *
- * This function MUST be inlined - it plays with the CPU interrupt flags.
  */
-static __always_inline char *bvec_kmap_irq(struct bio_vec *bvec,
+static inline char *bvec_kmap_irq(struct bio_vec *bvec,
 		unsigned long *flags)
 {
 	unsigned long addr;
@@ -462,7 +460,7 @@ static __always_inline char *bvec_kmap_irq(struct bio_vec *bvec,
 	return (char *) addr + bvec->bv_offset;
 }
 
-static __always_inline void bvec_kunmap_irq(char *buffer,
+static inline void bvec_kunmap_irq(char *buffer,
 		unsigned long *flags)
 {
 	unsigned long ptr = (unsigned long) buffer & PAGE_MASK;
Signature · 1 line
1.6.1.1.363.g2a3bd
#6 lore raw

PATCH 1/1 Do not __always_inline bvec_kmap_irq() and bvec_kunmap_irq()

Quoted 1 line · Andrew Morton

The comment is wrong - this was a sparc requirement, long since removed.

So remove both the comment and the inline requirement, going back to the inline hint.

---

This is the same patch as before, except it's properly indented because everything fits < 80 columns or so.

 include/linux/bio.h |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)
include/linux/bio.h +2 -6
index 713ec6e..972a0e4 100644
@@ -442,11 +442,8 @@ extern struct biovec_slab bvec_slabs[BIOVEC_NR_POOLS] __read_mostly;
 /*
  * remember never ever reenable interrupts between a bvec_kmap_irq and
  * bvec_kunmap_irq!
- *
- * This function MUST be inlined - it plays with the CPU interrupt flags.
  */
-static __always_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;
 
@@ -462,8 +459,7 @@ static __always_inline char *bvec_kmap_irq(struct bio_vec *bvec,
 	return (char *) addr + bvec->bv_offset;
 }
 
-static __always_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;
 
Signature · 1 line
1.6.1.1.363.g2a3bd