Skip to contentSkip to conversation

bitops: rename generic little-endian bitops functions

PATCH Superseded Akinobu Mita 6 participants 45 messages Oct 21, 2010 – Oct 31, 2010 1 message not in the archive

Subsystems (26)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#3 lore raw

PATCH v2 2/22 bitops: rename generic little-endian bitops functions

In reply to a message not in the archive

As a preparation for providing little-endian bitops for all architectures, This removes generic_ prefix from little-endian bitops function names in asm-generic/bitops/le.h.

s/generic_find_next_le_bit/find_next_le_bit/ s/generic_find_next_zero_le_bit/find_next_zero_le_bit/ s/generic_find_first_zero_le_bit/find_first_zero_le_bit/ s/generic___test_and_set_le_bit/__test_and_set_le_bit/ s/generic___test_and_clear_le_bit/__test_and_clear_le_bit/ s/generic_test_le_bit/test_le_bit/ s/generic___set_le_bit/__set_le_bit/ s/generic___clear_le_bit/__clear_le_bit/ s/generic_test_and_set_le_bit/test_and_set_le_bit/ s/generic_test_and_clear_le_bit/test_and_clear_le_bit/

Cc Hans-Christian Egtvedt <[email protected]>
Cc Geert Uytterhoeven <[email protected]>
Cc Roman Zippel <[email protected]>
Cc Andreas Schwab <[email protected]>
Cc Greg Ungerer <[email protected]>
Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Andy Grover <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Avi Kivity <[email protected]>
Cc Marcelo Tosatti <[email protected]>

---
No change from previous submission

 arch/avr32/kernel/avr32_ksyms.c              |    4 ++--
 arch/avr32/lib/findbit.S                     |    4 ++--
 arch/m68k/include/asm/bitops_mm.h            |    8 ++++----
 arch/m68k/include/asm/bitops_no.h            |    2 +-
 arch/powerpc/include/asm/bitops.h            |   11 ++++++-----
 include/asm-generic/bitops/ext2-non-atomic.h |   12 ++++++------
 include/asm-generic/bitops/le.h              |   26 +++++++++++++-------------
 include/asm-generic/bitops/minix-le.h        |   10 +++++-----
 lib/find_next_bit.c                          |    9 ++++-----
 net/rds/cong.c                               |    6 +++---
 virt/kvm/kvm_main.c                          |    2 +-
 11 files changed, 47 insertions(+), 47 deletions(-)
arch/avr32/kernel/avr32_ksyms.c +2 -2
index 11e310c..c63b943 100644
@@ -58,8 +58,8 @@ EXPORT_SYMBOL(find_first_zero_bit);
 EXPORT_SYMBOL(find_next_zero_bit);
 EXPORT_SYMBOL(find_first_bit);
 EXPORT_SYMBOL(find_next_bit);
-EXPORT_SYMBOL(generic_find_next_le_bit);
-EXPORT_SYMBOL(generic_find_next_zero_le_bit);
+EXPORT_SYMBOL(find_next_le_bit);
+EXPORT_SYMBOL(find_next_zero_le_bit);
 
 /* I/O primitives (lib/io-*.S) */
 EXPORT_SYMBOL(__raw_readsb);
arch/avr32/lib/findbit.S +2 -2
index 997b33b..6880d85 100644
@@ -123,7 +123,7 @@ ENTRY(find_next_bit)
 	brgt	1b
 	retal	r11
 
-ENTRY(generic_find_next_le_bit)
+ENTRY(find_next_le_bit)
 	lsr	r8, r10, 5
 	sub	r9, r11, r10
 	retle	r11
@@ -153,7 +153,7 @@ ENTRY(generic_find_next_le_bit)
 	brgt	1b
 	retal	r11
 
-ENTRY(generic_find_next_zero_le_bit)
+ENTRY(find_next_zero_le_bit)
 	lsr	r8, r10, 5
 	sub	r9, r11, r10
 	retle	r11
arch/m68k/include/asm/bitops_mm.h +4 -4
index b4ecdaa..f1010ab 100644
@@ -366,9 +366,9 @@ static inline int minix_test_bit(int nr, const void *vaddr)
 #define ext2_clear_bit(nr, addr)		__test_and_clear_bit((nr) ^ 24, (unsigned long *)(addr))
 #define ext2_clear_bit_atomic(lock, nr, addr)	test_and_clear_bit((nr) ^ 24, (unsigned long *)(addr))
 #define ext2_find_next_zero_bit(addr, size, offset) \
-	generic_find_next_zero_le_bit((unsigned long *)addr, size, offset)
+	find_next_zero_le_bit((unsigned long *)addr, size, offset)
 #define ext2_find_next_bit(addr, size, offset) \
-	generic_find_next_le_bit((unsigned long *)addr, size, offset)
+	find_next_le_bit((unsigned long *)addr, size, offset)
 
 static inline int ext2_test_bit(int nr, const void *vaddr)
 {
@@ -398,7 +398,7 @@ static inline int ext2_find_first_zero_bit(const void *vaddr, unsigned size)
 	return (p - addr) * 32 + res;
 }
 
-static inline unsigned long generic_find_next_zero_le_bit(const unsigned long *addr,
+static inline unsigned long find_next_zero_le_bit(const unsigned long *addr,
 		unsigned long size, unsigned long offset)
 {
 	const unsigned long *p = addr + (offset >> 5);
@@ -440,7 +440,7 @@ static inline int ext2_find_first_bit(const void *vaddr, unsigned size)
 	return (p - addr) * 32 + res;
 }
 
-static inline unsigned long generic_find_next_le_bit(const unsigned long *addr,
+static inline unsigned long find_next_le_bit(const unsigned long *addr,
 		unsigned long size, unsigned long offset)
 {
 	const unsigned long *p = addr + (offset >> 5);
arch/m68k/include/asm/bitops_no.h +1 -1
index 9d3cbe5..292e1ce 100644
@@ -325,7 +325,7 @@ found_middle:
 }
 
 #define ext2_find_next_bit(addr, size, off) \
-	generic_find_next_le_bit((unsigned long *)(addr), (size), (off))
+	find_next_le_bit((unsigned long *)(addr), (size), (off))
 #include <asm-generic/bitops/minix.h>
 
 #endif /* __KERNEL__ */
arch/powerpc/include/asm/bitops.h +6 -5
index 30964ae..b4f3f84 100644
@@ -294,11 +294,12 @@ static __inline__ int test_le_bit(unsigned long nr,
 #define __test_and_clear_le_bit(nr, addr) \
 	__test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
 
-#define find_first_zero_le_bit(addr, size) generic_find_next_zero_le_bit((addr), (size), 0)
-unsigned long generic_find_next_zero_le_bit(const unsigned long *addr,
+#define find_first_zero_le_bit(addr, size) \
+	find_next_zero_le_bit((addr), (size), 0)
+unsigned long find_next_zero_le_bit(const unsigned long *addr,
 				    unsigned long size, unsigned long offset);
 
-unsigned long generic_find_next_le_bit(const unsigned long *addr,
+unsigned long find_next_le_bit(const unsigned long *addr,
 				    unsigned long size, unsigned long offset);
 /* Bitmap functions for the ext2 filesystem */
 
@@ -317,10 +318,10 @@ unsigned long generic_find_next_le_bit(const unsigned long *addr,
 #define ext2_find_first_zero_bit(addr, size) \
 	find_first_zero_le_bit((unsigned long*)addr, size)
 #define ext2_find_next_zero_bit(addr, size, off) \
-	generic_find_next_zero_le_bit((unsigned long*)addr, size, off)
+	find_next_zero_le_bit((unsigned long *)addr, size, off)
 
 #define ext2_find_next_bit(addr, size, off) \
-	generic_find_next_le_bit((unsigned long *)addr, size, off)
+	find_next_le_bit((unsigned long *)addr, size, off)
 /* Bitmap functions for the minix filesystem.  */
 
 #define minix_test_and_set_bit(nr,addr) \
include/asm-generic/bitops/ext2-non-atomic.h +6 -6
index 63cf822..9c7bb9a 100644
@@ -4,17 +4,17 @@
 #include <asm-generic/bitops/le.h>
 
 #define ext2_set_bit(nr,addr)	\
-	generic___test_and_set_le_bit((nr),(unsigned long *)(addr))
+	__test_and_set_le_bit((nr), (unsigned long *)(addr))
 #define ext2_clear_bit(nr,addr)	\
-	generic___test_and_clear_le_bit((nr),(unsigned long *)(addr))
+	__test_and_clear_le_bit((nr), (unsigned long *)(addr))
 
 #define ext2_test_bit(nr,addr)	\
-	generic_test_le_bit((nr),(unsigned long *)(addr))
+	test_le_bit((nr), (unsigned long *)(addr))
 #define ext2_find_first_zero_bit(addr, size) \
-	generic_find_first_zero_le_bit((unsigned long *)(addr), (size))
+	find_first_zero_le_bit((unsigned long *)(addr), (size))
 #define ext2_find_next_zero_bit(addr, size, off) \
-	generic_find_next_zero_le_bit((unsigned long *)(addr), (size), (off))
+	find_next_zero_le_bit((unsigned long *)(addr), (size), (off))
 #define ext2_find_next_bit(addr, size, off) \
-	generic_find_next_le_bit((unsigned long *)(addr), (size), (off))
+	find_next_le_bit((unsigned long *)(addr), (size), (off))
 
 #endif /* _ASM_GENERIC_BITOPS_EXT2_NON_ATOMIC_H_ */
include/asm-generic/bitops/le.h +13 -13
index db2be81..6ad46ce 100644
@@ -8,42 +8,42 @@
 
 #define BITOP_LE_SWIZZLE	0
 
-#define generic_find_next_zero_le_bit(addr, size, offset) \
+#define find_next_zero_le_bit(addr, size, offset) \
 	find_next_zero_bit(addr, size, offset)
-#define generic_find_next_le_bit(addr, size, offset) \
+#define find_next_le_bit(addr, size, offset) \
 	find_next_bit(addr, size, offset)
 
 #elif defined(__BIG_ENDIAN)
 
 #define BITOP_LE_SWIZZLE	((BITS_PER_LONG-1) & ~0x7)
 
-extern unsigned long generic_find_next_zero_le_bit(const unsigned long *addr,
+extern unsigned long find_next_zero_le_bit(const unsigned long *addr,
 		unsigned long size, unsigned long offset);
-extern unsigned long generic_find_next_le_bit(const unsigned long *addr,
+extern unsigned long find_next_le_bit(const unsigned long *addr,
 		unsigned long size, unsigned long offset);
 
 #else
 #error "Please fix <asm/byteorder.h>"
 #endif
 
-#define generic_test_le_bit(nr, addr) \
+#define test_le_bit(nr, addr) \
 	test_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
-#define generic___set_le_bit(nr, addr) \
+#define __set_le_bit(nr, addr) \
 	__set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
-#define generic___clear_le_bit(nr, addr) \
+#define __clear_le_bit(nr, addr) \
 	__clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
 
-#define generic_test_and_set_le_bit(nr, addr) \
+#define test_and_set_le_bit(nr, addr) \
 	test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
-#define generic_test_and_clear_le_bit(nr, addr) \
+#define test_and_clear_le_bit(nr, addr) \
 	test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
 
-#define generic___test_and_set_le_bit(nr, addr) \
+#define __test_and_set_le_bit(nr, addr) \
 	__test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
-#define generic___test_and_clear_le_bit(nr, addr) \
+#define __test_and_clear_le_bit(nr, addr) \
 	__test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
 
-#define generic_find_first_zero_le_bit(addr, size) \
-        generic_find_next_zero_le_bit((addr), (size), 0)
+#define find_first_zero_le_bit(addr, size) \
+	find_next_zero_le_bit((addr), (size), 0)
 
 #endif /* _ASM_GENERIC_BITOPS_LE_H_ */
include/asm-generic/bitops/minix-le.h +5 -5
index 4a981c1..ed0ae09 100644
@@ -4,14 +4,14 @@
 #include <asm-generic/bitops/le.h>
 
 #define minix_test_and_set_bit(nr,addr)	\
-	generic___test_and_set_le_bit((nr),(unsigned long *)(addr))
+	__test_and_set_le_bit((nr), (unsigned long *)(addr))
 #define minix_set_bit(nr,addr)		\
-	generic___set_le_bit((nr),(unsigned long *)(addr))
+	__set_le_bit((nr), (unsigned long *)(addr))
 #define minix_test_and_clear_bit(nr,addr) \
-	generic___test_and_clear_le_bit((nr),(unsigned long *)(addr))
+	__test_and_clear_le_bit((nr), (unsigned long *)(addr))
 #define minix_test_bit(nr,addr)		\
-	generic_test_le_bit((nr),(unsigned long *)(addr))
+	test_le_bit((nr), (unsigned long *)(addr))
 #define minix_find_first_zero_bit(addr,size) \
-	generic_find_first_zero_le_bit((unsigned long *)(addr),(size))
+	find_first_zero_le_bit((unsigned long *)(addr), (size))
 
 #endif /* _ASM_GENERIC_BITOPS_MINIX_LE_H_ */
lib/find_next_bit.c +4 -5
index 24c59de..eb8934b 100644
@@ -185,7 +185,7 @@ static inline unsigned long ext2_swab(const unsigned long y)
 #endif
 }
 
-unsigned long generic_find_next_zero_le_bit(const unsigned long *addr, unsigned
+unsigned long find_next_zero_le_bit(const unsigned long *addr, unsigned
 		long size, unsigned long offset)
 {
 	const unsigned long *p = addr + BITOP_WORD(offset);
@@ -226,10 +226,9 @@ found_middle:
 found_middle_swap:
 	return result + ffz(ext2_swab(tmp));
 }
+EXPORT_SYMBOL(find_next_zero_le_bit);
 
-EXPORT_SYMBOL(generic_find_next_zero_le_bit);
-
-unsigned long generic_find_next_le_bit(const unsigned long *addr, unsigned
+unsigned long find_next_le_bit(const unsigned long *addr, unsigned
 		long size, unsigned long offset)
 {
 	const unsigned long *p = addr + BITOP_WORD(offset);
@@ -271,5 +270,5 @@ found_middle:
 found_middle_swap:
 	return result + __ffs(ext2_swab(tmp));
 }
-EXPORT_SYMBOL(generic_find_next_le_bit);
+EXPORT_SYMBOL(find_next_le_bit);
 #endif /* __BIG_ENDIAN */
net/rds/cong.c +3 -3
index 0871a29..c6784d5 100644
@@ -285,7 +285,7 @@ void rds_cong_set_bit(struct rds_cong_map *map, __be16 port)
 	i = be16_to_cpu(port) / RDS_CONG_MAP_PAGE_BITS;
 	off = be16_to_cpu(port) % RDS_CONG_MAP_PAGE_BITS;
 
-	generic___set_le_bit(off, (void *)map->m_page_addrs[i]);
+	__set_le_bit(off, (void *)map->m_page_addrs[i]);
 }
 
 void rds_cong_clear_bit(struct rds_cong_map *map, __be16 port)
@@ -299,7 +299,7 @@ void rds_cong_clear_bit(struct rds_cong_map *map, __be16 port)
 	i = be16_to_cpu(port) / RDS_CONG_MAP_PAGE_BITS;
 	off = be16_to_cpu(port) % RDS_CONG_MAP_PAGE_BITS;
 
-	generic___clear_le_bit(off, (void *)map->m_page_addrs[i]);
+	__clear_le_bit(off, (void *)map->m_page_addrs[i]);
 }
 
 static int rds_cong_test_bit(struct rds_cong_map *map, __be16 port)
@@ -310,7 +310,7 @@ static int rds_cong_test_bit(struct rds_cong_map *map, __be16 port)
 	i = be16_to_cpu(port) / RDS_CONG_MAP_PAGE_BITS;
 	off = be16_to_cpu(port) % RDS_CONG_MAP_PAGE_BITS;
 
-	return generic_test_le_bit(off, (void *)map->m_page_addrs[i]);
+	return test_le_bit(off, (void *)map->m_page_addrs[i]);
 }
 
 void rds_cong_add_socket(struct rds_sock *rs)
virt/kvm/kvm_main.c +1 -1
index 5186e72..2d9927c 100644
@@ -1208,7 +1208,7 @@ void mark_page_dirty(struct kvm *kvm, gfn_t gfn)
 	if (memslot && memslot->dirty_bitmap) {
 		unsigned long rel_gfn = gfn - memslot->base_gfn;
 
-		generic___set_le_bit(rel_gfn, memslot->dirty_bitmap);
+		__set_le_bit(rel_gfn, memslot->dirty_bitmap);
 	}
 }
 
Signature · 1 line
1.7.1.231.gd0b16
#7 lore raw

PATCH v2 2/22 bitops: rename generic little-endian bitops functions

In reply to a message not in the archive

As a preparation for providing little-endian bitops for all architectures, This removes generic_ prefix from little-endian bitops function names in asm-generic/bitops/le.h.

s/generic_find_next_le_bit/find_next_le_bit/ s/generic_find_next_zero_le_bit/find_next_zero_le_bit/ s/generic_find_first_zero_le_bit/find_first_zero_le_bit/ s/generic___test_and_set_le_bit/__test_and_set_le_bit/ s/generic___test_and_clear_le_bit/__test_and_clear_le_bit/ s/generic_test_le_bit/test_le_bit/ s/generic___set_le_bit/__set_le_bit/ s/generic___clear_le_bit/__clear_le_bit/ s/generic_test_and_set_le_bit/test_and_set_le_bit/ s/generic_test_and_clear_le_bit/test_and_clear_le_bit/

Cc Hans-Christian Egtvedt <[email protected]>
Cc Geert Uytterhoeven <[email protected]>
Cc Roman Zippel <[email protected]>
Cc Andreas Schwab <[email protected]>
Cc Greg Ungerer <[email protected]>
Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Andy Grover <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Avi Kivity <[email protected]>
Cc Marcelo Tosatti <[email protected]>

---
No change from previous submission

 arch/avr32/kernel/avr32_ksyms.c              |    4 ++--
 arch/avr32/lib/findbit.S                     |    4 ++--
 arch/m68k/include/asm/bitops_mm.h            |    8 ++++----
 arch/m68k/include/asm/bitops_no.h            |    2 +-
 arch/powerpc/include/asm/bitops.h            |   11 ++++++-----
 include/asm-generic/bitops/ext2-non-atomic.h |   12 ++++++------
 include/asm-generic/bitops/le.h              |   26 +++++++++++++-------------
 include/asm-generic/bitops/minix-le.h        |   10 +++++-----
 lib/find_next_bit.c                          |    9 ++++-----
 net/rds/cong.c                               |    6 +++---
 virt/kvm/kvm_main.c                          |    2 +-
 11 files changed, 47 insertions(+), 47 deletions(-)
arch/avr32/kernel/avr32_ksyms.c +2 -2
index 11e310c..c63b943 100644
@@ -58,8 +58,8 @@ EXPORT_SYMBOL(find_first_zero_bit);
 EXPORT_SYMBOL(find_next_zero_bit);
 EXPORT_SYMBOL(find_first_bit);
 EXPORT_SYMBOL(find_next_bit);
-EXPORT_SYMBOL(generic_find_next_le_bit);
-EXPORT_SYMBOL(generic_find_next_zero_le_bit);
+EXPORT_SYMBOL(find_next_le_bit);
+EXPORT_SYMBOL(find_next_zero_le_bit);
 
 /* I/O primitives (lib/io-*.S) */
 EXPORT_SYMBOL(__raw_readsb);
arch/avr32/lib/findbit.S +2 -2
index 997b33b..6880d85 100644
@@ -123,7 +123,7 @@ ENTRY(find_next_bit)
 	brgt	1b
 	retal	r11
 
-ENTRY(generic_find_next_le_bit)
+ENTRY(find_next_le_bit)
 	lsr	r8, r10, 5
 	sub	r9, r11, r10
 	retle	r11
@@ -153,7 +153,7 @@ ENTRY(generic_find_next_le_bit)
 	brgt	1b
 	retal	r11
 
-ENTRY(generic_find_next_zero_le_bit)
+ENTRY(find_next_zero_le_bit)
 	lsr	r8, r10, 5
 	sub	r9, r11, r10
 	retle	r11
arch/m68k/include/asm/bitops_mm.h +4 -4
index b4ecdaa..f1010ab 100644
@@ -366,9 +366,9 @@ static inline int minix_test_bit(int nr, const void *vaddr)
 #define ext2_clear_bit(nr, addr)		__test_and_clear_bit((nr) ^ 24, (unsigned long *)(addr))
 #define ext2_clear_bit_atomic(lock, nr, addr)	test_and_clear_bit((nr) ^ 24, (unsigned long *)(addr))
 #define ext2_find_next_zero_bit(addr, size, offset) \
-	generic_find_next_zero_le_bit((unsigned long *)addr, size, offset)
+	find_next_zero_le_bit((unsigned long *)addr, size, offset)
 #define ext2_find_next_bit(addr, size, offset) \
-	generic_find_next_le_bit((unsigned long *)addr, size, offset)
+	find_next_le_bit((unsigned long *)addr, size, offset)
 
 static inline int ext2_test_bit(int nr, const void *vaddr)
 {
@@ -398,7 +398,7 @@ static inline int ext2_find_first_zero_bit(const void *vaddr, unsigned size)
 	return (p - addr) * 32 + res;
 }
 
-static inline unsigned long generic_find_next_zero_le_bit(const unsigned long *addr,
+static inline unsigned long find_next_zero_le_bit(const unsigned long *addr,
 		unsigned long size, unsigned long offset)
 {
 	const unsigned long *p = addr + (offset >> 5);
@@ -440,7 +440,7 @@ static inline int ext2_find_first_bit(const void *vaddr, unsigned size)
 	return (p - addr) * 32 + res;
 }
 
-static inline unsigned long generic_find_next_le_bit(const unsigned long *addr,
+static inline unsigned long find_next_le_bit(const unsigned long *addr,
 		unsigned long size, unsigned long offset)
 {
 	const unsigned long *p = addr + (offset >> 5);
arch/m68k/include/asm/bitops_no.h +1 -1
index 9d3cbe5..292e1ce 100644
@@ -325,7 +325,7 @@ found_middle:
 }
 
 #define ext2_find_next_bit(addr, size, off) \
-	generic_find_next_le_bit((unsigned long *)(addr), (size), (off))
+	find_next_le_bit((unsigned long *)(addr), (size), (off))
 #include <asm-generic/bitops/minix.h>
 
 #endif /* __KERNEL__ */
arch/powerpc/include/asm/bitops.h +6 -5
index 30964ae..b4f3f84 100644
@@ -294,11 +294,12 @@ static __inline__ int test_le_bit(unsigned long nr,
 #define __test_and_clear_le_bit(nr, addr) \
 	__test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
 
-#define find_first_zero_le_bit(addr, size) generic_find_next_zero_le_bit((addr), (size), 0)
-unsigned long generic_find_next_zero_le_bit(const unsigned long *addr,
+#define find_first_zero_le_bit(addr, size) \
+	find_next_zero_le_bit((addr), (size), 0)
+unsigned long find_next_zero_le_bit(const unsigned long *addr,
 				    unsigned long size, unsigned long offset);
 
-unsigned long generic_find_next_le_bit(const unsigned long *addr,
+unsigned long find_next_le_bit(const unsigned long *addr,
 				    unsigned long size, unsigned long offset);
 /* Bitmap functions for the ext2 filesystem */
 
@@ -317,10 +318,10 @@ unsigned long generic_find_next_le_bit(const unsigned long *addr,
 #define ext2_find_first_zero_bit(addr, size) \
 	find_first_zero_le_bit((unsigned long*)addr, size)
 #define ext2_find_next_zero_bit(addr, size, off) \
-	generic_find_next_zero_le_bit((unsigned long*)addr, size, off)
+	find_next_zero_le_bit((unsigned long *)addr, size, off)
 
 #define ext2_find_next_bit(addr, size, off) \
-	generic_find_next_le_bit((unsigned long *)addr, size, off)
+	find_next_le_bit((unsigned long *)addr, size, off)
 /* Bitmap functions for the minix filesystem.  */
 
 #define minix_test_and_set_bit(nr,addr) \
include/asm-generic/bitops/ext2-non-atomic.h +6 -6
index 63cf822..9c7bb9a 100644
@@ -4,17 +4,17 @@
 #include <asm-generic/bitops/le.h>
 
 #define ext2_set_bit(nr,addr)	\
-	generic___test_and_set_le_bit((nr),(unsigned long *)(addr))
+	__test_and_set_le_bit((nr), (unsigned long *)(addr))
 #define ext2_clear_bit(nr,addr)	\
-	generic___test_and_clear_le_bit((nr),(unsigned long *)(addr))
+	__test_and_clear_le_bit((nr), (unsigned long *)(addr))
 
 #define ext2_test_bit(nr,addr)	\
-	generic_test_le_bit((nr),(unsigned long *)(addr))
+	test_le_bit((nr), (unsigned long *)(addr))
 #define ext2_find_first_zero_bit(addr, size) \
-	generic_find_first_zero_le_bit((unsigned long *)(addr), (size))
+	find_first_zero_le_bit((unsigned long *)(addr), (size))
 #define ext2_find_next_zero_bit(addr, size, off) \
-	generic_find_next_zero_le_bit((unsigned long *)(addr), (size), (off))
+	find_next_zero_le_bit((unsigned long *)(addr), (size), (off))
 #define ext2_find_next_bit(addr, size, off) \
-	generic_find_next_le_bit((unsigned long *)(addr), (size), (off))
+	find_next_le_bit((unsigned long *)(addr), (size), (off))
 
 #endif /* _ASM_GENERIC_BITOPS_EXT2_NON_ATOMIC_H_ */
include/asm-generic/bitops/le.h +13 -13
index db2be81..6ad46ce 100644
@@ -8,42 +8,42 @@
 
 #define BITOP_LE_SWIZZLE	0
 
-#define generic_find_next_zero_le_bit(addr, size, offset) \
+#define find_next_zero_le_bit(addr, size, offset) \
 	find_next_zero_bit(addr, size, offset)
-#define generic_find_next_le_bit(addr, size, offset) \
+#define find_next_le_bit(addr, size, offset) \
 	find_next_bit(addr, size, offset)
 
 #elif defined(__BIG_ENDIAN)
 
 #define BITOP_LE_SWIZZLE	((BITS_PER_LONG-1) & ~0x7)
 
-extern unsigned long generic_find_next_zero_le_bit(const unsigned long *addr,
+extern unsigned long find_next_zero_le_bit(const unsigned long *addr,
 		unsigned long size, unsigned long offset);
-extern unsigned long generic_find_next_le_bit(const unsigned long *addr,
+extern unsigned long find_next_le_bit(const unsigned long *addr,
 		unsigned long size, unsigned long offset);
 
 #else
 #error "Please fix <asm/byteorder.h>"
 #endif
 
-#define generic_test_le_bit(nr, addr) \
+#define test_le_bit(nr, addr) \
 	test_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
-#define generic___set_le_bit(nr, addr) \
+#define __set_le_bit(nr, addr) \
 	__set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
-#define generic___clear_le_bit(nr, addr) \
+#define __clear_le_bit(nr, addr) \
 	__clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
 
-#define generic_test_and_set_le_bit(nr, addr) \
+#define test_and_set_le_bit(nr, addr) \
 	test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
-#define generic_test_and_clear_le_bit(nr, addr) \
+#define test_and_clear_le_bit(nr, addr) \
 	test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
 
-#define generic___test_and_set_le_bit(nr, addr) \
+#define __test_and_set_le_bit(nr, addr) \
 	__test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
-#define generic___test_and_clear_le_bit(nr, addr) \
+#define __test_and_clear_le_bit(nr, addr) \
 	__test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
 
-#define generic_find_first_zero_le_bit(addr, size) \
-        generic_find_next_zero_le_bit((addr), (size), 0)
+#define find_first_zero_le_bit(addr, size) \
+	find_next_zero_le_bit((addr), (size), 0)
 
 #endif /* _ASM_GENERIC_BITOPS_LE_H_ */
include/asm-generic/bitops/minix-le.h +5 -5
index 4a981c1..ed0ae09 100644
@@ -4,14 +4,14 @@
 #include <asm-generic/bitops/le.h>
 
 #define minix_test_and_set_bit(nr,addr)	\
-	generic___test_and_set_le_bit((nr),(unsigned long *)(addr))
+	__test_and_set_le_bit((nr), (unsigned long *)(addr))
 #define minix_set_bit(nr,addr)		\
-	generic___set_le_bit((nr),(unsigned long *)(addr))
+	__set_le_bit((nr), (unsigned long *)(addr))
 #define minix_test_and_clear_bit(nr,addr) \
-	generic___test_and_clear_le_bit((nr),(unsigned long *)(addr))
+	__test_and_clear_le_bit((nr), (unsigned long *)(addr))
 #define minix_test_bit(nr,addr)		\
-	generic_test_le_bit((nr),(unsigned long *)(addr))
+	test_le_bit((nr), (unsigned long *)(addr))
 #define minix_find_first_zero_bit(addr,size) \
-	generic_find_first_zero_le_bit((unsigned long *)(addr),(size))
+	find_first_zero_le_bit((unsigned long *)(addr), (size))
 
 #endif /* _ASM_GENERIC_BITOPS_MINIX_LE_H_ */
lib/find_next_bit.c +4 -5
index 24c59de..eb8934b 100644
@@ -185,7 +185,7 @@ static inline unsigned long ext2_swab(const unsigned long y)
 #endif
 }
 
-unsigned long generic_find_next_zero_le_bit(const unsigned long *addr, unsigned
+unsigned long find_next_zero_le_bit(const unsigned long *addr, unsigned
 		long size, unsigned long offset)
 {
 	const unsigned long *p = addr + BITOP_WORD(offset);
@@ -226,10 +226,9 @@ found_middle:
 found_middle_swap:
 	return result + ffz(ext2_swab(tmp));
 }
+EXPORT_SYMBOL(find_next_zero_le_bit);
 
-EXPORT_SYMBOL(generic_find_next_zero_le_bit);
-
-unsigned long generic_find_next_le_bit(const unsigned long *addr, unsigned
+unsigned long find_next_le_bit(const unsigned long *addr, unsigned
 		long size, unsigned long offset)
 {
 	const unsigned long *p = addr + BITOP_WORD(offset);
@@ -271,5 +270,5 @@ found_middle:
 found_middle_swap:
 	return result + __ffs(ext2_swab(tmp));
 }
-EXPORT_SYMBOL(generic_find_next_le_bit);
+EXPORT_SYMBOL(find_next_le_bit);
 #endif /* __BIG_ENDIAN */
net/rds/cong.c +3 -3
index 0871a29..c6784d5 100644
@@ -285,7 +285,7 @@ void rds_cong_set_bit(struct rds_cong_map *map, __be16 port)
 	i = be16_to_cpu(port) / RDS_CONG_MAP_PAGE_BITS;
 	off = be16_to_cpu(port) % RDS_CONG_MAP_PAGE_BITS;
 
-	generic___set_le_bit(off, (void *)map->m_page_addrs[i]);
+	__set_le_bit(off, (void *)map->m_page_addrs[i]);
 }
 
 void rds_cong_clear_bit(struct rds_cong_map *map, __be16 port)
@@ -299,7 +299,7 @@ void rds_cong_clear_bit(struct rds_cong_map *map, __be16 port)
 	i = be16_to_cpu(port) / RDS_CONG_MAP_PAGE_BITS;
 	off = be16_to_cpu(port) % RDS_CONG_MAP_PAGE_BITS;
 
-	generic___clear_le_bit(off, (void *)map->m_page_addrs[i]);
+	__clear_le_bit(off, (void *)map->m_page_addrs[i]);
 }
 
 static int rds_cong_test_bit(struct rds_cong_map *map, __be16 port)
@@ -310,7 +310,7 @@ static int rds_cong_test_bit(struct rds_cong_map *map, __be16 port)
 	i = be16_to_cpu(port) / RDS_CONG_MAP_PAGE_BITS;
 	off = be16_to_cpu(port) % RDS_CONG_MAP_PAGE_BITS;
 
-	return generic_test_le_bit(off, (void *)map->m_page_addrs[i]);
+	return test_le_bit(off, (void *)map->m_page_addrs[i]);
 }
 
 void rds_cong_add_socket(struct rds_sock *rs)
virt/kvm/kvm_main.c +1 -1
index 5186e72..2d9927c 100644
@@ -1208,7 +1208,7 @@ void mark_page_dirty(struct kvm *kvm, gfn_t gfn)
 	if (memslot && memslot->dirty_bitmap) {
 		unsigned long rel_gfn = gfn - memslot->base_gfn;
 
-		generic___set_le_bit(rel_gfn, memslot->dirty_bitmap);
+		__set_le_bit(rel_gfn, memslot->dirty_bitmap);
 	}
 }
 
Signature · 1 line
1.7.1.231.gd0b16
#8 lore raw

PATCH v2 3/22 s390: introduce little-endian bitops

In reply to a message not in the archive

Introduce little-endian bit operations by renaming native ext2 bit operations. The ext2 bit operations are kept as wrapper macros using little-endian bit operations to maintain bisectability until the conversions are finished.

---
Change from v1: fix argument of test_and_{set,clear}_le_bit()

 arch/s390/include/asm/bitops.h |   59 +++++++++++++++++++++++++++------------
 1 files changed, 41 insertions(+), 18 deletions(-)
arch/s390/include/asm/bitops.h +41 -18
index 2e05972..e10b81e 100644
@@ -742,18 +742,22 @@ static inline int sched_find_first_bit(unsigned long *b)
  *    23 22 21 20 19 18 17 16 31 30 29 28 27 26 25 24
  */
 
-#define ext2_set_bit(nr, addr)       \
-	__test_and_set_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)
-#define ext2_set_bit_atomic(lock, nr, addr)       \
-	test_and_set_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)
-#define ext2_clear_bit(nr, addr)     \
-	__test_and_clear_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)
-#define ext2_clear_bit_atomic(lock, nr, addr)     \
-	test_and_clear_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)
-#define ext2_test_bit(nr, addr)      \
-	test_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)
-
-static inline int ext2_find_first_zero_bit(void *vaddr, unsigned int size)
+#define __set_le_bit(nr, addr)	\
+	__set_bit((nr)^(__BITOPS_WORDSIZE - 8), (addr))
+#define __clear_le_bit(nr, addr)	\
+	__clear_bit((nr)^(__BITOPS_WORDSIZE - 8), (addr))
+#define __test_and_set_le_bit(nr, addr)	\
+	__test_and_set_bit((nr)^(__BITOPS_WORDSIZE - 8), (addr))
+#define test_and_set_le_bit(nr, addr)	\
+	test_and_set_bit((nr)^(__BITOPS_WORDSIZE - 8), (addr))
+#define __test_and_clear_le_bit(nr, addr)	\
+	__test_and_clear_bit((nr)^(__BITOPS_WORDSIZE - 8), (addr))
+#define test_and_clear_le_bit(nr, addr)	\
+	test_and_clear_bit((nr)^(__BITOPS_WORDSIZE - 8), (addr))
+#define test_le_bit(nr, addr)	\
+	test_bit((nr)^(__BITOPS_WORDSIZE - 8), (addr))
+
+static inline int find_first_zero_le_bit(void *vaddr, unsigned int size)
 {
 	unsigned long bytes, bits;
 
@@ -764,7 +768,7 @@ static inline int ext2_find_first_zero_bit(void *vaddr, unsigned int size)
 	return (bits < size) ? bits : size;
 }
 
-static inline int ext2_find_next_zero_bit(void *vaddr, unsigned long size,
+static inline int find_next_zero_le_bit(void *vaddr, unsigned long size,
 					  unsigned long offset)
 {
         unsigned long *addr = vaddr, *p;
@@ -790,11 +794,10 @@ static inline int ext2_find_next_zero_bit(void *vaddr, unsigned long size,
 		size -= __BITOPS_WORDSIZE;
 		p++;
         }
-	return offset + ext2_find_first_zero_bit(p, size);
+	return offset + find_first_zero_le_bit(p, size);
 }
 
-static inline unsigned long ext2_find_first_bit(void *vaddr,
-						unsigned long size)
+static inline unsigned long find_first_le_bit(void *vaddr, unsigned long size)
 {
 	unsigned long bytes, bits;
 
@@ -805,7 +808,7 @@ static inline unsigned long ext2_find_first_bit(void *vaddr,
 	return (bits < size) ? bits : size;
 }
 
-static inline int ext2_find_next_bit(void *vaddr, unsigned long size,
+static inline int find_next_le_bit(void *vaddr, unsigned long size,
 				     unsigned long offset)
 {
 	unsigned long *addr = vaddr, *p;
@@ -831,9 +834,29 @@ static inline int ext2_find_next_bit(void *vaddr, unsigned long size,
 		size -= __BITOPS_WORDSIZE;
 		p++;
 	}
-	return offset + ext2_find_first_bit(p, size);
+	return offset + find_first_le_bit(p, size);
 }
 
+#define ext2_set_bit(nr, addr)       \
+	__test_and_set_le_bit((nr), (unsigned long *)(addr))
+#define ext2_set_bit_atomic(lock, nr, addr)       \
+	test_and_set_le_bit((nr), (unsigned long *)(addr))
+#define ext2_clear_bit(nr, addr)     \
+	__test_and_clear_le_bit((nr), (unsigned long *)(addr))
+#define ext2_clear_bit_atomic(lock, nr, addr)     \
+	test_and_clear_le_bit((nr), (unsigned long *)(addr))
+#define ext2_test_bit(nr, addr)      \
+	test_le_bit((nr), (unsigned long *)(addr))
+
+#define ext2_find_first_zero_bit(vaddr, size)	\
+	find_first_zero_le_bit((unsigned long *)(vaddr), (size))
+#define ext2_find_next_zero_bit(vaddr, size, offset)	\
+	find_next_zero_le_bit((unsigned long *)(vaddr), (size), (offset))
+#define ext2_find_first_bit(vaddr, size)	\
+	find_first_le_bit((unsigned long *)(vaddr), (size))
+#define ext2_find_next_bit(vaddr, size, offset)	\
+	find_next_le_bit((unsigned long *)(vaddr), (size), (offset))
+
 #include <asm-generic/bitops/minix.h>
 
 #endif /* __KERNEL__ */
Signature · 1 line
1.7.1.231.gd0b16
#10 lore raw

PATCH v2 4/22 arm: introduce little-endian bitops

In reply to a message not in the archive

Introduce little-endian bit operations by renaming native ext2 bit operations. The ext2 bit operations are kept as wrapper macros using little-endian bit operations to maintain bisectability until the conversions are finished.

---
Change from v1: fix argument of test_and_{set,clear}_le_bit()

 arch/arm/include/asm/bitops.h |   46 +++++++++++++++++++++++++++++-----------
 1 files changed, 33 insertions(+), 13 deletions(-)
arch/arm/include/asm/bitops.h +33 -13
index 338ff19..29adaca 100644
@@ -303,41 +303,61 @@ static inline int fls(int x)
 #include <asm-generic/bitops/hweight.h>
 #include <asm-generic/bitops/lock.h>
 
+#define __set_le_bit(nr, p)			\
+	__set_bit(WORD_BITOFF_TO_LE(nr), (p))
+#define __clear_le_bit(nr, p)			\
+	__clear_bit(WORD_BITOFF_TO_LE(nr), (p))
+#define __test_and_set_le_bit(nr, p)			\
+		__test_and_set_bit(WORD_BITOFF_TO_LE(nr), (p))
+#define test_and_set_le_bit(nr, p)          \
+		test_and_set_bit(WORD_BITOFF_TO_LE(nr), (p))
+#define __test_and_clear_le_bit(nr, p)			\
+		__test_and_clear_bit(WORD_BITOFF_TO_LE(nr), (p))
+#define test_and_clear_le_bit(nr, p)	\
+		test_and_clear_bit(WORD_BITOFF_TO_LE(nr), (p))
+#define test_le_bit(nr, p)			\
+		test_bit(WORD_BITOFF_TO_LE(nr), (p))
+#define find_first_zero_le_bit(p, sz)		\
+		_find_first_zero_bit_le(p, sz)
+#define find_next_zero_le_bit(p, sz, off)	\
+		_find_next_zero_bit_le(p, sz, off)
+#define find_next_le_bit(p, sz, off) \
+		_find_next_bit_le(p, sz, off)
 /*
  * Ext2 is defined to use little-endian byte ordering.
  * These do not need to be atomic.
  */
 #define ext2_set_bit(nr,p)			\
-		__test_and_set_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
+		__test_and_set_le_bit(nr, (unsigned long *)(p))
 #define ext2_set_bit_atomic(lock,nr,p)          \
-                test_and_set_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
+		test_and_set_le_bit(nr, (unsigned long *)(p))
 #define ext2_clear_bit(nr,p)			\
-		__test_and_clear_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
+		__test_and_clear_le_bit(nr, (unsigned long *)(p))
 #define ext2_clear_bit_atomic(lock,nr,p)        \
-                test_and_clear_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
+		test_and_clear_le_bit(nr, (unsigned long *)(p))
 #define ext2_test_bit(nr,p)			\
-		test_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
+		test_le_bit(nr, (unsigned long *)(p))
 #define ext2_find_first_zero_bit(p,sz)		\
-		_find_first_zero_bit_le(p,sz)
+		find_first_zero_le_bit((unsigned long *)(p), sz)
 #define ext2_find_next_zero_bit(p,sz,off)	\
-		_find_next_zero_bit_le(p,sz,off)
+		find_next_zero_le_bit((unsigned long *)(p), sz, off)
 #define ext2_find_next_bit(p, sz, off) \
-		_find_next_bit_le(p, sz, off)
+		find_next_le_bit((unsigned long *)(p), sz, off)
 
 /*
  * Minix is defined to use little-endian byte ordering.
  * These do not need to be atomic.
  */
 #define minix_set_bit(nr,p)			\
-		__set_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
+		__set_le_bit(nr, (unsigned long *)(p))
 #define minix_test_bit(nr,p)			\
-		test_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
+		test_le_bit(nr, (unsigned long *)(p))
 #define minix_test_and_set_bit(nr,p)		\
-		__test_and_set_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
+		__test_and_set_le_bit(nr, (unsigned long *)(p))
 #define minix_test_and_clear_bit(nr,p)		\
-		__test_and_clear_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
+		__test_and_clear_le_bit(nr, (unsigned long *)(p))
 #define minix_find_first_zero_bit(p,sz)		\
-		_find_first_zero_bit_le(p,sz)
+		find_first_zero_le_bit((unsigned long *)(p), sz)
 
 #endif /* __KERNEL__ */
 
Signature · 1 line
1.7.1.231.gd0b16
#11 lore raw

PATCH v2 5/22 m68k: introduce little-endian bitops

In reply to a message not in the archive

Introduce little-endian bit operations by renaming native ext2 bit operations. The ext2 bit operations are kept as wrapper macros using little-endian bit operations to maintain bisectability until the conversions are finished.

Cc Geert Uytterhoeven <[email protected]>
Cc Roman Zippel <[email protected]>
Cc Andreas Schwab <[email protected]>

---
Change from v1: fix argument of test_and_{set,clear}_le_bit()

 arch/m68k/include/asm/bitops_mm.h |   64 +++++++++++++++++++++++++-----------
 1 files changed, 44 insertions(+), 20 deletions(-)
arch/m68k/include/asm/bitops_mm.h +44 -20
index f1010ab..7f15f80 100644
@@ -359,24 +359,28 @@ static inline int minix_test_bit(int nr, const void *vaddr)
 	return (p[nr >> 4] & (1U << (nr & 15))) != 0;
 }
 
-/* Bitmap functions for the ext2 filesystem. */
-
-#define ext2_set_bit(nr, addr)			__test_and_set_bit((nr) ^ 24, (unsigned long *)(addr))
-#define ext2_set_bit_atomic(lock, nr, addr)	test_and_set_bit((nr) ^ 24, (unsigned long *)(addr))
-#define ext2_clear_bit(nr, addr)		__test_and_clear_bit((nr) ^ 24, (unsigned long *)(addr))
-#define ext2_clear_bit_atomic(lock, nr, addr)	test_and_clear_bit((nr) ^ 24, (unsigned long *)(addr))
-#define ext2_find_next_zero_bit(addr, size, offset) \
-	find_next_zero_le_bit((unsigned long *)addr, size, offset)
-#define ext2_find_next_bit(addr, size, offset) \
-	find_next_le_bit((unsigned long *)addr, size, offset)
-
-static inline int ext2_test_bit(int nr, const void *vaddr)
+/* Bitmap functions for little endian. */
+
+#define __set_le_bit(nr, addr)	\
+	__set_bit((nr) ^ 24, (addr))
+#define __clear_le_bit(nr, addr)	\
+	__clear_bit((nr) ^ 24, (addr))
+#define __test_and_set_le_bit(nr, addr)	\
+	__test_and_set_bit((nr) ^ 24, (addr))
+#define test_and_set_le_bit(nr, addr)	\
+	test_and_set_bit((nr) ^ 24, (addr))
+#define __test_and_clear_le_bit(nr, addr)	\
+	__test_and_clear_bit((nr) ^ 24, (addr))
+#define test_and_clear_le_bit(nr, addr)	\
+	test_and_clear_bit((nr) ^ 24, (addr))
+
+static inline int test_le_bit(int nr, const void *vaddr)
 {
 	const unsigned char *p = vaddr;
 	return (p[nr >> 3] & (1U << (nr & 7))) != 0;
 }
 
-static inline int ext2_find_first_zero_bit(const void *vaddr, unsigned size)
+static inline int find_first_zero_le_bit(const void *vaddr, unsigned size)
 {
 	const unsigned long *p = vaddr, *addr = vaddr;
 	int res;
@@ -393,7 +397,7 @@ static inline int ext2_find_first_zero_bit(const void *vaddr, unsigned size)
 
 	--p;
 	for (res = 0; res < 32; res++)
-		if (!ext2_test_bit (res, p))
+		if (!test_le_bit(res, p))
 			break;
 	return (p - addr) * 32 + res;
 }
@@ -410,16 +414,16 @@ static inline unsigned long find_next_zero_le_bit(const unsigned long *addr,
 	if (bit) {
 		/* Look for zero in first longword */
 		for (res = bit; res < 32; res++)
-			if (!ext2_test_bit (res, p))
+			if (!test_le_bit(res, p))
 				return (p - addr) * 32 + res;
 		p++;
 	}
 	/* No zero yet, search remaining full bytes for a zero */
-	res = ext2_find_first_zero_bit (p, size - 32 * (p - addr));
+	res = find_first_zero_le_bit(p, size - 32 * (p - addr));
 	return (p - addr) * 32 + res;
 }
 
-static inline int ext2_find_first_bit(const void *vaddr, unsigned size)
+static inline int find_first_le_bit(const void *vaddr, unsigned size)
 {
 	const unsigned long *p = vaddr, *addr = vaddr;
 	int res;
@@ -435,7 +439,7 @@ static inline int ext2_find_first_bit(const void *vaddr, unsigned size)
 
 	--p;
 	for (res = 0; res < 32; res++)
-		if (ext2_test_bit(res, p))
+		if (test_le_bit(res, p))
 			break;
 	return (p - addr) * 32 + res;
 }
@@ -452,15 +456,35 @@ static inline unsigned long find_next_le_bit(const unsigned long *addr,
 	if (bit) {
 		/* Look for one in first longword */
 		for (res = bit; res < 32; res++)
-			if (ext2_test_bit(res, p))
+			if (test_le_bit(res, p))
 				return (p - addr) * 32 + res;
 		p++;
 	}
 	/* No set bit yet, search remaining full bytes for a set bit */
-	res = ext2_find_first_bit(p, size - 32 * (p - addr));
+	res = find_first_le_bit(p, size - 32 * (p - addr));
 	return (p - addr) * 32 + res;
 }
 
+/* Bitmap functions for the ext2 filesystem. */
+
+#define ext2_set_bit(nr, addr)	\
+	__test_and_set_le_bit(nr, (unsigned long *)(addr))
+#define ext2_set_bit_atomic(lock, nr, addr)	\
+	test_and_set_le_bit(nr, (unsigned long *)(addr))
+#define ext2_clear_bit(nr, addr)	\
+	__test_and_clear_le_bit(nr, (unsigned long *)(addr))
+#define ext2_clear_bit_atomic(lock, nr, addr)	\
+	test_and_clear_le_bit(nr, (unsigned long *)(addr))
+#define ext2_find_next_zero_bit(addr, size, offset) \
+	find_next_zero_le_bit((unsigned long *)(addr), size, offset)
+#define ext2_find_next_bit(addr, size, offset) \
+	find_next_le_bit((unsigned long *)(addr), size, offset)
+#define ext2_test_bit(nr, vaddr)	test_le_bit(nr, vaddr)
+#define ext2_find_first_zero_bit(vaddr, size)	\
+	find_first_zero_le_bit((unsigned long *)(vaddr), size)
+#define ext2_find_first_bit(vaddr, size)	\
+	find_first_le_bit((unsigned long *)(vaddr), size)
+
 #endif /* __KERNEL__ */
 
 #endif /* _M68K_BITOPS_H */
Signature · 1 line
1.7.1.231.gd0b16
#12 lore raw

PATCH v2 5/22 m68k: introduce little-endian bitops

In reply to a message not in the archive

Introduce little-endian bit operations by renaming native ext2 bit operations. The ext2 bit operations are kept as wrapper macros using little-endian bit operations to maintain bisectability until the conversions are finished.

Cc Geert Uytterhoeven <[email protected]>
Cc Roman Zippel <[email protected]>
Cc Andreas Schwab <[email protected]>

---
Change from v1: fix argument of test_and_{set,clear}_le_bit()

 arch/m68k/include/asm/bitops_mm.h |   64 +++++++++++++++++++++++++-----------
 1 files changed, 44 insertions(+), 20 deletions(-)
arch/m68k/include/asm/bitops_mm.h +44 -20
index f1010ab..7f15f80 100644
@@ -359,24 +359,28 @@ static inline int minix_test_bit(int nr, const void *vaddr)
 	return (p[nr >> 4] & (1U << (nr & 15))) != 0;
 }
 
-/* Bitmap functions for the ext2 filesystem. */
-
-#define ext2_set_bit(nr, addr)			__test_and_set_bit((nr) ^ 24, (unsigned long *)(addr))
-#define ext2_set_bit_atomic(lock, nr, addr)	test_and_set_bit((nr) ^ 24, (unsigned long *)(addr))
-#define ext2_clear_bit(nr, addr)		__test_and_clear_bit((nr) ^ 24, (unsigned long *)(addr))
-#define ext2_clear_bit_atomic(lock, nr, addr)	test_and_clear_bit((nr) ^ 24, (unsigned long *)(addr))
-#define ext2_find_next_zero_bit(addr, size, offset) \
-	find_next_zero_le_bit((unsigned long *)addr, size, offset)
-#define ext2_find_next_bit(addr, size, offset) \
-	find_next_le_bit((unsigned long *)addr, size, offset)
-
-static inline int ext2_test_bit(int nr, const void *vaddr)
+/* Bitmap functions for little endian. */
+
+#define __set_le_bit(nr, addr)	\
+	__set_bit((nr) ^ 24, (addr))
+#define __clear_le_bit(nr, addr)	\
+	__clear_bit((nr) ^ 24, (addr))
+#define __test_and_set_le_bit(nr, addr)	\
+	__test_and_set_bit((nr) ^ 24, (addr))
+#define test_and_set_le_bit(nr, addr)	\
+	test_and_set_bit((nr) ^ 24, (addr))
+#define __test_and_clear_le_bit(nr, addr)	\
+	__test_and_clear_bit((nr) ^ 24, (addr))
+#define test_and_clear_le_bit(nr, addr)	\
+	test_and_clear_bit((nr) ^ 24, (addr))
+
+static inline int test_le_bit(int nr, const void *vaddr)
 {
 	const unsigned char *p = vaddr;
 	return (p[nr >> 3] & (1U << (nr & 7))) != 0;
 }
 
-static inline int ext2_find_first_zero_bit(const void *vaddr, unsigned size)
+static inline int find_first_zero_le_bit(const void *vaddr, unsigned size)
 {
 	const unsigned long *p = vaddr, *addr = vaddr;
 	int res;
@@ -393,7 +397,7 @@ static inline int ext2_find_first_zero_bit(const void *vaddr, unsigned size)
 
 	--p;
 	for (res = 0; res < 32; res++)
-		if (!ext2_test_bit (res, p))
+		if (!test_le_bit(res, p))
 			break;
 	return (p - addr) * 32 + res;
 }
@@ -410,16 +414,16 @@ static inline unsigned long find_next_zero_le_bit(const unsigned long *addr,
 	if (bit) {
 		/* Look for zero in first longword */
 		for (res = bit; res < 32; res++)
-			if (!ext2_test_bit (res, p))
+			if (!test_le_bit(res, p))
 				return (p - addr) * 32 + res;
 		p++;
 	}
 	/* No zero yet, search remaining full bytes for a zero */
-	res = ext2_find_first_zero_bit (p, size - 32 * (p - addr));
+	res = find_first_zero_le_bit(p, size - 32 * (p - addr));
 	return (p - addr) * 32 + res;
 }
 
-static inline int ext2_find_first_bit(const void *vaddr, unsigned size)
+static inline int find_first_le_bit(const void *vaddr, unsigned size)
 {
 	const unsigned long *p = vaddr, *addr = vaddr;
 	int res;
@@ -435,7 +439,7 @@ static inline int ext2_find_first_bit(const void *vaddr, unsigned size)
 
 	--p;
 	for (res = 0; res < 32; res++)
-		if (ext2_test_bit(res, p))
+		if (test_le_bit(res, p))
 			break;
 	return (p - addr) * 32 + res;
 }
@@ -452,15 +456,35 @@ static inline unsigned long find_next_le_bit(const unsigned long *addr,
 	if (bit) {
 		/* Look for one in first longword */
 		for (res = bit; res < 32; res++)
-			if (ext2_test_bit(res, p))
+			if (test_le_bit(res, p))
 				return (p - addr) * 32 + res;
 		p++;
 	}
 	/* No set bit yet, search remaining full bytes for a set bit */
-	res = ext2_find_first_bit(p, size - 32 * (p - addr));
+	res = find_first_le_bit(p, size - 32 * (p - addr));
 	return (p - addr) * 32 + res;
 }
 
+/* Bitmap functions for the ext2 filesystem. */
+
+#define ext2_set_bit(nr, addr)	\
+	__test_and_set_le_bit(nr, (unsigned long *)(addr))
+#define ext2_set_bit_atomic(lock, nr, addr)	\
+	test_and_set_le_bit(nr, (unsigned long *)(addr))
+#define ext2_clear_bit(nr, addr)	\
+	__test_and_clear_le_bit(nr, (unsigned long *)(addr))
+#define ext2_clear_bit_atomic(lock, nr, addr)	\
+	test_and_clear_le_bit(nr, (unsigned long *)(addr))
+#define ext2_find_next_zero_bit(addr, size, offset) \
+	find_next_zero_le_bit((unsigned long *)(addr), size, offset)
+#define ext2_find_next_bit(addr, size, offset) \
+	find_next_le_bit((unsigned long *)(addr), size, offset)
+#define ext2_test_bit(nr, vaddr)	test_le_bit(nr, vaddr)
+#define ext2_find_first_zero_bit(vaddr, size)	\
+	find_first_zero_le_bit((unsigned long *)(vaddr), size)
+#define ext2_find_first_bit(vaddr, size)	\
+	find_first_le_bit((unsigned long *)(vaddr), size)
+
 #endif /* __KERNEL__ */
 
 #endif /* _M68K_BITOPS_H */
Signature · 1 line
1.7.1.231.gd0b16
#13 lore raw

PATCH v2 6/22 m68knommu: introduce little-endian bitops

In reply to a message not in the archive

Introduce little-endian bit operations by renaming native ext2 bit operations. The ext2 bit operations are kept as wrapper macros using little-endian bit operations to maintain bisectability until the conversions are finished.

Cc Greg Ungerer <[email protected]>
Cc Geert Uytterhoeven <[email protected]>
Cc Roman Zippel <[email protected]>
Cc Andreas Schwab <[email protected]>

---
No change from previous submission

 arch/m68k/include/asm/bitops_no.h |   40 +++++++++++++++++++++++++++++-------
 1 files changed, 32 insertions(+), 8 deletions(-)
arch/m68k/include/asm/bitops_no.h +32 -8
index 292e1ce..9f5eb02 100644
@@ -196,7 +196,15 @@ static __inline__ int __test_bit(int nr, const volatile unsigned long * addr)
 #include <asm-generic/bitops/hweight.h>
 #include <asm-generic/bitops/lock.h>
 
-static __inline__ int ext2_set_bit(int nr, volatile void * addr)
+#define BITOP_LE_SWIZZLE	((BITS_PER_LONG-1) & ~0x7)
+
+#define __set_le_bit(nr, addr) \
+	__set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
+
+#define __clear_le_bit(nr, addr) \
+	__clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
+
+static inline int __test_and_set_le_bit(int nr, volatile void *addr)
 {
 	char retval;
 
@@ -215,7 +223,7 @@ static __inline__ int ext2_set_bit(int nr, volatile void * addr)
 	return retval;
 }
 
-static __inline__ int ext2_clear_bit(int nr, volatile void * addr)
+static inline int __test_and_clear_le_bit(int nr, volatile void *addr)
 {
 	char retval;
 
@@ -238,7 +246,7 @@ static __inline__ int ext2_clear_bit(int nr, volatile void * addr)
 	({						\
 		int ret;				\
 		spin_lock(lock);			\
-		ret = ext2_set_bit((nr), (addr));	\
+		ret = __test_and_set_le_bit((nr), (addr));	\
 		spin_unlock(lock);			\
 		ret;					\
 	})
@@ -247,12 +255,12 @@ static __inline__ int ext2_clear_bit(int nr, volatile void * addr)
 	({						\
 		int ret;				\
 		spin_lock(lock);			\
-		ret = ext2_clear_bit((nr), (addr));	\
+		ret = __test_and_clear_le_bit((nr), (addr));	\
 		spin_unlock(lock);			\
 		ret;					\
 	})
 
-static __inline__ int ext2_test_bit(int nr, const volatile void * addr)
+static inline int test_le_bit(int nr, const volatile void *addr)
 {
 	char retval;
 
@@ -271,10 +279,10 @@ static __inline__ int ext2_test_bit(int nr, const volatile void * addr)
 	return retval;
 }
 
-#define ext2_find_first_zero_bit(addr, size) \
-        ext2_find_next_zero_bit((addr), (size), 0)
+#define find_first_zero_le_bit(addr, size)	\
+	find_next_zero_le_bit((addr), (size), 0)
 
-static __inline__ unsigned long ext2_find_next_zero_bit(void *addr, unsigned long size, unsigned long offset)
+static inline unsigned long find_next_zero_le_bit(void *addr, unsigned long size, unsigned long offset)
 {
 	unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
 	unsigned long result = offset & ~31UL;
@@ -324,8 +332,24 @@ found_middle:
 	return result + ffz(__swab32(tmp));
 }
 
+#define ext2_set_bit(nr, addr)	\
+	__test_and_set_le_bit(nr, addr)
+
+#define ext2_clear_bit(nr, addr)	\
+	test_and_clear_le_bit(nr, addr)
+
+#define ext2_test_bit(nr, addr)	\
+	test_le_bit(nr, addr)
+
+#define ext2_find_first_zero_bit(addr, size) \
+	find_first_zero_le_bit(addr, size)
+
+#define ext2_find_next_zero_bit(addr, size, offset)	\
+	find_next_zero_le_bit(addr, size, offset)
+
 #define ext2_find_next_bit(addr, size, off) \
 	find_next_le_bit((unsigned long *)(addr), (size), (off))
+
 #include <asm-generic/bitops/minix.h>
 
 #endif /* __KERNEL__ */
Signature · 1 line
1.7.1.231.gd0b16
#16 lore raw

PATCH v2 7/22 bitops: introduce little-endian bitops for most architectures

In reply to a message not in the archive

Introduce little-endian bit operations to the architectures which do not have native little-endian bit operations.
(alpha, avr32, blackfin, cris, frv, h8300, ia64, m32r, mips, mn10300, parisc, sh, sparc, tile, x86, xtensa)

These architectures can just include generic implementation (asm-generic/bitops/le.h).

---
No change from previous submission

 arch/alpha/include/asm/bitops.h              |    1 +
 arch/avr32/include/asm/bitops.h              |    1 +
 arch/blackfin/include/asm/bitops.h           |    1 +
 arch/cris/include/asm/bitops.h               |    1 +
 arch/frv/include/asm/bitops.h                |    1 +
 arch/h8300/include/asm/bitops.h              |    1 +
 arch/ia64/include/asm/bitops.h               |    1 +
 arch/m32r/include/asm/bitops.h               |    1 +
 arch/mips/include/asm/bitops.h               |    1 +
 arch/mn10300/include/asm/bitops.h            |    1 +
 arch/parisc/include/asm/bitops.h             |    1 +
 arch/sh/include/asm/bitops.h                 |    1 +
 arch/sparc/include/asm/bitops_32.h           |    1 +
 arch/sparc/include/asm/bitops_64.h           |    1 +
 arch/tile/include/asm/bitops.h               |    1 +
 arch/x86/include/asm/bitops.h                |    1 +
 arch/xtensa/include/asm/bitops.h             |    1 +
 include/asm-generic/bitops.h                 |    1 +
 include/asm-generic/bitops/ext2-non-atomic.h |    2 --
 include/asm-generic/bitops/minix-le.h        |    2 --
 20 files changed, 18 insertions(+), 4 deletions(-)
arch/alpha/include/asm/bitops.h +1 -0
index adfab8a..955fec7 100644
@@ -454,6 +454,7 @@ sched_find_first_bit(const unsigned long b[2])
 	return __ffs(tmp) + ofs;
 }
 
+#include <asm-generic/bitops/le.h>
 #include <asm-generic/bitops/ext2-non-atomic.h>
 
 #define ext2_set_bit_atomic(l,n,a)   test_and_set_bit(n,a)
arch/avr32/include/asm/bitops.h +1 -0
index f7dd5f7..1c482fc 100644
@@ -299,6 +299,7 @@ static inline int ffs(unsigned long word)
 #include <asm-generic/bitops/hweight.h>
 #include <asm-generic/bitops/lock.h>
 
+#include <asm-generic/bitops/le.h>
 #include <asm-generic/bitops/ext2-non-atomic.h>
 #include <asm-generic/bitops/ext2-atomic.h>
 #include <asm-generic/bitops/minix-le.h>
arch/blackfin/include/asm/bitops.h +1 -0
index 3f7ef4d..1261078 100644
@@ -25,6 +25,7 @@
 #include <asm-generic/bitops/const_hweight.h>
 #include <asm-generic/bitops/lock.h>
 
+#include <asm-generic/bitops/le.h>
 #include <asm-generic/bitops/ext2-non-atomic.h>
 #include <asm-generic/bitops/ext2-atomic.h>
 #include <asm-generic/bitops/minix.h>
arch/cris/include/asm/bitops.h +1 -0
index 9e69cfb..599ae67 100644
@@ -154,6 +154,7 @@ static inline int test_and_change_bit(int nr, volatile unsigned long *addr)
 #include <asm-generic/bitops/find.h>
 #include <asm-generic/bitops/lock.h>
 
+#include <asm-generic/bitops/le.h>
 #include <asm-generic/bitops/ext2-non-atomic.h>
 
 #define ext2_set_bit_atomic(l,n,a)   test_and_set_bit(n,a)
arch/frv/include/asm/bitops.h +1 -0
index 50ae91b..2631917 100644
@@ -401,6 +401,7 @@ int __ilog2_u64(u64 n)
 #include <asm-generic/bitops/hweight.h>
 #include <asm-generic/bitops/lock.h>
 
+#include <asm-generic/bitops/le.h>
 #include <asm-generic/bitops/ext2-non-atomic.h>
 
 #define ext2_set_bit_atomic(lock,nr,addr)	test_and_set_bit  ((nr) ^ 0x18, (addr))
arch/h8300/include/asm/bitops.h +1 -0
index cb9ddf5..763094f 100644
@@ -200,6 +200,7 @@ static __inline__ unsigned long __ffs(unsigned long word)
 #include <asm-generic/bitops/sched.h>
 #include <asm-generic/bitops/hweight.h>
 #include <asm-generic/bitops/lock.h>
+#include <asm-generic/bitops/le.h>
 #include <asm-generic/bitops/ext2-non-atomic.h>
 #include <asm-generic/bitops/ext2-atomic.h>
 #include <asm-generic/bitops/minix.h>
arch/ia64/include/asm/bitops.h +1 -0
index 9da3df6..2cde4f0 100644
@@ -456,6 +456,7 @@ static __inline__ unsigned long __arch_hweight64(unsigned long x)
 
 #ifdef __KERNEL__
 
+#include <asm-generic/bitops/le.h>
 #include <asm-generic/bitops/ext2-non-atomic.h>
 
 #define ext2_set_bit_atomic(l,n,a)	test_and_set_bit(n,a)
arch/m32r/include/asm/bitops.h +1 -0
index aaddf0d..681f7e8 100644
@@ -266,6 +266,7 @@ static __inline__ int test_and_change_bit(int nr, volatile void * addr)
 
 #ifdef __KERNEL__
 
+#include <asm-generic/bitops/le.h>
 #include <asm-generic/bitops/ext2-non-atomic.h>
 #include <asm-generic/bitops/ext2-atomic.h>
 #include <asm-generic/bitops/minix.h>
arch/mips/include/asm/bitops.h +1 -0
index b0ce7ca..4795820 100644
@@ -704,6 +704,7 @@ static inline int ffs(int word)
 #include <asm/arch_hweight.h>
 #include <asm-generic/bitops/const_hweight.h>
 
+#include <asm-generic/bitops/le.h>
 #include <asm-generic/bitops/ext2-non-atomic.h>
 #include <asm-generic/bitops/ext2-atomic.h>
 #include <asm-generic/bitops/minix.h>
arch/mn10300/include/asm/bitops.h +1 -0
index 3f50e96..4688c08 100644
@@ -233,6 +233,7 @@ int ffs(int x)
 #define ext2_clear_bit_atomic(lock, nr, addr) \
 	test_and_clear_bit((nr), (addr))
 
+#include <asm-generic/bitops/le.h>
 #include <asm-generic/bitops/ext2-non-atomic.h>
 #include <asm-generic/bitops/minix-le.h>
 
arch/parisc/include/asm/bitops.h +1 -0
index 7a6ea10..4b9e58d 100644
@@ -222,6 +222,7 @@ static __inline__ int fls(int x)
 
 #ifdef __KERNEL__
 
+#include <asm-generic/bitops/le.h>
 #include <asm-generic/bitops/ext2-non-atomic.h>
 
 /* '3' is bits per byte */
arch/sh/include/asm/bitops.h +1 -0
index 98511e4..9167810 100644
@@ -94,6 +94,7 @@ static inline unsigned long ffz(unsigned long word)
 #include <asm-generic/bitops/hweight.h>
 #include <asm-generic/bitops/lock.h>
 #include <asm-generic/bitops/sched.h>
+#include <asm-generic/bitops/le.h>
 #include <asm-generic/bitops/ext2-non-atomic.h>
 #include <asm-generic/bitops/ext2-atomic.h>
 #include <asm-generic/bitops/minix.h>
arch/sparc/include/asm/bitops_32.h +1 -0
index 9cf4ae0..5b3ab06 100644
@@ -103,6 +103,7 @@ static inline void change_bit(unsigned long nr, volatile unsigned long *addr)
 #include <asm-generic/bitops/hweight.h>
 #include <asm-generic/bitops/lock.h>
 #include <asm-generic/bitops/find.h>
+#include <asm-generic/bitops/le.h>
 #include <asm-generic/bitops/ext2-non-atomic.h>
 #include <asm-generic/bitops/ext2-atomic.h>
 #include <asm-generic/bitops/minix.h>
arch/sparc/include/asm/bitops_64.h +1 -0
index 766121a..9097862 100644
@@ -89,6 +89,7 @@ static inline unsigned int __arch_hweight8(unsigned int w)
 
 #ifdef __KERNEL__
 
+#include <asm-generic/bitops/le.h>
 #include <asm-generic/bitops/ext2-non-atomic.h>
 
 #define ext2_set_bit_atomic(lock,nr,addr) \
arch/tile/include/asm/bitops.h +1 -0
index 6d4f0ff..56b0355 100644
@@ -122,6 +122,7 @@ static inline unsigned long __arch_hweight64(__u64 w)
 #include <asm-generic/bitops/lock.h>
 #include <asm-generic/bitops/find.h>
 #include <asm-generic/bitops/sched.h>
+#include <asm-generic/bitops/le.h>
 #include <asm-generic/bitops/ext2-non-atomic.h>
 #include <asm-generic/bitops/minix.h>
 
arch/x86/include/asm/bitops.h +1 -0
index 903683b..c68bc10 100644
@@ -456,6 +456,7 @@ static inline int fls(int x)
 
 #ifdef __KERNEL__
 
+#include <asm-generic/bitops/le.h>
 #include <asm-generic/bitops/ext2-non-atomic.h>
 
 #define ext2_set_bit_atomic(lock, nr, addr)			\
arch/xtensa/include/asm/bitops.h +1 -0
index 6c39303..0475c11 100644
@@ -106,6 +106,7 @@ static inline unsigned long __fls(unsigned long word)
 
 #include <asm-generic/bitops/fls64.h>
 #include <asm-generic/bitops/find.h>
+#include <asm-generic/bitops/le.h>
 #include <asm-generic/bitops/ext2-non-atomic.h>
 
 #ifdef __XTENSA_EL__
include/asm-generic/bitops.h +1 -0
index a54f442..933710b 100644
@@ -38,6 +38,7 @@
 
 #include <asm-generic/bitops/atomic.h>
 #include <asm-generic/bitops/non-atomic.h>
+#include <asm-generic/bitops/le.h>
 #include <asm-generic/bitops/ext2-non-atomic.h>
 #include <asm-generic/bitops/ext2-atomic.h>
 #include <asm-generic/bitops/minix.h>
include/asm-generic/bitops/ext2-non-atomic.h +0 -2
index 9c7bb9a..c4639dd 100644
@@ -1,8 +1,6 @@
 #ifndef _ASM_GENERIC_BITOPS_EXT2_NON_ATOMIC_H_
 #define _ASM_GENERIC_BITOPS_EXT2_NON_ATOMIC_H_
 
-#include <asm-generic/bitops/le.h>
-
 #define ext2_set_bit(nr,addr)	\
 	__test_and_set_le_bit((nr), (unsigned long *)(addr))
 #define ext2_clear_bit(nr,addr)	\
include/asm-generic/bitops/minix-le.h +0 -2
index ed0ae09..f366cfa 100644
@@ -1,8 +1,6 @@
 #ifndef _ASM_GENERIC_BITOPS_MINIX_LE_H_
 #define _ASM_GENERIC_BITOPS_MINIX_LE_H_
 
-#include <asm-generic/bitops/le.h>
-
 #define minix_test_and_set_bit(nr,addr)	\
 	__test_and_set_le_bit((nr), (unsigned long *)(addr))
 #define minix_set_bit(nr,addr)		\
Signature · 1 line
1.7.1.231.gd0b16
#17 lore raw

PATCH v2 8/22 rds: stop including asm-generic/bitops/le.h

In reply to a message not in the archive

No need to include asm-generic/bitops/le.h as all architectures provide little-endian bit operations now.

---
No change from previous submission

 net/rds/cong.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
net/rds/cong.c +0 -2
index c6784d5..15a65f0 100644
@@ -34,8 +34,6 @@
 #include <linux/types.h>
 #include <linux/rbtree.h>
 
-#include <asm-generic/bitops/le.h>
-
 #include "rds.h"
 
 /*
Signature · 1 line
1.7.1.231.gd0b16
#18 lore raw

PATCH v2 9/22 kvm: stop including asm-generic/bitops/le.h

In reply to a message not in the archive

No need to include asm-generic/bitops/le.h as all architectures provide little-endian bit operations now.

---
No change from previous submission

 virt/kvm/kvm_main.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
virt/kvm/kvm_main.c +0 -1
index 2d9927c..e5d190f 100644
@@ -52,7 +52,6 @@
 #include <asm/io.h>
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
-#include <asm-generic/bitops/le.h>
 
 #include "coalesced_mmio.h"
 
Signature · 1 line
1.7.1.231.gd0b16
#19 lore raw

PATCH v2 10/22 asm-generic: use little-endian bitops

In reply to a message not in the archive

As a preparation for removing ext2 non-atomic bit operations from asm/bitops.h. This converts ext2 non-atomic bit operations to little-endian bit operations.

---
No change from previous submission

 include/asm-generic/bitops/ext2-atomic.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
include/asm-generic/bitops/ext2-atomic.h +2 -2
index ab1c875..bcf359f 100644
@@ -5,7 +5,7 @@
 	({						\
 		int ret;				\
 		spin_lock(lock);			\
-		ret = ext2_set_bit((nr), (unsigned long *)(addr)); \
+		ret = __test_and_set_le_bit((nr), (unsigned long *)(addr)); \
 		spin_unlock(lock);			\
 		ret;					\
 	})
@@ -14,7 +14,7 @@
 	({						\
 		int ret;				\
 		spin_lock(lock);			\
-		ret = ext2_clear_bit((nr), (unsigned long *)(addr)); \
+		ret = __test_and_clear_le_bit((nr), (unsigned long *)(addr)); \
 		spin_unlock(lock);			\
 		ret;					\
 	})
Signature · 1 line
1.7.1.231.gd0b16
#20 lore raw

PATCH v2 11/22 ext3: use little-endian bitops

In reply to a message not in the archive

As a preparation for removing ext2 non-atomic bit operations from asm/bitops.h. This converts ext2 non-atomic bit operations to little-endian bit operations.

---
No change from previous submission

 include/linux/ext3_fs.h |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)
include/linux/ext3_fs.h +10 -5
index 6ce1bca..34ef455 100644
@@ -418,13 +418,18 @@ struct ext3_inode {
 #define EXT2_MOUNT_DATA_FLAGS		EXT3_MOUNT_DATA_FLAGS
 #endif
 
-#define ext3_set_bit			ext2_set_bit
+#define ext3_set_bit(nr, addr)	\
+	__test_and_set_le_bit((nr), (unsigned long *)(addr))
 #define ext3_set_bit_atomic		ext2_set_bit_atomic
-#define ext3_clear_bit			ext2_clear_bit
+#define ext3_clear_bit(nr, addr)	\
+	__test_and_clear_le_bit((nr), (unsigned long *)(addr))
 #define ext3_clear_bit_atomic		ext2_clear_bit_atomic
-#define ext3_test_bit			ext2_test_bit
-#define ext3_find_first_zero_bit	ext2_find_first_zero_bit
-#define ext3_find_next_zero_bit		ext2_find_next_zero_bit
+#define ext3_test_bit(nr, addr)	\
+	test_le_bit((nr), (unsigned long *)(addr))
+#define ext3_find_first_zero_bit(addr, size)	\
+	find_first_zero_le_bit((unsigned long *)(addr), (size))
+#define ext3_find_next_zero_bit(addr, size, off)	\
+	find_next_zero_le_bit((unsigned long *)(addr), (size), (off))
 
 /*
  * Maximal mount counts between two filesystem checks
Signature · 1 line
1.7.1.231.gd0b16
#21 lore raw

PATCH v2 12/22 ext4: use little-endian bitops

In reply to a message not in the archive

As a preparation for removing ext2 non-atomic bit operations from asm/bitops.h. This converts ext2 non-atomic bit operations to little-endian bit operations.

Cc "Theodore Ts'o" <[email protected]>
Cc Andreas Dilger <[email protected]>

---
No change from previous submission

 fs/ext4/ext4.h |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)
fs/ext4/ext4.h +12 -6
index 889ec9d..821c11a 100644
@@ -895,14 +895,20 @@ struct ext4_inode_info {
 #define test_opt(sb, opt)		(EXT4_SB(sb)->s_mount_opt & \
 					 EXT4_MOUNT_##opt)
 
-#define ext4_set_bit			ext2_set_bit
+#define ext4_set_bit(nr, addr)	\
+	__test_and_set_le_bit((nr), (unsigned long *)(addr))
 #define ext4_set_bit_atomic		ext2_set_bit_atomic
-#define ext4_clear_bit			ext2_clear_bit
+#define ext4_clear_bit(nr, addr)	\
+	__test_and_clear_le_bit((nr), (unsigned long *)(addr))
 #define ext4_clear_bit_atomic		ext2_clear_bit_atomic
-#define ext4_test_bit			ext2_test_bit
-#define ext4_find_first_zero_bit	ext2_find_first_zero_bit
-#define ext4_find_next_zero_bit		ext2_find_next_zero_bit
-#define ext4_find_next_bit		ext2_find_next_bit
+#define ext4_test_bit(nr, addr)	\
+	test_le_bit((nr), (unsigned long *)(addr))
+#define ext4_find_first_zero_bit(addr, size)	\
+	find_first_zero_le_bit((unsigned long *)(addr), (size))
+#define ext4_find_next_zero_bit(addr, size, off)	\
+	find_next_zero_le_bit((unsigned long *)(addr), (size), (off))
+#define ext4_find_next_bit(addr, size, off)	\
+	find_next_le_bit((unsigned long *)(addr), (size), (off))
 
 /*
  * Maximal mount counts between two filesystem checks
Signature · 1 line
1.7.1.231.gd0b16
#22 lore raw

PATCH v2 13/22 ocfs2: use little-endian bitops

In reply to a message not in the archive

As a preparation for removing ext2 non-atomic bit operations from asm/bitops.h. This converts ext2 non-atomic bit operations to little-endian bit operations.

---
No change from previous submission

 fs/ocfs2/ocfs2.h |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
fs/ocfs2/ocfs2.h +8 -5
index c67003b..24b0cb0 100644
@@ -787,18 +787,21 @@ static inline unsigned int ocfs2_clusters_to_megabytes(struct super_block *sb,
 
 static inline void _ocfs2_set_bit(unsigned int bit, unsigned long *bitmap)
 {
-	ext2_set_bit(bit, bitmap);
+	__test_and_set_le_bit(bit, bitmap);
 }
 #define ocfs2_set_bit(bit, addr) _ocfs2_set_bit((bit), (unsigned long *)(addr))
 
 static inline void _ocfs2_clear_bit(unsigned int bit, unsigned long *bitmap)
 {
-	ext2_clear_bit(bit, bitmap);
+	__test_and_clear_le_bit(bit, bitmap);
 }
 #define ocfs2_clear_bit(bit, addr) _ocfs2_clear_bit((bit), (unsigned long *)(addr))
 
-#define ocfs2_test_bit ext2_test_bit
-#define ocfs2_find_next_zero_bit ext2_find_next_zero_bit
-#define ocfs2_find_next_bit ext2_find_next_bit
+#define ocfs2_test_bit(nr, addr)	\
+	test_le_bit(nr, (unsigned long *)(addr))
+#define ocfs2_find_next_zero_bit(addr, size, off)	\
+	find_next_zero_le_bit((unsigned long *)(addr), size, off)
+#define ocfs2_find_next_bit(addr, size, off)	\
+	find_next_le_bit((unsigned long *)(addr), size, off)
 #endif  /* OCFS2_H */
 
Signature · 1 line
1.7.1.231.gd0b16
#23 lore raw

PATCH v2 14/22 nilfs2: use little-endian bitops

In reply to a message not in the archive

As a preparation for removing ext2 non-atomic bit operations from asm/bitops.h. This converts ext2 non-atomic bit operations to little-endian bit operations.

---
No change from previous submission

 fs/nilfs2/alloc.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
fs/nilfs2/alloc.h +2 -1
index 9af34a7..a2463e2 100644
@@ -74,7 +74,8 @@ int nilfs_palloc_freev(struct inode *, __u64 *, size_t);
 
 #define nilfs_set_bit_atomic		ext2_set_bit_atomic
 #define nilfs_clear_bit_atomic		ext2_clear_bit_atomic
-#define nilfs_find_next_zero_bit	ext2_find_next_zero_bit
+#define nilfs_find_next_zero_bit(addr, size, off)	\
+	find_next_zero_le_bit((unsigned long *)(addr), (size), (off))
 
 /*
  * persistent object allocator cache
Signature · 1 line
1.7.1.231.gd0b16
#24 lore raw

PATCH v2 15/22 reiserfs: use little-endian bitops

In reply to a message not in the archive

As a preparation for removing ext2 non-atomic bit operations from asm/bitops.h. This converts ext2 non-atomic bit operations to little-endian bit operations.

---
No change from previous submission

 include/linux/reiserfs_fs.h |   34 ++++++++++++++++++++--------------
 1 files changed, 20 insertions(+), 14 deletions(-)
include/linux/reiserfs_fs.h +20 -14
index 91a4177..8d5f122 100644
@@ -1125,15 +1125,21 @@ struct reiserfs_de_head {
 #   define aligned_address(addr)           ((void *)((long)(addr) & ~((1UL << ADDR_UNALIGNED_BITS) - 1)))
 #   define unaligned_offset(addr)          (((int)((long)(addr) & ((1 << ADDR_UNALIGNED_BITS) - 1))) << 3)
 
-#   define set_bit_unaligned(nr, addr)     ext2_set_bit((nr) + unaligned_offset(addr), aligned_address(addr))
-#   define clear_bit_unaligned(nr, addr)   ext2_clear_bit((nr) + unaligned_offset(addr), aligned_address(addr))
-#   define test_bit_unaligned(nr, addr)    ext2_test_bit((nr) + unaligned_offset(addr), aligned_address(addr))
+#   define set_bit_unaligned(nr, addr)	\
+	__test_and_set_le_bit((nr) + unaligned_offset(addr), aligned_address(addr))
+#   define clear_bit_unaligned(nr, addr)	\
+	__test_and_clear_le_bit((nr) + unaligned_offset(addr), aligned_address(addr))
+#   define test_bit_unaligned(nr, addr)	\
+	test_le_bit((nr) + unaligned_offset(addr), aligned_address(addr))
 
 #else
 
-#   define set_bit_unaligned(nr, addr)     ext2_set_bit(nr, addr)
-#   define clear_bit_unaligned(nr, addr)   ext2_clear_bit(nr, addr)
-#   define test_bit_unaligned(nr, addr)    ext2_test_bit(nr, addr)
+#   define set_bit_unaligned(nr, addr)	\
+	__test_and_set_le_bit(nr, (unsigned long *)(addr))
+#   define clear_bit_unaligned(nr, addr)	\
+	__test_and_clear_le_bit(nr, (unsigned long *)(addr))
+#   define test_bit_unaligned(nr, addr)	\
+	test_le_bit(nr, (unsigned long *)(addr))
 
 #endif
 
@@ -2328,14 +2334,14 @@ __u32 keyed_hash(const signed char *msg, int len);
 __u32 yura_hash(const signed char *msg, int len);
 __u32 r5_hash(const signed char *msg, int len);
 
-/* the ext2 bit routines adjust for big or little endian as
-** appropriate for the arch, so in our laziness we use them rather
-** than using the bit routines they call more directly.  These
-** routines must be used when changing on disk bitmaps.  */
-#define reiserfs_test_and_set_le_bit   ext2_set_bit
-#define reiserfs_test_and_clear_le_bit ext2_clear_bit
-#define reiserfs_test_le_bit           ext2_test_bit
-#define reiserfs_find_next_zero_le_bit ext2_find_next_zero_bit
+#define reiserfs_test_and_set_le_bit(nr, addr)	\
+	__test_and_set_le_bit((nr), (unsigned long *)(addr))
+#define reiserfs_test_and_clear_le_bit(nr, addr)	\
+	__test_and_clear_le_bit((nr), (unsigned long *)(addr))
+#define reiserfs_test_le_bit(nr, addr)	\
+	test_le_bit((nr), (unsigned long *)(addr))
+#define reiserfs_find_next_zero_le_bit(addr, size, off)	\
+	find_next_zero_le_bit((unsigned long *)(addr), (size), (off))
 
 /* sometimes reiserfs_truncate may require to allocate few new blocks
    to perform indirect2direct conversion. People probably used to
Signature · 1 line
1.7.1.231.gd0b16
#25 lore raw

PATCH v2 16/22 udf: use little-endian bitops

In reply to a message not in the archive

As a preparation for removing ext2 non-atomic bit operations from asm/bitops.h. This converts ext2 non-atomic bit operations to little-endian bit operations.

---
No change from previous submission

 fs/udf/balloc.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
fs/udf/balloc.c +7 -4
index b608efa..e55aff9 100644
@@ -27,11 +27,14 @@
 #include "udf_i.h"
 #include "udf_sb.h"
 
-#define udf_clear_bit(nr, addr) ext2_clear_bit(nr, addr)
-#define udf_set_bit(nr, addr) ext2_set_bit(nr, addr)
-#define udf_test_bit(nr, addr) ext2_test_bit(nr, addr)
+#define udf_clear_bit(nr, addr)	\
+	__test_and_clear_le_bit(nr, (unsigned long *)(addr))
+#define udf_set_bit(nr, addr)	\
+	__test_and_set_le_bit(nr, (unsigned long *)(addr))
+#define udf_test_bit(nr, addr)	\
+	test_le_bit(nr, (unsigned long *)(addr))
 #define udf_find_next_one_bit(addr, size, offset) \
-		ext2_find_next_bit(addr, size, offset)
+	find_next_le_bit((unsigned long *)(addr), size, offset)
 
 static int read_block_bitmap(struct super_block *sb,
 			     struct udf_bitmap *bitmap, unsigned int block,
Signature · 1 line
1.7.1.231.gd0b16
#27 lore raw

PATCH v2 18/22 md: use little-endian bit operations

In reply to a message not in the archive

As a preparation for removing ext2 non-atomic bit operations from asm/bitops.h. This converts ext2 non-atomic bit operations to little-endian bit operations.

---
No change from previous submission

 drivers/md/bitmap.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/md/bitmap.c +3 -3
index e4fb58d..2a37051 100644
@@ -850,7 +850,7 @@ static void bitmap_file_set_bit(struct bitmap *bitmap, sector_t block)
 		if (bitmap->flags & BITMAP_HOSTENDIAN)
 			set_bit(bit, kaddr);
 		else
-			ext2_set_bit(bit, kaddr);
+			__test_and_set_le_bit(bit, kaddr);
 		kunmap_atomic(kaddr, KM_USER0);
 		PRINTK("set file bit %lu page %lu\n", bit, page->index);
 	}
@@ -1046,7 +1046,7 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, sector_t start)
 		if (bitmap->flags & BITMAP_HOSTENDIAN)
 			b = test_bit(bit, paddr);
 		else
-			b = ext2_test_bit(bit, paddr);
+			b = test_le_bit(bit, paddr);
 		kunmap_atomic(paddr, KM_USER0);
 		if (b) {
 			/* if the disk bit is set, set the memory bit */
@@ -1222,7 +1222,7 @@ void bitmap_daemon_work(mddev_t *mddev)
 						clear_bit(file_page_offset(bitmap, j),
 							  paddr);
 					else
-						ext2_clear_bit(file_page_offset(bitmap, j),
+						__test_and_clear_le_bit(file_page_offset(bitmap, j),
 							       paddr);
 					kunmap_atomic(paddr, KM_USER0);
 				} else
Signature · 1 line
1.7.1.231.gd0b16
#28 lore raw

PATCH v2 19/22 dm: use little-endian bit operations

In reply to a message not in the archive

As a preparation for removing ext2 non-atomic bit operations from asm/bitops.h. This converts ext2 non-atomic bit operations to little-endian bit operations.

---
No change from previous submission

 drivers/md/dm-log.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/md/dm-log.c +4 -4
index 5a08be0..9a61fbc 100644
@@ -251,20 +251,20 @@ struct log_c {
  */
 static inline int log_test_bit(uint32_t *bs, unsigned bit)
 {
-	return ext2_test_bit(bit, (unsigned long *) bs) ? 1 : 0;
+	return test_le_bit(bit, (unsigned long *) bs) ? 1 : 0;
 }
 
 static inline void log_set_bit(struct log_c *l,
 			       uint32_t *bs, unsigned bit)
 {
-	ext2_set_bit(bit, (unsigned long *) bs);
+	__test_and_set_le_bit(bit, (unsigned long *) bs);
 	l->touched_cleaned = 1;
 }
 
 static inline void log_clear_bit(struct log_c *l,
 				 uint32_t *bs, unsigned bit)
 {
-	ext2_clear_bit(bit, (unsigned long *) bs);
+	__test_and_clear_le_bit(bit, (unsigned long *) bs);
 	l->touched_dirtied = 1;
 }
 
@@ -740,7 +740,7 @@ static int core_get_resync_work(struct dm_dirty_log *log, region_t *region)
 		return 0;
 
 	do {
-		*region = ext2_find_next_zero_bit(
+		*region = find_next_zero_le_bit(
 					     (unsigned long *) lc->sync_bits,
 					     lc->region_count,
 					     lc->sync_search);
Signature · 1 line
1.7.1.231.gd0b16
#29 lore raw

PATCH v2 20/22 bitops: remove ext2 non-atomic bitops from asm/bitops.h

In reply to a message not in the archive

As the result of conversions, there are no users of ext2 non-atomic bit operations except for ext2 file system itself. Now we can put them into architecture independent code in ext2 file system, and remove from asm/bitops.h for all architectures.

---
Change from v1: move ext2 bitops to fs/ext2/ext2.h, not include/linux/ext2_fs.h

 arch/alpha/include/asm/bitops.h              |    1 -
 arch/arm/include/asm/bitops.h                |   12 ------------
 arch/avr32/include/asm/bitops.h              |    1 -
 arch/blackfin/include/asm/bitops.h           |    1 -
 arch/cris/include/asm/bitops.h               |    1 -
 arch/frv/include/asm/bitops.h                |    1 -
 arch/h8300/include/asm/bitops.h              |    1 -
 arch/ia64/include/asm/bitops.h               |    1 -
 arch/m32r/include/asm/bitops.h               |    1 -
 arch/m68k/include/asm/bitops_mm.h            |   13 -------------
 arch/m68k/include/asm/bitops_no.h            |   20 --------------------
 arch/mips/include/asm/bitops.h               |    1 -
 arch/mn10300/include/asm/bitops.h            |    1 -
 arch/parisc/include/asm/bitops.h             |    1 -
 arch/powerpc/include/asm/bitops.h            |   14 --------------
 arch/s390/include/asm/bitops.h               |   15 ---------------
 arch/sh/include/asm/bitops.h                 |    1 -
 arch/sparc/include/asm/bitops_32.h           |    1 -
 arch/sparc/include/asm/bitops_64.h           |    1 -
 arch/tile/include/asm/bitops.h               |    1 -
 arch/x86/include/asm/bitops.h                |    1 -
 arch/xtensa/include/asm/bitops.h             |    1 -
 fs/ext2/ext2.h                               |   11 +++++++++++
 include/asm-generic/bitops.h                 |    1 -
 include/asm-generic/bitops/ext2-non-atomic.h |   18 ------------------
 25 files changed, 11 insertions(+), 110 deletions(-)
 delete mode 100644 include/asm-generic/bitops/ext2-non-atomic.h
arch/alpha/include/asm/bitops.h +0 -1
index 955fec7..822433a 100644
@@ -455,7 +455,6 @@ sched_find_first_bit(const unsigned long b[2])
 }
 
 #include <asm-generic/bitops/le.h>
-#include <asm-generic/bitops/ext2-non-atomic.h>
 
 #define ext2_set_bit_atomic(l,n,a)   test_and_set_bit(n,a)
 #define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a)
arch/arm/include/asm/bitops.h +0 -12
index 29adaca..ac2edb4 100644
@@ -327,22 +327,10 @@ static inline int fls(int x)
  * Ext2 is defined to use little-endian byte ordering.
  * These do not need to be atomic.
  */
-#define ext2_set_bit(nr,p)			\
-		__test_and_set_le_bit(nr, (unsigned long *)(p))
 #define ext2_set_bit_atomic(lock,nr,p)          \
 		test_and_set_le_bit(nr, (unsigned long *)(p))
-#define ext2_clear_bit(nr,p)			\
-		__test_and_clear_le_bit(nr, (unsigned long *)(p))
 #define ext2_clear_bit_atomic(lock,nr,p)        \
 		test_and_clear_le_bit(nr, (unsigned long *)(p))
-#define ext2_test_bit(nr,p)			\
-		test_le_bit(nr, (unsigned long *)(p))
-#define ext2_find_first_zero_bit(p,sz)		\
-		find_first_zero_le_bit((unsigned long *)(p), sz)
-#define ext2_find_next_zero_bit(p,sz,off)	\
-		find_next_zero_le_bit((unsigned long *)(p), sz, off)
-#define ext2_find_next_bit(p, sz, off) \
-		find_next_le_bit((unsigned long *)(p), sz, off)
 
 /*
  * Minix is defined to use little-endian byte ordering.
arch/avr32/include/asm/bitops.h +0 -1
index 1c482fc..73a163a 100644
@@ -300,7 +300,6 @@ static inline int ffs(unsigned long word)
 #include <asm-generic/bitops/lock.h>
 
 #include <asm-generic/bitops/le.h>
-#include <asm-generic/bitops/ext2-non-atomic.h>
 #include <asm-generic/bitops/ext2-atomic.h>
 #include <asm-generic/bitops/minix-le.h>
 
arch/blackfin/include/asm/bitops.h +0 -1
index 1261078..2c549f7 100644
@@ -26,7 +26,6 @@
 #include <asm-generic/bitops/lock.h>
 
 #include <asm-generic/bitops/le.h>
-#include <asm-generic/bitops/ext2-non-atomic.h>
 #include <asm-generic/bitops/ext2-atomic.h>
 #include <asm-generic/bitops/minix.h>
 
arch/cris/include/asm/bitops.h +0 -1
index 599ae67..71bea40 100644
@@ -155,7 +155,6 @@ static inline int test_and_change_bit(int nr, volatile unsigned long *addr)
 #include <asm-generic/bitops/lock.h>
 
 #include <asm-generic/bitops/le.h>
-#include <asm-generic/bitops/ext2-non-atomic.h>
 
 #define ext2_set_bit_atomic(l,n,a)   test_and_set_bit(n,a)
 #define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a)
arch/frv/include/asm/bitops.h +0 -1
index 2631917..e3ea644 100644
@@ -402,7 +402,6 @@ int __ilog2_u64(u64 n)
 #include <asm-generic/bitops/lock.h>
 
 #include <asm-generic/bitops/le.h>
-#include <asm-generic/bitops/ext2-non-atomic.h>
 
 #define ext2_set_bit_atomic(lock,nr,addr)	test_and_set_bit  ((nr) ^ 0x18, (addr))
 #define ext2_clear_bit_atomic(lock,nr,addr)	test_and_clear_bit((nr) ^ 0x18, (addr))
arch/h8300/include/asm/bitops.h +0 -1
index 763094f..23cea66 100644
@@ -201,7 +201,6 @@ static __inline__ unsigned long __ffs(unsigned long word)
 #include <asm-generic/bitops/hweight.h>
 #include <asm-generic/bitops/lock.h>
 #include <asm-generic/bitops/le.h>
-#include <asm-generic/bitops/ext2-non-atomic.h>
 #include <asm-generic/bitops/ext2-atomic.h>
 #include <asm-generic/bitops/minix.h>
 
arch/ia64/include/asm/bitops.h +0 -1
index 2cde4f0..336984a 100644
@@ -457,7 +457,6 @@ static __inline__ unsigned long __arch_hweight64(unsigned long x)
 #ifdef __KERNEL__
 
 #include <asm-generic/bitops/le.h>
-#include <asm-generic/bitops/ext2-non-atomic.h>
 
 #define ext2_set_bit_atomic(l,n,a)	test_and_set_bit(n,a)
 #define ext2_clear_bit_atomic(l,n,a)	test_and_clear_bit(n,a)
arch/m32r/include/asm/bitops.h +0 -1
index 681f7e8..cdfb4c8 100644
@@ -267,7 +267,6 @@ static __inline__ int test_and_change_bit(int nr, volatile void * addr)
 #ifdef __KERNEL__
 
 #include <asm-generic/bitops/le.h>
-#include <asm-generic/bitops/ext2-non-atomic.h>
 #include <asm-generic/bitops/ext2-atomic.h>
 #include <asm-generic/bitops/minix.h>
 
arch/m68k/include/asm/bitops_mm.h +0 -13
index 7f15f80..831d626 100644
@@ -467,23 +467,10 @@ static inline unsigned long find_next_le_bit(const unsigned long *addr,
 
 /* Bitmap functions for the ext2 filesystem. */
 
-#define ext2_set_bit(nr, addr)	\
-	__test_and_set_le_bit(nr, (unsigned long *)(addr))
 #define ext2_set_bit_atomic(lock, nr, addr)	\
 	test_and_set_le_bit(nr, (unsigned long *)(addr))
-#define ext2_clear_bit(nr, addr)	\
-	__test_and_clear_le_bit(nr, (unsigned long *)(addr))
 #define ext2_clear_bit_atomic(lock, nr, addr)	\
 	test_and_clear_le_bit(nr, (unsigned long *)(addr))
-#define ext2_find_next_zero_bit(addr, size, offset) \
-	find_next_zero_le_bit((unsigned long *)(addr), size, offset)
-#define ext2_find_next_bit(addr, size, offset) \
-	find_next_le_bit((unsigned long *)(addr), size, offset)
-#define ext2_test_bit(nr, vaddr)	test_le_bit(nr, vaddr)
-#define ext2_find_first_zero_bit(vaddr, size)	\
-	find_first_zero_le_bit((unsigned long *)(vaddr), size)
-#define ext2_find_first_bit(vaddr, size)	\
-	find_first_le_bit((unsigned long *)(vaddr), size)
 
 #endif /* __KERNEL__ */
 
arch/m68k/include/asm/bitops_no.h +0 -20
index 9f5eb02..7cabe45 100644
@@ -332,26 +332,6 @@ found_middle:
 	return result + ffz(__swab32(tmp));
 }
 
-#define ext2_set_bit(nr, addr)	\
-	__test_and_set_le_bit(nr, addr)
-
-#define ext2_clear_bit(nr, addr)	\
-	test_and_clear_le_bit(nr, addr)
-
-#define ext2_test_bit(nr, addr)	\
-	test_le_bit(nr, addr)
-
-#define ext2_find_first_zero_bit(addr, size) \
-	find_first_zero_le_bit(addr, size)
-
-#define ext2_find_next_zero_bit(addr, size, offset)	\
-	find_next_zero_le_bit(addr, size, offset)
-
-#define ext2_find_next_bit(addr, size, off) \
-	find_next_le_bit((unsigned long *)(addr), (size), (off))
-
-#include <asm-generic/bitops/minix.h>
-
 #endif /* __KERNEL__ */
 
 #include <asm-generic/bitops/fls.h>
arch/mips/include/asm/bitops.h +0 -1
index 4795820..07ce5aa 100644
@@ -705,7 +705,6 @@ static inline int ffs(int word)
 #include <asm-generic/bitops/const_hweight.h>
 
 #include <asm-generic/bitops/le.h>
-#include <asm-generic/bitops/ext2-non-atomic.h>
 #include <asm-generic/bitops/ext2-atomic.h>
 #include <asm-generic/bitops/minix.h>
 
arch/mn10300/include/asm/bitops.h +0 -1
index 4688c08..e1a9768 100644
@@ -234,7 +234,6 @@ int ffs(int x)
 	test_and_clear_bit((nr), (addr))
 
 #include <asm-generic/bitops/le.h>
-#include <asm-generic/bitops/ext2-non-atomic.h>
 #include <asm-generic/bitops/minix-le.h>
 
 #endif /* __KERNEL__ */
arch/parisc/include/asm/bitops.h +0 -1
index 4b9e58d..919d7ed 100644
@@ -223,7 +223,6 @@ static __inline__ int fls(int x)
 #ifdef __KERNEL__
 
 #include <asm-generic/bitops/le.h>
-#include <asm-generic/bitops/ext2-non-atomic.h>
 
 /* '3' is bits per byte */
 #define LE_BYTE_ADDR ((sizeof(unsigned long) - 1) << 3)
arch/powerpc/include/asm/bitops.h +0 -14
index b4f3f84..eb9ce7f 100644
@@ -303,25 +303,11 @@ unsigned long find_next_le_bit(const unsigned long *addr,
 				    unsigned long size, unsigned long offset);
 /* Bitmap functions for the ext2 filesystem */
 
-#define ext2_set_bit(nr,addr) \
-	__test_and_set_le_bit((nr), (unsigned long*)addr)
-#define ext2_clear_bit(nr, addr) \
-	__test_and_clear_le_bit((nr), (unsigned long*)addr)
-
 #define ext2_set_bit_atomic(lock, nr, addr) \
 	test_and_set_le_bit((nr), (unsigned long*)addr)
 #define ext2_clear_bit_atomic(lock, nr, addr) \
 	test_and_clear_le_bit((nr), (unsigned long*)addr)
 
-#define ext2_test_bit(nr, addr)      test_le_bit((nr),(unsigned long*)addr)
-
-#define ext2_find_first_zero_bit(addr, size) \
-	find_first_zero_le_bit((unsigned long*)addr, size)
-#define ext2_find_next_zero_bit(addr, size, off) \
-	find_next_zero_le_bit((unsigned long *)addr, size, off)
-
-#define ext2_find_next_bit(addr, size, off) \
-	find_next_le_bit((unsigned long *)addr, size, off)
 /* Bitmap functions for the minix filesystem.  */
 
 #define minix_test_and_set_bit(nr,addr) \
arch/s390/include/asm/bitops.h +0 -15
index e10b81e..1bd1e11 100644
@@ -837,25 +837,10 @@ static inline int find_next_le_bit(void *vaddr, unsigned long size,
 	return offset + find_first_le_bit(p, size);
 }
 
-#define ext2_set_bit(nr, addr)       \
-	__test_and_set_le_bit((nr), (unsigned long *)(addr))
 #define ext2_set_bit_atomic(lock, nr, addr)       \
 	test_and_set_le_bit((nr), (unsigned long *)(addr))
-#define ext2_clear_bit(nr, addr)     \
-	__test_and_clear_le_bit((nr), (unsigned long *)(addr))
 #define ext2_clear_bit_atomic(lock, nr, addr)     \
 	test_and_clear_le_bit((nr), (unsigned long *)(addr))
-#define ext2_test_bit(nr, addr)      \
-	test_le_bit((nr), (unsigned long *)(addr))
-
-#define ext2_find_first_zero_bit(vaddr, size)	\
-	find_first_zero_le_bit((unsigned long *)(vaddr), (size))
-#define ext2_find_next_zero_bit(vaddr, size, offset)	\
-	find_next_zero_le_bit((unsigned long *)(vaddr), (size), (offset))
-#define ext2_find_first_bit(vaddr, size)	\
-	find_first_le_bit((unsigned long *)(vaddr), (size))
-#define ext2_find_next_bit(vaddr, size, offset)	\
-	find_next_le_bit((unsigned long *)(vaddr), (size), (offset))
 
 #include <asm-generic/bitops/minix.h>
 
arch/sh/include/asm/bitops.h +0 -1
index 9167810..fc5cd5b 100644
@@ -95,7 +95,6 @@ static inline unsigned long ffz(unsigned long word)
 #include <asm-generic/bitops/lock.h>
 #include <asm-generic/bitops/sched.h>
 #include <asm-generic/bitops/le.h>
-#include <asm-generic/bitops/ext2-non-atomic.h>
 #include <asm-generic/bitops/ext2-atomic.h>
 #include <asm-generic/bitops/minix.h>
 #include <asm-generic/bitops/fls.h>
arch/sparc/include/asm/bitops_32.h +0 -1
index 5b3ab06..75da6f8 100644
@@ -104,7 +104,6 @@ static inline void change_bit(unsigned long nr, volatile unsigned long *addr)
 #include <asm-generic/bitops/lock.h>
 #include <asm-generic/bitops/find.h>
 #include <asm-generic/bitops/le.h>
-#include <asm-generic/bitops/ext2-non-atomic.h>
 #include <asm-generic/bitops/ext2-atomic.h>
 #include <asm-generic/bitops/minix.h>
 
arch/sparc/include/asm/bitops_64.h +0 -1
index 9097862..66db28e 100644
@@ -90,7 +90,6 @@ static inline unsigned int __arch_hweight8(unsigned int w)
 #ifdef __KERNEL__
 
 #include <asm-generic/bitops/le.h>
-#include <asm-generic/bitops/ext2-non-atomic.h>
 
 #define ext2_set_bit_atomic(lock,nr,addr) \
 	test_and_set_bit((nr) ^ 0x38,(unsigned long *)(addr))
arch/tile/include/asm/bitops.h +0 -1
index 56b0355..5447add 100644
@@ -123,7 +123,6 @@ static inline unsigned long __arch_hweight64(__u64 w)
 #include <asm-generic/bitops/find.h>
 #include <asm-generic/bitops/sched.h>
 #include <asm-generic/bitops/le.h>
-#include <asm-generic/bitops/ext2-non-atomic.h>
 #include <asm-generic/bitops/minix.h>
 
 #endif /* _ASM_TILE_BITOPS_H */
arch/x86/include/asm/bitops.h +0 -1
index c68bc10..3c95e07 100644
@@ -457,7 +457,6 @@ static inline int fls(int x)
 #ifdef __KERNEL__
 
 #include <asm-generic/bitops/le.h>
-#include <asm-generic/bitops/ext2-non-atomic.h>
 
 #define ext2_set_bit_atomic(lock, nr, addr)			\
 	test_and_set_bit((nr), (unsigned long *)(addr))
arch/xtensa/include/asm/bitops.h +0 -1
index 0475c11..a56b7b5 100644
@@ -107,7 +107,6 @@ static inline unsigned long __fls(unsigned long word)
 #include <asm-generic/bitops/fls64.h>
 #include <asm-generic/bitops/find.h>
 #include <asm-generic/bitops/le.h>
-#include <asm-generic/bitops/ext2-non-atomic.h>
 
 #ifdef __XTENSA_EL__
 # define ext2_set_bit_atomic(lock,nr,addr)				\
fs/ext2/ext2.h +11 -0
index 416daa6..62b81a9 100644
@@ -175,3 +175,14 @@ ext2_group_first_block_no(struct super_block *sb, unsigned long group_no)
 	return group_no * (ext2_fsblk_t)EXT2_BLOCKS_PER_GROUP(sb) +
 		le32_to_cpu(EXT2_SB(sb)->s_es->s_first_data_block);
 }
+
+#define ext2_set_bit(nr, addr)  \
+	__test_and_set_le_bit((nr), (unsigned long *)(addr))
+#define ext2_clear_bit(nr, addr) \
+	__test_and_clear_le_bit((nr), (unsigned long *)(addr))
+#define ext2_test_bit(nr, addr) \
+	test_le_bit((nr), (unsigned long *)(addr))
+#define ext2_find_first_zero_bit(addr, size)    \
+	find_first_zero_le_bit((unsigned long *)(addr), (size))
+#define ext2_find_next_zero_bit(addr, size, off)        \
+	find_next_zero_le_bit((unsigned long *)(addr), (size), (off))
include/asm-generic/bitops.h +0 -1
index 933710b..dd7c014 100644
@@ -39,7 +39,6 @@
 #include <asm-generic/bitops/atomic.h>
 #include <asm-generic/bitops/non-atomic.h>
 #include <asm-generic/bitops/le.h>
-#include <asm-generic/bitops/ext2-non-atomic.h>
 #include <asm-generic/bitops/ext2-atomic.h>
 #include <asm-generic/bitops/minix.h>
 
include/asm-generic/bitops/ext2-non-atomic.h deleted +0 -18
deleted file mode 100644
index c4639dd..0000000
@@ -1,18 +0,0 @@
-#ifndef _ASM_GENERIC_BITOPS_EXT2_NON_ATOMIC_H_
-#define _ASM_GENERIC_BITOPS_EXT2_NON_ATOMIC_H_
-
-#define ext2_set_bit(nr,addr)	\
-	__test_and_set_le_bit((nr), (unsigned long *)(addr))
-#define ext2_clear_bit(nr,addr)	\
-	__test_and_clear_le_bit((nr), (unsigned long *)(addr))
-
-#define ext2_test_bit(nr,addr)	\
-	test_le_bit((nr), (unsigned long *)(addr))
-#define ext2_find_first_zero_bit(addr, size) \
-	find_first_zero_le_bit((unsigned long *)(addr), (size))
-#define ext2_find_next_zero_bit(addr, size, off) \
-	find_next_zero_le_bit((unsigned long *)(addr), (size), (off))
-#define ext2_find_next_bit(addr, size, off) \
-	find_next_le_bit((unsigned long *)(addr), (size), (off))
-
-#endif /* _ASM_GENERIC_BITOPS_EXT2_NON_ATOMIC_H_ */
Signature · 1 line
1.7.1.231.gd0b16
#32 lore raw

PATCH v2 21/22 m68k: remove inline asm from minix_find_first_zero_bit

In reply to a message not in the archive

As a preparation for moving minix bit operations from asm/bitops.h to architecture independent code in minix file system, this removes inline asm from minix_find_first_zero_bit() for m68k.

Cc Geert Uytterhoeven <[email protected]>
Cc Roman Zippel <[email protected]>
Cc Andreas Schwab <[email protected]>

---
First submission

 arch/m68k/include/asm/bitops_mm.h |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)
arch/m68k/include/asm/bitops_mm.h +3 -7
index 831d626..f31ed5a 100644
@@ -330,23 +330,19 @@ static inline int __fls(int x)
 static inline int minix_find_first_zero_bit(const void *vaddr, unsigned size)
 {
 	const unsigned short *p = vaddr, *addr = vaddr;
-	int res;
 	unsigned short num;
 
 	if (!size)
 		return 0;
 
 	size = (size >> 4) + ((size & 15) > 0);
-	while (*p++ == 0xffff)
-	{
+	while (*p++ == 0xffff) {
 		if (--size == 0)
 			return (p - addr) << 4;
 	}
 
-	num = ~*--p;
-	__asm__ __volatile__ ("bfffo %1{#16,#16},%0"
-			      : "=d" (res) : "d" (num & -num));
-	return ((p - addr) << 4) + (res ^ 31);
+	num = *--p;
+	return ((p - addr) << 4) + ffz(num);
 }
 
 #define minix_test_and_set_bit(nr, addr)	__test_and_set_bit((nr) ^ 16, (unsigned long *)(addr))
Signature · 1 line
1.7.1.231.gd0b16
#34 lore raw

PATCH v2 22/22 bitops: remove minix bitops from asm/bitops.h

In reply to a message not in the archive

minix bit operations are only used by minix filesystem and useless by other modules. Because byte order of inode and block bitmaps is defferent on each architecture like below:

m68k:
big-endian 16bit indexed bitmaps

h8300, microblaze, s390, sparc, m68knommu:
big-endian 32 or 64bit indexed bitmaps

m32r, mips, sh, xtensa:
big-endian 32 or 64bit indexed bitmaps for big-endian mode little-endian bitmaps for little-endian mode

Others:
little-endian bitmaps

In order to move minix bit operations from asm/bitops.h to architecture independent code in minix file system, this provides two config options.

CONFIG_MINIX_FS_BIG_ENDIAN_16BIT_INDEXED is only selected by m68k. CONFIG_MINIX_FS_NATIVE_ENDIAN is selected by the architectures which use native byte order bitmaps (h8300, microblaze, s390, sparc, m68knommu, m32r, mips, sh, xtensa).
The architectures which always use little-endian bitmaps do not select these options.

Finally, we can remove minix bit operations from asm/bitops.h for all architectures.

Cc Greg Ungerer <[email protected]>
Cc Geert Uytterhoeven <[email protected]>
Cc Roman Zippel <[email protected]>
Cc Andreas Schwab <[email protected]>
Cc Martin Schwidefsky <[email protected]>
Cc Heiko Carstens <[email protected]>
Cc Yoshinori Sato <[email protected]>
Cc Michal Simek <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Hirokazu Takata <[email protected]>
Cc Ralf Baechle <[email protected]>
Cc Paul Mundt <[email protected]>
Cc Chris Zankel <[email protected]>

---
Mostly rewritten since previous submission

 arch/alpha/include/asm/bitops.h       |    2 -
 arch/arm/include/asm/bitops.h         |   14 ------
 arch/avr32/include/asm/bitops.h       |    1 -
 arch/blackfin/include/asm/bitops.h    |    1 -
 arch/cris/include/asm/bitops.h        |    1 -
 arch/frv/include/asm/bitops.h         |    2 -
 arch/h8300/include/asm/bitops.h       |    1 -
 arch/ia64/include/asm/bitops.h        |    1 -
 arch/m32r/include/asm/bitops.h        |    1 -
 arch/m68k/include/asm/bitops_mm.h     |   30 ------------
 arch/mips/include/asm/bitops.h        |    1 -
 arch/mn10300/include/asm/bitops.h     |    1 -
 arch/parisc/include/asm/bitops.h      |    2 -
 arch/powerpc/include/asm/bitops.h     |   14 ------
 arch/s390/include/asm/bitops.h        |    1 -
 arch/sh/include/asm/bitops.h          |    1 -
 arch/sparc/include/asm/bitops_32.h    |    1 -
 arch/sparc/include/asm/bitops_64.h    |    2 -
 arch/tile/include/asm/bitops.h        |    1 -
 arch/x86/include/asm/bitops.h         |    2 -
 arch/xtensa/include/asm/bitops.h      |    1 -
 fs/minix/Kconfig                      |    8 +++
 fs/minix/minix.h                      |   79 +++++++++++++++++++++++++++++++++
 include/asm-generic/bitops.h          |    1 -
 include/asm-generic/bitops/minix-le.h |   15 ------
 include/asm-generic/bitops/minix.h    |   15 ------
 26 files changed, 87 insertions(+), 112 deletions(-)
 delete mode 100644 include/asm-generic/bitops/minix-le.h
 delete mode 100644 include/asm-generic/bitops/minix.h
arch/alpha/include/asm/bitops.h +0 -2
index 822433a..85b8152 100644
@@ -459,8 +459,6 @@ sched_find_first_bit(const unsigned long b[2])
 #define ext2_set_bit_atomic(l,n,a)   test_and_set_bit(n,a)
 #define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a)
 
-#include <asm-generic/bitops/minix.h>
-
 #endif /* __KERNEL__ */
 
 #endif /* _ALPHA_BITOPS_H */
arch/arm/include/asm/bitops.h +0 -14
index ac2edb4..59a2a2b 100644
@@ -332,20 +332,6 @@ static inline int fls(int x)
 #define ext2_clear_bit_atomic(lock,nr,p)        \
 		test_and_clear_le_bit(nr, (unsigned long *)(p))
 
-/*
- * Minix is defined to use little-endian byte ordering.
- * These do not need to be atomic.
- */
-#define minix_set_bit(nr,p)			\
-		__set_le_bit(nr, (unsigned long *)(p))
-#define minix_test_bit(nr,p)			\
-		test_le_bit(nr, (unsigned long *)(p))
-#define minix_test_and_set_bit(nr,p)		\
-		__test_and_set_le_bit(nr, (unsigned long *)(p))
-#define minix_test_and_clear_bit(nr,p)		\
-		__test_and_clear_le_bit(nr, (unsigned long *)(p))
-#define minix_find_first_zero_bit(p,sz)		\
-		find_first_zero_le_bit((unsigned long *)(p), sz)
 
 #endif /* __KERNEL__ */
 
arch/avr32/include/asm/bitops.h +0 -1
index 73a163a..72444d9 100644
@@ -301,6 +301,5 @@ static inline int ffs(unsigned long word)
 
 #include <asm-generic/bitops/le.h>
 #include <asm-generic/bitops/ext2-atomic.h>
-#include <asm-generic/bitops/minix-le.h>
 
 #endif /* __ASM_AVR32_BITOPS_H */
arch/blackfin/include/asm/bitops.h +0 -1
index 2c549f7..68843fa 100644
@@ -27,7 +27,6 @@
 
 #include <asm-generic/bitops/le.h>
 #include <asm-generic/bitops/ext2-atomic.h>
-#include <asm-generic/bitops/minix.h>
 
 #ifndef CONFIG_SMP
 #include <linux/irqflags.h>
arch/cris/include/asm/bitops.h +0 -1
index 71bea40..310e0de 100644
@@ -159,7 +159,6 @@ static inline int test_and_change_bit(int nr, volatile unsigned long *addr)
 #define ext2_set_bit_atomic(l,n,a)   test_and_set_bit(n,a)
 #define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a)
 
-#include <asm-generic/bitops/minix.h>
 #include <asm-generic/bitops/sched.h>
 
 #endif /* __KERNEL__ */
arch/frv/include/asm/bitops.h +0 -2
index e3ea644..a1d00b0 100644
@@ -406,8 +406,6 @@ int __ilog2_u64(u64 n)
 #define ext2_set_bit_atomic(lock,nr,addr)	test_and_set_bit  ((nr) ^ 0x18, (addr))
 #define ext2_clear_bit_atomic(lock,nr,addr)	test_and_clear_bit((nr) ^ 0x18, (addr))
 
-#include <asm-generic/bitops/minix-le.h>
-
 #endif /* __KERNEL__ */
 
 #endif /* _ASM_BITOPS_H */
arch/h8300/include/asm/bitops.h +0 -1
index 23cea66..e856c1b 100644
@@ -202,7 +202,6 @@ static __inline__ unsigned long __ffs(unsigned long word)
 #include <asm-generic/bitops/lock.h>
 #include <asm-generic/bitops/le.h>
 #include <asm-generic/bitops/ext2-atomic.h>
-#include <asm-generic/bitops/minix.h>
 
 #endif /* __KERNEL__ */
 
arch/ia64/include/asm/bitops.h +0 -1
index 336984a..b76f7e0 100644
@@ -461,7 +461,6 @@ static __inline__ unsigned long __arch_hweight64(unsigned long x)
 #define ext2_set_bit_atomic(l,n,a)	test_and_set_bit(n,a)
 #define ext2_clear_bit_atomic(l,n,a)	test_and_clear_bit(n,a)
 
-#include <asm-generic/bitops/minix.h>
 #include <asm-generic/bitops/sched.h>
 
 #endif /* __KERNEL__ */
arch/m32r/include/asm/bitops.h +0 -1
index cdfb4c8..6300f22 100644
@@ -268,7 +268,6 @@ static __inline__ int test_and_change_bit(int nr, volatile void * addr)
 
 #include <asm-generic/bitops/le.h>
 #include <asm-generic/bitops/ext2-atomic.h>
-#include <asm-generic/bitops/minix.h>
 
 #endif /* __KERNEL__ */
 
arch/m68k/include/asm/bitops_mm.h +0 -30
index f31ed5a..5f06275 100644
@@ -325,36 +325,6 @@ static inline int __fls(int x)
 #include <asm-generic/bitops/hweight.h>
 #include <asm-generic/bitops/lock.h>
 
-/* Bitmap functions for the minix filesystem */
-
-static inline int minix_find_first_zero_bit(const void *vaddr, unsigned size)
-{
-	const unsigned short *p = vaddr, *addr = vaddr;
-	unsigned short num;
-
-	if (!size)
-		return 0;
-
-	size = (size >> 4) + ((size & 15) > 0);
-	while (*p++ == 0xffff) {
-		if (--size == 0)
-			return (p - addr) << 4;
-	}
-
-	num = *--p;
-	return ((p - addr) << 4) + ffz(num);
-}
-
-#define minix_test_and_set_bit(nr, addr)	__test_and_set_bit((nr) ^ 16, (unsigned long *)(addr))
-#define minix_set_bit(nr,addr)			__set_bit((nr) ^ 16, (unsigned long *)(addr))
-#define minix_test_and_clear_bit(nr, addr)	__test_and_clear_bit((nr) ^ 16, (unsigned long *)(addr))
-
-static inline int minix_test_bit(int nr, const void *vaddr)
-{
-	const unsigned short *p = vaddr;
-	return (p[nr >> 4] & (1U << (nr & 15))) != 0;
-}
-
 /* Bitmap functions for little endian. */
 
 #define __set_le_bit(nr, addr)	\
arch/mips/include/asm/bitops.h +0 -1
index 07ce5aa..6a2202c 100644
@@ -706,7 +706,6 @@ static inline int ffs(int word)
 
 #include <asm-generic/bitops/le.h>
 #include <asm-generic/bitops/ext2-atomic.h>
-#include <asm-generic/bitops/minix.h>
 
 #endif /* __KERNEL__ */
 
arch/mn10300/include/asm/bitops.h +0 -1
index e1a9768..94ee844 100644
@@ -234,7 +234,6 @@ int ffs(int x)
 	test_and_clear_bit((nr), (addr))
 
 #include <asm-generic/bitops/le.h>
-#include <asm-generic/bitops/minix-le.h>
 
 #endif /* __KERNEL__ */
 #endif /* __ASM_BITOPS_H */
arch/parisc/include/asm/bitops.h +0 -2
index 919d7ed..43c516f 100644
@@ -234,6 +234,4 @@ static __inline__ int fls(int x)
 
 #endif	/* __KERNEL__ */
 
-#include <asm-generic/bitops/minix-le.h>
-
 #endif /* _PARISC_BITOPS_H */
arch/powerpc/include/asm/bitops.h +0 -14
index eb9ce7f..bf5ccfc 100644
@@ -308,20 +308,6 @@ unsigned long find_next_le_bit(const unsigned long *addr,
 #define ext2_clear_bit_atomic(lock, nr, addr) \
 	test_and_clear_le_bit((nr), (unsigned long*)addr)
 
-/* Bitmap functions for the minix filesystem.  */
-
-#define minix_test_and_set_bit(nr,addr) \
-	__test_and_set_le_bit(nr, (unsigned long *)addr)
-#define minix_set_bit(nr,addr) \
-	__set_le_bit(nr, (unsigned long *)addr)
-#define minix_test_and_clear_bit(nr,addr) \
-	__test_and_clear_le_bit(nr, (unsigned long *)addr)
-#define minix_test_bit(nr,addr) \
-	test_le_bit(nr, (unsigned long *)addr)
-
-#define minix_find_first_zero_bit(addr,size) \
-	find_first_zero_le_bit((unsigned long *)addr, size)
-
 #include <asm-generic/bitops/sched.h>
 
 #endif /* __KERNEL__ */
arch/s390/include/asm/bitops.h +0 -1
index 1bd1e11..e537613 100644
@@ -842,7 +842,6 @@ static inline int find_next_le_bit(void *vaddr, unsigned long size,
 #define ext2_clear_bit_atomic(lock, nr, addr)     \
 	test_and_clear_le_bit((nr), (unsigned long *)(addr))
 
-#include <asm-generic/bitops/minix.h>
 
 #endif /* __KERNEL__ */
 
arch/sh/include/asm/bitops.h +0 -1
index fc5cd5b..90fa3e4 100644
@@ -96,7 +96,6 @@ static inline unsigned long ffz(unsigned long word)
 #include <asm-generic/bitops/sched.h>
 #include <asm-generic/bitops/le.h>
 #include <asm-generic/bitops/ext2-atomic.h>
-#include <asm-generic/bitops/minix.h>
 #include <asm-generic/bitops/fls.h>
 #include <asm-generic/bitops/__fls.h>
 #include <asm-generic/bitops/fls64.h>
arch/sparc/include/asm/bitops_32.h +0 -1
index 75da6f8..25a6766 100644
@@ -105,7 +105,6 @@ static inline void change_bit(unsigned long nr, volatile unsigned long *addr)
 #include <asm-generic/bitops/find.h>
 #include <asm-generic/bitops/le.h>
 #include <asm-generic/bitops/ext2-atomic.h>
-#include <asm-generic/bitops/minix.h>
 
 #endif /* __KERNEL__ */
 
arch/sparc/include/asm/bitops_64.h +0 -2
index 66db28e..38e9aa1 100644
@@ -96,8 +96,6 @@ static inline unsigned int __arch_hweight8(unsigned int w)
 #define ext2_clear_bit_atomic(lock,nr,addr) \
 	test_and_clear_bit((nr) ^ 0x38,(unsigned long *)(addr))
 
-#include <asm-generic/bitops/minix.h>
-
 #endif /* __KERNEL__ */
 
 #endif /* defined(_SPARC64_BITOPS_H) */
arch/tile/include/asm/bitops.h +0 -1
index 5447add..132e6bb 100644
@@ -123,6 +123,5 @@ static inline unsigned long __arch_hweight64(__u64 w)
 #include <asm-generic/bitops/find.h>
 #include <asm-generic/bitops/sched.h>
 #include <asm-generic/bitops/le.h>
-#include <asm-generic/bitops/minix.h>
 
 #endif /* _ASM_TILE_BITOPS_H */
arch/x86/include/asm/bitops.h +0 -2
index 3c95e07..69d5813 100644
@@ -463,7 +463,5 @@ static inline int fls(int x)
 #define ext2_clear_bit_atomic(lock, nr, addr)			\
 	test_and_clear_bit((nr), (unsigned long *)(addr))
 
-#include <asm-generic/bitops/minix.h>
-
 #endif /* __KERNEL__ */
 #endif /* _ASM_X86_BITOPS_H */
arch/xtensa/include/asm/bitops.h +0 -1
index a56b7b5..c8fac8d 100644
@@ -125,7 +125,6 @@ static inline unsigned long __fls(unsigned long word)
 #include <asm-generic/bitops/hweight.h>
 #include <asm-generic/bitops/lock.h>
 #include <asm-generic/bitops/sched.h>
-#include <asm-generic/bitops/minix.h>
 
 #endif	/* __KERNEL__ */
 
fs/minix/Kconfig +8 -0
index 0fd7ca9..6624684 100644
@@ -15,3 +15,11 @@ config MINIX_FS
 	  module will be called minix.  Note that the file system of your root
 	  partition (the one containing the directory /) cannot be compiled as
 	  a module.
+
+config MINIX_FS_NATIVE_ENDIAN
+	def_bool MINIX_FS
+	depends on H8300 || M32R || MICROBLAZE || MIPS || S390 || SUPERH || SPARC || XTENSA || (M68K && !MMU)
+
+config MINIX_FS_BIG_ENDIAN_16BIT_INDEXED
+	def_bool MINIX_FS
+	depends on M68K && MMU
fs/minix/minix.h +79 -0

83 lines not on this page · raw message

include/asm-generic/bitops.h +0 -1
index dd7c014..280ca7a 100644
@@ -40,6 +40,5 @@
 #include <asm-generic/bitops/non-atomic.h>
 #include <asm-generic/bitops/le.h>
 #include <asm-generic/bitops/ext2-atomic.h>
-#include <asm-generic/bitops/minix.h>
 
 #endif /* __ASM_GENERIC_BITOPS_H */
include/asm-generic/bitops/minix-le.h deleted +0 -15
deleted file mode 100644
index f366cfa..0000000
@@ -1,15 +0,0 @@
-#ifndef _ASM_GENERIC_BITOPS_MINIX_LE_H_
-#define _ASM_GENERIC_BITOPS_MINIX_LE_H_
-
-#define minix_test_and_set_bit(nr,addr)	\
-	__test_and_set_le_bit((nr), (unsigned long *)(addr))
-#define minix_set_bit(nr,addr)		\
-	__set_le_bit((nr), (unsigned long *)(addr))
-#define minix_test_and_clear_bit(nr,addr) \
-	__test_and_clear_le_bit((nr), (unsigned long *)(addr))
-#define minix_test_bit(nr,addr)		\
-	test_le_bit((nr), (unsigned long *)(addr))
-#define minix_find_first_zero_bit(addr,size) \
-	find_first_zero_le_bit((unsigned long *)(addr), (size))
-
-#endif /* _ASM_GENERIC_BITOPS_MINIX_LE_H_ */
include/asm-generic/bitops/minix.h deleted +0 -15
deleted file mode 100644
index 91f42e8..0000000
@@ -1,15 +0,0 @@
-#ifndef _ASM_GENERIC_BITOPS_MINIX_H_
-#define _ASM_GENERIC_BITOPS_MINIX_H_
-
-#define minix_test_and_set_bit(nr,addr)	\
-	__test_and_set_bit((nr),(unsigned long *)(addr))
-#define minix_set_bit(nr,addr)		\
-	__set_bit((nr),(unsigned long *)(addr))
-#define minix_test_and_clear_bit(nr,addr) \
-	__test_and_clear_bit((nr),(unsigned long *)(addr))
-#define minix_test_bit(nr,addr)		\
-	test_bit((nr),(unsigned long *)(addr))
-#define minix_find_first_zero_bit(addr,size) \
-	find_first_zero_bit((unsigned long *)(addr),(size))
-
-#endif /* _ASM_GENERIC_BITOPS_MINIX_H_ */
Signature · 1 line
1.7.1.231.gd0b16
#45 lore raw

PATCH v2 22/22 bitops: remove minix bitops from asm/bitops.h

In reply to a message not in the archive

minix bit operations are only used by minix filesystem and useless by other modules. Because byte order of inode and block bitmaps is defferent on each architecture like below:

m68k:
big-endian 16bit indexed bitmaps

h8300, microblaze, s390, sparc, m68knommu:
big-endian 32 or 64bit indexed bitmaps

m32r, mips, sh, xtensa:
big-endian 32 or 64bit indexed bitmaps for big-endian mode little-endian bitmaps for little-endian mode

Others:
little-endian bitmaps

In order to move minix bit operations from asm/bitops.h to architecture independent code in minix file system, this provides two config options.

CONFIG_MINIX_FS_BIG_ENDIAN_16BIT_INDEXED is only selected by m68k. CONFIG_MINIX_FS_NATIVE_ENDIAN is selected by the architectures which use native byte order bitmaps (h8300, microblaze, s390, sparc, m68knommu, m32r, mips, sh, xtensa).
The architectures which always use little-endian bitmaps do not select these options.

Finally, we can remove minix bit operations from asm/bitops.h for all architectures.

Cc Greg Ungerer <[email protected]>
Cc Geert Uytterhoeven <[email protected]>
Cc Roman Zippel <[email protected]>
Cc Andreas Schwab <[email protected]>
Cc Martin Schwidefsky <[email protected]>
Cc Heiko Carstens <[email protected]>
Cc Yoshinori Sato <[email protected]>
Cc Michal Simek <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Hirokazu Takata <[email protected]>
Cc Ralf Baechle <[email protected]>
Cc Paul Mundt <[email protected]>
Cc Chris Zankel <[email protected]>

---
Mostly rewritten since previous submission

 arch/alpha/include/asm/bitops.h       |    2 -
 arch/arm/include/asm/bitops.h         |   14 ------
 arch/avr32/include/asm/bitops.h       |    1 -
 arch/blackfin/include/asm/bitops.h    |    1 -
 arch/cris/include/asm/bitops.h        |    1 -
 arch/frv/include/asm/bitops.h         |    2 -
 arch/h8300/include/asm/bitops.h       |    1 -
 arch/ia64/include/asm/bitops.h        |    1 -
 arch/m32r/include/asm/bitops.h        |    1 -
 arch/m68k/include/asm/bitops_mm.h     |   30 ------------
 arch/mips/include/asm/bitops.h        |    1 -
 arch/mn10300/include/asm/bitops.h     |    1 -
 arch/parisc/include/asm/bitops.h      |    2 -
 arch/powerpc/include/asm/bitops.h     |   14 ------
 arch/s390/include/asm/bitops.h        |    1 -
 arch/sh/include/asm/bitops.h          |    1 -
 arch/sparc/include/asm/bitops_32.h    |    1 -
 arch/sparc/include/asm/bitops_64.h    |    2 -
 arch/tile/include/asm/bitops.h        |    1 -
 arch/x86/include/asm/bitops.h         |    2 -
 arch/xtensa/include/asm/bitops.h      |    1 -
 fs/minix/Kconfig                      |    8 +++
 fs/minix/minix.h                      |   79 +++++++++++++++++++++++++++++++++
 include/asm-generic/bitops.h          |    1 -
 include/asm-generic/bitops/minix-le.h |   15 ------
 include/asm-generic/bitops/minix.h    |   15 ------
 26 files changed, 87 insertions(+), 112 deletions(-)
 delete mode 100644 include/asm-generic/bitops/minix-le.h
 delete mode 100644 include/asm-generic/bitops/minix.h
arch/alpha/include/asm/bitops.h +0 -2
index 822433a..85b8152 100644
@@ -459,8 +459,6 @@ sched_find_first_bit(const unsigned long b[2])
 #define ext2_set_bit_atomic(l,n,a)   test_and_set_bit(n,a)
 #define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a)
 
-#include <asm-generic/bitops/minix.h>
-
 #endif /* __KERNEL__ */
 
 #endif /* _ALPHA_BITOPS_H */
arch/arm/include/asm/bitops.h +0 -14
index ac2edb4..59a2a2b 100644
@@ -332,20 +332,6 @@ static inline int fls(int x)
 #define ext2_clear_bit_atomic(lock,nr,p)        \
 		test_and_clear_le_bit(nr, (unsigned long *)(p))
 
-/*
- * Minix is defined to use little-endian byte ordering.
- * These do not need to be atomic.
- */
-#define minix_set_bit(nr,p)			\
-		__set_le_bit(nr, (unsigned long *)(p))
-#define minix_test_bit(nr,p)			\
-		test_le_bit(nr, (unsigned long *)(p))
-#define minix_test_and_set_bit(nr,p)		\
-		__test_and_set_le_bit(nr, (unsigned long *)(p))
-#define minix_test_and_clear_bit(nr,p)		\
-		__test_and_clear_le_bit(nr, (unsigned long *)(p))
-#define minix_find_first_zero_bit(p,sz)		\
-		find_first_zero_le_bit((unsigned long *)(p), sz)
 
 #endif /* __KERNEL__ */
 
arch/avr32/include/asm/bitops.h +0 -1
index 73a163a..72444d9 100644
@@ -301,6 +301,5 @@ static inline int ffs(unsigned long word)
 
 #include <asm-generic/bitops/le.h>
 #include <asm-generic/bitops/ext2-atomic.h>
-#include <asm-generic/bitops/minix-le.h>
 
 #endif /* __ASM_AVR32_BITOPS_H */
arch/blackfin/include/asm/bitops.h +0 -1
index 2c549f7..68843fa 100644
@@ -27,7 +27,6 @@
 
 #include <asm-generic/bitops/le.h>
 #include <asm-generic/bitops/ext2-atomic.h>
-#include <asm-generic/bitops/minix.h>
 
 #ifndef CONFIG_SMP
 #include <linux/irqflags.h>
arch/cris/include/asm/bitops.h +0 -1
index 71bea40..310e0de 100644
@@ -159,7 +159,6 @@ static inline int test_and_change_bit(int nr, volatile unsigned long *addr)
 #define ext2_set_bit_atomic(l,n,a)   test_and_set_bit(n,a)
 #define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a)
 
-#include <asm-generic/bitops/minix.h>
 #include <asm-generic/bitops/sched.h>
 
 #endif /* __KERNEL__ */
arch/frv/include/asm/bitops.h +0 -2
index e3ea644..a1d00b0 100644
@@ -406,8 +406,6 @@ int __ilog2_u64(u64 n)
 #define ext2_set_bit_atomic(lock,nr,addr)	test_and_set_bit  ((nr) ^ 0x18, (addr))
 #define ext2_clear_bit_atomic(lock,nr,addr)	test_and_clear_bit((nr) ^ 0x18, (addr))
 
-#include <asm-generic/bitops/minix-le.h>
-
 #endif /* __KERNEL__ */
 
 #endif /* _ASM_BITOPS_H */
arch/h8300/include/asm/bitops.h +0 -1
index 23cea66..e856c1b 100644
@@ -202,7 +202,6 @@ static __inline__ unsigned long __ffs(unsigned long word)
 #include <asm-generic/bitops/lock.h>
 #include <asm-generic/bitops/le.h>
 #include <asm-generic/bitops/ext2-atomic.h>
-#include <asm-generic/bitops/minix.h>
 
 #endif /* __KERNEL__ */
 
arch/ia64/include/asm/bitops.h +0 -1
index 336984a..b76f7e0 100644
@@ -461,7 +461,6 @@ static __inline__ unsigned long __arch_hweight64(unsigned long x)
 #define ext2_set_bit_atomic(l,n,a)	test_and_set_bit(n,a)
 #define ext2_clear_bit_atomic(l,n,a)	test_and_clear_bit(n,a)
 
-#include <asm-generic/bitops/minix.h>
 #include <asm-generic/bitops/sched.h>
 
 #endif /* __KERNEL__ */
arch/m32r/include/asm/bitops.h +0 -1
index cdfb4c8..6300f22 100644
@@ -268,7 +268,6 @@ static __inline__ int test_and_change_bit(int nr, volatile void * addr)
 
 #include <asm-generic/bitops/le.h>
 #include <asm-generic/bitops/ext2-atomic.h>
-#include <asm-generic/bitops/minix.h>
 
 #endif /* __KERNEL__ */
 
arch/m68k/include/asm/bitops_mm.h +0 -30
index f31ed5a..5f06275 100644
@@ -325,36 +325,6 @@ static inline int __fls(int x)
 #include <asm-generic/bitops/hweight.h>
 #include <asm-generic/bitops/lock.h>
 
-/* Bitmap functions for the minix filesystem */
-
-static inline int minix_find_first_zero_bit(const void *vaddr, unsigned size)
-{
-	const unsigned short *p = vaddr, *addr = vaddr;
-	unsigned short num;
-
-	if (!size)
-		return 0;
-
-	size = (size >> 4) + ((size & 15) > 0);
-	while (*p++ == 0xffff) {
-		if (--size == 0)
-			return (p - addr) << 4;
-	}
-
-	num = *--p;
-	return ((p - addr) << 4) + ffz(num);
-}
-
-#define minix_test_and_set_bit(nr, addr)	__test_and_set_bit((nr) ^ 16, (unsigned long *)(addr))
-#define minix_set_bit(nr,addr)			__set_bit((nr) ^ 16, (unsigned long *)(addr))
-#define minix_test_and_clear_bit(nr, addr)	__test_and_clear_bit((nr) ^ 16, (unsigned long *)(addr))
-
-static inline int minix_test_bit(int nr, const void *vaddr)
-{
-	const unsigned short *p = vaddr;
-	return (p[nr >> 4] & (1U << (nr & 15))) != 0;
-}
-
 /* Bitmap functions for little endian. */
 
 #define __set_le_bit(nr, addr)	\
arch/mips/include/asm/bitops.h +0 -1
index 07ce5aa..6a2202c 100644
@@ -706,7 +706,6 @@ static inline int ffs(int word)
 
 #include <asm-generic/bitops/le.h>
 #include <asm-generic/bitops/ext2-atomic.h>
-#include <asm-generic/bitops/minix.h>
 
 #endif /* __KERNEL__ */
 
arch/mn10300/include/asm/bitops.h +0 -1
index e1a9768..94ee844 100644
@@ -234,7 +234,6 @@ int ffs(int x)
 	test_and_clear_bit((nr), (addr))
 
 #include <asm-generic/bitops/le.h>
-#include <asm-generic/bitops/minix-le.h>
 
 #endif /* __KERNEL__ */
 #endif /* __ASM_BITOPS_H */
arch/parisc/include/asm/bitops.h +0 -2
index 919d7ed..43c516f 100644
@@ -234,6 +234,4 @@ static __inline__ int fls(int x)
 
 #endif	/* __KERNEL__ */
 
-#include <asm-generic/bitops/minix-le.h>
-
 #endif /* _PARISC_BITOPS_H */
arch/powerpc/include/asm/bitops.h +0 -14
index eb9ce7f..bf5ccfc 100644
@@ -308,20 +308,6 @@ unsigned long find_next_le_bit(const unsigned long *addr,
 #define ext2_clear_bit_atomic(lock, nr, addr) \
 	test_and_clear_le_bit((nr), (unsigned long*)addr)
 
-/* Bitmap functions for the minix filesystem.  */
-
-#define minix_test_and_set_bit(nr,addr) \
-	__test_and_set_le_bit(nr, (unsigned long *)addr)
-#define minix_set_bit(nr,addr) \
-	__set_le_bit(nr, (unsigned long *)addr)
-#define minix_test_and_clear_bit(nr,addr) \
-	__test_and_clear_le_bit(nr, (unsigned long *)addr)
-#define minix_test_bit(nr,addr) \
-	test_le_bit(nr, (unsigned long *)addr)
-
-#define minix_find_first_zero_bit(addr,size) \
-	find_first_zero_le_bit((unsigned long *)addr, size)
-
 #include <asm-generic/bitops/sched.h>
 
 #endif /* __KERNEL__ */
arch/s390/include/asm/bitops.h +0 -1
index 1bd1e11..e537613 100644
@@ -842,7 +842,6 @@ static inline int find_next_le_bit(void *vaddr, unsigned long size,
 #define ext2_clear_bit_atomic(lock, nr, addr)     \
 	test_and_clear_le_bit((nr), (unsigned long *)(addr))
 
-#include <asm-generic/bitops/minix.h>
 
 #endif /* __KERNEL__ */
 
arch/sh/include/asm/bitops.h +0 -1
index fc5cd5b..90fa3e4 100644
@@ -96,7 +96,6 @@ static inline unsigned long ffz(unsigned long word)
 #include <asm-generic/bitops/sched.h>
 #include <asm-generic/bitops/le.h>
 #include <asm-generic/bitops/ext2-atomic.h>
-#include <asm-generic/bitops/minix.h>
 #include <asm-generic/bitops/fls.h>
 #include <asm-generic/bitops/__fls.h>
 #include <asm-generic/bitops/fls64.h>
arch/sparc/include/asm/bitops_32.h +0 -1
index 75da6f8..25a6766 100644
@@ -105,7 +105,6 @@ static inline void change_bit(unsigned long nr, volatile unsigned long *addr)
 #include <asm-generic/bitops/find.h>
 #include <asm-generic/bitops/le.h>
 #include <asm-generic/bitops/ext2-atomic.h>
-#include <asm-generic/bitops/minix.h>
 
 #endif /* __KERNEL__ */
 
arch/sparc/include/asm/bitops_64.h +0 -2
index 66db28e..38e9aa1 100644
@@ -96,8 +96,6 @@ static inline unsigned int __arch_hweight8(unsigned int w)
 #define ext2_clear_bit_atomic(lock,nr,addr) \
 	test_and_clear_bit((nr) ^ 0x38,(unsigned long *)(addr))
 
-#include <asm-generic/bitops/minix.h>
-
 #endif /* __KERNEL__ */
 
 #endif /* defined(_SPARC64_BITOPS_H) */
arch/tile/include/asm/bitops.h +0 -1
index 5447add..132e6bb 100644
@@ -123,6 +123,5 @@ static inline unsigned long __arch_hweight64(__u64 w)
 #include <asm-generic/bitops/find.h>
 #include <asm-generic/bitops/sched.h>
 #include <asm-generic/bitops/le.h>
-#include <asm-generic/bitops/minix.h>
 
 #endif /* _ASM_TILE_BITOPS_H */
arch/x86/include/asm/bitops.h +0 -2
index 3c95e07..69d5813 100644
@@ -463,7 +463,5 @@ static inline int fls(int x)
 #define ext2_clear_bit_atomic(lock, nr, addr)			\
 	test_and_clear_bit((nr), (unsigned long *)(addr))
 
-#include <asm-generic/bitops/minix.h>
-
 #endif /* __KERNEL__ */
 #endif /* _ASM_X86_BITOPS_H */
arch/xtensa/include/asm/bitops.h +0 -1
index a56b7b5..c8fac8d 100644
@@ -125,7 +125,6 @@ static inline unsigned long __fls(unsigned long word)
 #include <asm-generic/bitops/hweight.h>
 #include <asm-generic/bitops/lock.h>
 #include <asm-generic/bitops/sched.h>
-#include <asm-generic/bitops/minix.h>
 
 #endif	/* __KERNEL__ */
 
fs/minix/Kconfig +8 -0
index 0fd7ca9..6624684 100644
@@ -15,3 +15,11 @@ config MINIX_FS
 	  module will be called minix.  Note that the file system of your root
 	  partition (the one containing the directory /) cannot be compiled as
 	  a module.
+
+config MINIX_FS_NATIVE_ENDIAN
+	def_bool MINIX_FS
+	depends on H8300 || M32R || MICROBLAZE || MIPS || S390 || SUPERH || SPARC || XTENSA || (M68K && !MMU)
+
+config MINIX_FS_BIG_ENDIAN_16BIT_INDEXED
+	def_bool MINIX_FS
+	depends on M68K && MMU
fs/minix/minix.h +79 -0

83 lines not on this page · raw message

include/asm-generic/bitops.h +0 -1
index dd7c014..280ca7a 100644
@@ -40,6 +40,5 @@
 #include <asm-generic/bitops/non-atomic.h>
 #include <asm-generic/bitops/le.h>
 #include <asm-generic/bitops/ext2-atomic.h>
-#include <asm-generic/bitops/minix.h>
 
 #endif /* __ASM_GENERIC_BITOPS_H */
include/asm-generic/bitops/minix-le.h deleted +0 -15
deleted file mode 100644
index f366cfa..0000000
@@ -1,15 +0,0 @@
-#ifndef _ASM_GENERIC_BITOPS_MINIX_LE_H_
-#define _ASM_GENERIC_BITOPS_MINIX_LE_H_
-
-#define minix_test_and_set_bit(nr,addr)	\
-	__test_and_set_le_bit((nr), (unsigned long *)(addr))
-#define minix_set_bit(nr,addr)		\
-	__set_le_bit((nr), (unsigned long *)(addr))
-#define minix_test_and_clear_bit(nr,addr) \
-	__test_and_clear_le_bit((nr), (unsigned long *)(addr))
-#define minix_test_bit(nr,addr)		\
-	test_le_bit((nr), (unsigned long *)(addr))
-#define minix_find_first_zero_bit(addr,size) \
-	find_first_zero_le_bit((unsigned long *)(addr), (size))
-
-#endif /* _ASM_GENERIC_BITOPS_MINIX_LE_H_ */
include/asm-generic/bitops/minix.h deleted +0 -15
deleted file mode 100644
index 91f42e8..0000000
@@ -1,15 +0,0 @@
-#ifndef _ASM_GENERIC_BITOPS_MINIX_H_
-#define _ASM_GENERIC_BITOPS_MINIX_H_
-
-#define minix_test_and_set_bit(nr,addr)	\
-	__test_and_set_bit((nr),(unsigned long *)(addr))
-#define minix_set_bit(nr,addr)		\
-	__set_bit((nr),(unsigned long *)(addr))
-#define minix_test_and_clear_bit(nr,addr) \
-	__test_and_clear_bit((nr),(unsigned long *)(addr))
-#define minix_test_bit(nr,addr)		\
-	test_bit((nr),(unsigned long *)(addr))
-#define minix_find_first_zero_bit(addr,size) \
-	find_first_zero_bit((unsigned long *)(addr),(size))
-
-#endif /* _ASM_GENERIC_BITOPS_MINIX_H_ */
Signature · 1 line
1.7.1.231.gd0b16
#1 lore raw

PATCH v2 1/22 bitops: merge little and big endian definisions in asm-generic/bitops/le.h

In reply to a message not in the archive

In order to make the forthcoming changes smaller, this merges macro definisions in asm-generic/bitops/le.h for big-endian and little-endian as much as possible.

This also removes unused BITOP_WORD macro.

---
No change from previous submission

 include/asm-generic/bitops/le.h |   38 +++++++++++++++-----------------------
 1 files changed, 15 insertions(+), 23 deletions(-)
include/asm-generic/bitops/le.h +15 -23
index 80e3bf1..db2be81 100644
@@ -4,27 +4,28 @@
 #include <asm/types.h>
 #include <asm/byteorder.h>
 
-#define BITOP_WORD(nr)		((nr) / BITS_PER_LONG)
-#define BITOP_LE_SWIZZLE	((BITS_PER_LONG-1) & ~0x7)
-
 #if defined(__LITTLE_ENDIAN)
 
-#define generic_test_le_bit(nr, addr) test_bit(nr, addr)
-#define generic___set_le_bit(nr, addr) __set_bit(nr, addr)
-#define generic___clear_le_bit(nr, addr) __clear_bit(nr, addr)
-
-#define generic_test_and_set_le_bit(nr, addr) test_and_set_bit(nr, addr)
-#define generic_test_and_clear_le_bit(nr, addr) test_and_clear_bit(nr, addr)
+#define BITOP_LE_SWIZZLE	0
 
-#define generic___test_and_set_le_bit(nr, addr) __test_and_set_bit(nr, addr)
-#define generic___test_and_clear_le_bit(nr, addr) __test_and_clear_bit(nr, addr)
-
-#define generic_find_next_zero_le_bit(addr, size, offset) find_next_zero_bit(addr, size, offset)
+#define generic_find_next_zero_le_bit(addr, size, offset) \
+	find_next_zero_bit(addr, size, offset)
 #define generic_find_next_le_bit(addr, size, offset) \
-			find_next_bit(addr, size, offset)
+	find_next_bit(addr, size, offset)
 
 #elif defined(__BIG_ENDIAN)
 
+#define BITOP_LE_SWIZZLE	((BITS_PER_LONG-1) & ~0x7)
+
+extern unsigned long generic_find_next_zero_le_bit(const unsigned long *addr,
+		unsigned long size, unsigned long offset);
+extern unsigned long generic_find_next_le_bit(const unsigned long *addr,
+		unsigned long size, unsigned long offset);
+
+#else
+#error "Please fix <asm/byteorder.h>"
+#endif
+
 #define generic_test_le_bit(nr, addr) \
 	test_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
 #define generic___set_le_bit(nr, addr) \
@@ -42,15 +43,6 @@
 #define generic___test_and_clear_le_bit(nr, addr) \
 	__test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
 
-extern unsigned long generic_find_next_zero_le_bit(const unsigned long *addr,
-		unsigned long size, unsigned long offset);
-extern unsigned long generic_find_next_le_bit(const unsigned long *addr,
-		unsigned long size, unsigned long offset);
-
-#else
-#error "Please fix <asm/byteorder.h>"
-#endif
-
 #define generic_find_first_zero_le_bit(addr, size) \
         generic_find_next_zero_le_bit((addr), (size), 0)
 
Signature · 1 line
1.7.1.231.gd0b16
#14 lore raw

PATCH v2 6/22 m68knommu: introduce little-endian bitops

In reply to a message not in the archive

Introduce little-endian bit operations by renaming native ext2 bit operations. The ext2 bit operations are kept as wrapper macros using little-endian bit operations to maintain bisectability until the conversions are finished.

Cc Greg Ungerer <[email protected]>
Cc Geert Uytterhoeven <[email protected]>
Cc Roman Zippel <[email protected]>
Cc Andreas Schwab <[email protected]>

---
No change from previous submission

 arch/m68k/include/asm/bitops_no.h |   40 +++++++++++++++++++++++++++++-------
 1 files changed, 32 insertions(+), 8 deletions(-)
arch/m68k/include/asm/bitops_no.h +32 -8
index 292e1ce..9f5eb02 100644
@@ -196,7 +196,15 @@ static __inline__ int __test_bit(int nr, const volatile unsigned long * addr)
 #include <asm-generic/bitops/hweight.h>
 #include <asm-generic/bitops/lock.h>
 
-static __inline__ int ext2_set_bit(int nr, volatile void * addr)
+#define BITOP_LE_SWIZZLE	((BITS_PER_LONG-1) & ~0x7)
+
+#define __set_le_bit(nr, addr) \
+	__set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
+
+#define __clear_le_bit(nr, addr) \
+	__clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
+
+static inline int __test_and_set_le_bit(int nr, volatile void *addr)
 {
 	char retval;
 
@@ -215,7 +223,7 @@ static __inline__ int ext2_set_bit(int nr, volatile void * addr)
 	return retval;
 }
 
-static __inline__ int ext2_clear_bit(int nr, volatile void * addr)
+static inline int __test_and_clear_le_bit(int nr, volatile void *addr)
 {
 	char retval;
 
@@ -238,7 +246,7 @@ static __inline__ int ext2_clear_bit(int nr, volatile void * addr)
 	({						\
 		int ret;				\
 		spin_lock(lock);			\
-		ret = ext2_set_bit((nr), (addr));	\
+		ret = __test_and_set_le_bit((nr), (addr));	\
 		spin_unlock(lock);			\
 		ret;					\
 	})
@@ -247,12 +255,12 @@ static __inline__ int ext2_clear_bit(int nr, volatile void * addr)
 	({						\
 		int ret;				\
 		spin_lock(lock);			\
-		ret = ext2_clear_bit((nr), (addr));	\
+		ret = __test_and_clear_le_bit((nr), (addr));	\
 		spin_unlock(lock);			\
 		ret;					\
 	})
 
-static __inline__ int ext2_test_bit(int nr, const volatile void * addr)
+static inline int test_le_bit(int nr, const volatile void *addr)
 {
 	char retval;
 
@@ -271,10 +279,10 @@ static __inline__ int ext2_test_bit(int nr, const volatile void * addr)
 	return retval;
 }
 
-#define ext2_find_first_zero_bit(addr, size) \
-        ext2_find_next_zero_bit((addr), (size), 0)
+#define find_first_zero_le_bit(addr, size)	\
+	find_next_zero_le_bit((addr), (size), 0)
 
-static __inline__ unsigned long ext2_find_next_zero_bit(void *addr, unsigned long size, unsigned long offset)
+static inline unsigned long find_next_zero_le_bit(void *addr, unsigned long size, unsigned long offset)
 {
 	unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
 	unsigned long result = offset & ~31UL;
@@ -324,8 +332,24 @@ found_middle:
 	return result + ffz(__swab32(tmp));
 }
 
+#define ext2_set_bit(nr, addr)	\
+	__test_and_set_le_bit(nr, addr)
+
+#define ext2_clear_bit(nr, addr)	\
+	test_and_clear_le_bit(nr, addr)
+
+#define ext2_test_bit(nr, addr)	\
+	test_le_bit(nr, addr)
+
+#define ext2_find_first_zero_bit(addr, size) \
+	find_first_zero_le_bit(addr, size)
+
+#define ext2_find_next_zero_bit(addr, size, offset)	\
+	find_next_zero_le_bit(addr, size, offset)
+
 #define ext2_find_next_bit(addr, size, off) \
 	find_next_le_bit((unsigned long *)(addr), (size), (off))
+
 #include <asm-generic/bitops/minix.h>
 
 #endif /* __KERNEL__ */
Signature · 1 line
1.7.1.231.gd0b16
#26 lore raw

PATCH v2 17/22 ufs: use little-endian bitops

In reply to a message not in the archive

As a preparation for removing ext2 non-atomic bit operations from asm/bitops.h. This converts ext2 non-atomic bit operations to little-endian bit operations.

Cc Evgeniy Dushistov <[email protected]>

---
No change from previous submission

 fs/ufs/util.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/ufs/util.h +1 -1
index 9f8775c..64f7559 100644
@@ -408,7 +408,7 @@ static inline unsigned _ubh_find_next_zero_bit_(
 	for (;;) {
 		count = min_t(unsigned int, size + offset, uspi->s_bpf);
 		size -= count - offset;
-		pos = ext2_find_next_zero_bit (ubh->bh[base]->b_data, count, offset);
+		pos = find_next_zero_le_bit((unsigned long *)ubh->bh[base]->b_data, count, offset);
 		if (pos < count || !size)
 			break;
 		base++;
Signature · 1 line
1.7.1.231.gd0b16
#33 lore raw

PATCH v2 21/22 m68k: remove inline asm from minix_find_first_zero_bit

In reply to a message not in the archive

As a preparation for moving minix bit operations from asm/bitops.h to architecture independent code in minix file system, this removes inline asm from minix_find_first_zero_bit() for m68k.

Cc Geert Uytterhoeven <[email protected]>
Cc Roman Zippel <[email protected]>
Cc Andreas Schwab <[email protected]>

---
First submission

 arch/m68k/include/asm/bitops_mm.h |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)
arch/m68k/include/asm/bitops_mm.h +3 -7
index 831d626..f31ed5a 100644
@@ -330,23 +330,19 @@ static inline int __fls(int x)
 static inline int minix_find_first_zero_bit(const void *vaddr, unsigned size)
 {
 	const unsigned short *p = vaddr, *addr = vaddr;
-	int res;
 	unsigned short num;
 
 	if (!size)
 		return 0;
 
 	size = (size >> 4) + ((size & 15) > 0);
-	while (*p++ == 0xffff)
-	{
+	while (*p++ == 0xffff) {
 		if (--size == 0)
 			return (p - addr) << 4;
 	}
 
-	num = ~*--p;
-	__asm__ __volatile__ ("bfffo %1{#16,#16},%0"
-			      : "=d" (res) : "d" (num & -num));
-	return ((p - addr) << 4) + (res ^ 31);
+	num = *--p;
+	return ((p - addr) << 4) + ffz(num);
 }
 
 #define minix_test_and_set_bit(nr, addr)	__test_and_set_bit((nr) ^ 16, (unsigned long *)(addr))
Signature · 1 line
1.7.1.231.gd0b16
maintainer Acked-by on v2 1/22
#2 lore raw

Re: [PATCH v2 01/22] bitops: merge little and big endian definisions in asm-generic/bitops/le.h

In reply to Akinobu Mita
Quoted 7 lines · Akinobu Mita

In order to make the forthcoming changes smaller, this merges macro definisions in asm-generic/bitops/le.h for big-endian and little-endian as much as possible.

This also removes unused BITOP_WORD macro.

maintainer Acked-by on v2 2/22
#4 lore raw
In reply to Akinobu Mita
Quoted 24 lines · Akinobu Mita

As a preparation for providing little-endian bitops for all architectures, This removes generic_ prefix from little-endian bitops function names in asm-generic/bitops/le.h.

s/generic_find_next_le_bit/find_next_le_bit/ s/generic_find_next_zero_le_bit/find_next_zero_le_bit/ s/generic_find_first_zero_le_bit/find_first_zero_le_bit/ s/generic___test_and_set_le_bit/__test_and_set_le_bit/ s/generic___test_and_clear_le_bit/__test_and_clear_le_bit/ s/generic_test_le_bit/test_le_bit/ s/generic___set_le_bit/__set_le_bit/ s/generic___clear_le_bit/__clear_le_bit/ s/generic_test_and_set_le_bit/test_and_set_le_bit/ s/generic_test_and_clear_le_bit/test_and_clear_le_bit/

Cc Hans-Christian Egtvedt <[email protected]>
Cc Geert Uytterhoeven <[email protected]>
Cc Roman Zippel <[email protected]>
Cc Andreas Schwab <[email protected]>
Cc Greg Ungerer <[email protected]>
Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Quoted 8 lines
maintainer Acked-by on v2 2/22
#5 lore raw
In reply to Akinobu Mita
Quoted 24 lines · Akinobu Mita

As a preparation for providing little-endian bitops for all architectures, This removes generic_ prefix from little-endian bitops function names in asm-generic/bitops/le.h.

s/generic_find_next_le_bit/find_next_le_bit/ s/generic_find_next_zero_le_bit/find_next_zero_le_bit/ s/generic_find_first_zero_le_bit/find_first_zero_le_bit/ s/generic___test_and_set_le_bit/__test_and_set_le_bit/ s/generic___test_and_clear_le_bit/__test_and_clear_le_bit/ s/generic_test_le_bit/test_le_bit/ s/generic___set_le_bit/__set_le_bit/ s/generic___clear_le_bit/__clear_le_bit/ s/generic_test_and_set_le_bit/test_and_set_le_bit/ s/generic_test_and_clear_le_bit/test_and_clear_le_bit/

Cc Hans-Christian Egtvedt <[email protected]>
Cc Geert Uytterhoeven <[email protected]>
Cc Roman Zippel <[email protected]>
Cc Andreas Schwab <[email protected]>
Cc Greg Ungerer <[email protected]>
Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Quoted 8 lines
maintainer Acked-by on v2 3/22
#9 lore raw

Re: [PATCH v2 03/22] s390: introduce little-endian bitops

In reply to Akinobu Mita
Quoted 10 lines · Akinobu Mita

Introduce little-endian bit operations by renaming native ext2 bit operations. The ext2 bit operations are kept as wrapper macros using little-endian bit operations to maintain bisectability until the conversions are finished.

maintainer Acked-by on v2 22/22
#35 lore raw

Re: [PATCH v2 22/22] bitops: remove minix bitops from asm/bitops.h

In reply to Akinobu Mita
Quoted 28 lines · Akinobu Mita

minix bit operations are only used by minix filesystem and useless by other modules. Because byte order of inode and block bitmaps is defferent on each architecture like below:

m68k:
big-endian 16bit indexed bitmaps

h8300, microblaze, s390, sparc, m68knommu:
big-endian 32 or 64bit indexed bitmaps

m32r, mips, sh, xtensa:
big-endian 32 or 64bit indexed bitmaps for big-endian mode little-endian bitmaps for little-endian mode

Others:
little-endian bitmaps

In order to move minix bit operations from asm/bitops.h to architecture independent code in minix file system, this provides two config options.

CONFIG_MINIX_FS_BIG_ENDIAN_16BIT_INDEXED is only selected by m68k. CONFIG_MINIX_FS_NATIVE_ENDIAN is selected by the architectures which use native byte order bitmaps (h8300, microblaze, s390, sparc, m68knommu, m32r, mips, sh, xtensa).
The architectures which always use little-endian bitmaps do not select these options.

Quoted 4 lines

Finally, we can remove minix bit operations from asm/bitops.h for all architectures.

maintainer Acked-by on v2 22/22
#36 lore raw

Re: [PATCH v2 22/22] bitops: remove minix bitops from asm/bitops.h

In reply to Akinobu Mita
Quoted 28 lines · Akinobu Mita

minix bit operations are only used by minix filesystem and useless by other modules. Because byte order of inode and block bitmaps is defferent on each architecture like below:

m68k:
big-endian 16bit indexed bitmaps

h8300, microblaze, s390, sparc, m68knommu:
big-endian 32 or 64bit indexed bitmaps

m32r, mips, sh, xtensa:
big-endian 32 or 64bit indexed bitmaps for big-endian mode little-endian bitmaps for little-endian mode

Others:
little-endian bitmaps

In order to move minix bit operations from asm/bitops.h to architecture independent code in minix file system, this provides two config options.

CONFIG_MINIX_FS_BIG_ENDIAN_16BIT_INDEXED is only selected by m68k. CONFIG_MINIX_FS_NATIVE_ENDIAN is selected by the architectures which use native byte order bitmaps (h8300, microblaze, s390, sparc, m68knommu, m32r, mips, sh, xtensa).
The architectures which always use little-endian bitmaps do not select these options.

Quoted 4 lines

Finally, we can remove minix bit operations from asm/bitops.h for all architectures.

#30 lore raw

Re: [PATCH v2 20/22] bitops: remove ext2 non-atomic bitops from asm/bitops.h

In reply to Akinobu Mita
Quoted 4 lines · Akinobu Mita

As the result of conversions, there are no users of ext2 non-atomic bit operations except for ext2 file system itself. Now we can put them into architecture independent code in ext2 file system, and remove from asm/bitops.h for all architectures.

Presumably there will be a separate patch series to remove the atomic ext2 bitops? I was going to suggest removing the ext2 comment in bitops.h, but I notice that there are still the atomic bitops left.

In any case, thanks for your efforts. I agree that these ext2_* functions have no place in the generic code, and are only there for historical reasons.

Quoted 12 lines
arch/arm/include/asm/bitops.h +0 -4
@@ -327,22 +327,10 @@ static inline int fls(int x)
 * Ext2 is defined to use little-endian byte ordering.
 * These do not need to be atomic.
 */
-#define ext2_set_bit(nr,p)			\
-		__test_and_set_le_bit(nr, (unsigned long *)(p))
 #define ext2_set_bit_atomic(lock,nr,p)          \
 		test_and_set_le_bit(nr, (unsigned long *)(p))
-#define ext2_clear_bit(nr,p)			\
-		__test_and_clear_le_bit(nr, (unsigned long *)(p))

arch/arm/include/asm/bitops.h static inline int fls(int x) · line 345

Quoted 10 lines
arch/arm/include/asm/bitops.h +0 -8
 #define ext2_clear_bit_atomic(lock,nr,p)        \
 		test_and_clear_le_bit(nr, (unsigned long *)(p))
-#define ext2_test_bit(nr,p)			\
-		test_le_bit(nr, (unsigned long *)(p))
-#define ext2_find_first_zero_bit(p,sz)		\
-		find_first_zero_le_bit((unsigned long *)(p), sz)
-#define ext2_find_next_zero_bit(p,sz,off)	\
-		find_next_zero_le_bit((unsigned long *)(p), sz, off)
-#define ext2_find_next_bit(p, sz, off) \
-		find_next_le_bit((unsigned long *)(p), sz, off)

Cheers, Andreas

#37 lore raw

Re: [PATCH v2 22/22] bitops: remove minix bitops from asm/bitops.h

In reply to Akinobu Mita
Quoted 9 lines · Akinobu Mita

minix bit operations are only used by minix filesystem and useless by other modules. Because byte order of inode and block bitmaps is defferent on each architecture like below:

m68k:
big-endian 16bit indexed bitmaps

h8300, microblaze, s390, sparc, m68knommu:
big-endian 32 or 64bit indexed bitmaps

Just one small fix microblaze little endian support is ready for merging to mainline which means that microblaze is
big-endian 32bit and little-endian 32bit

Quoted 12 lines

m32r, mips, sh, xtensa:
big-endian 32 or 64bit indexed bitmaps for big-endian mode little-endian bitmaps for little-endian mode

Others:
little-endian bitmaps

In order to move minix bit operations from asm/bitops.h to architecture independent code in minix file system, this provides two config options.

Quoted 6 lines

CONFIG_MINIX_FS_BIG_ENDIAN_16BIT_INDEXED is only selected by m68k. CONFIG_MINIX_FS_NATIVE_ENDIAN is selected by the architectures which use native byte order bitmaps (h8300, microblaze, s390, sparc, m68knommu, m32r, mips, sh, xtensa).
The architectures which always use little-endian bitmaps do not select these options.

I haven't created any Kconfig option for little/big endian microblaze but there should be a little bit different handling for MINIX_FS_NATIVE_ENDIAN as you are describing above.
Anyway I think you don't need to reflect this in your patch because we are not using that filesystem and I will write it to my to-do list and will fix it later.

Thanks,
Michal

Signature · 4 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian
#42 lore raw

Re: [PATCH v2 22/22] bitops: remove minix bitops from asm/bitops.h

In reply to Akinobu Mita
Quoted 9 lines · Akinobu Mita

minix bit operations are only used by minix filesystem and useless by other modules. Because byte order of inode and block bitmaps is defferent on each architecture like below:

m68k:
big-endian 16bit indexed bitmaps

h8300, microblaze, s390, sparc, m68knommu:
big-endian 32 or 64bit indexed bitmaps

Just one small fix microblaze little endian support is ready for merging to mainline which means that microblaze is
big-endian 32bit and little-endian 32bit

Quoted 12 lines

m32r, mips, sh, xtensa:
big-endian 32 or 64bit indexed bitmaps for big-endian mode little-endian bitmaps for little-endian mode

Others:
little-endian bitmaps

In order to move minix bit operations from asm/bitops.h to architecture independent code in minix file system, this provides two config options.

Quoted 6 lines

CONFIG_MINIX_FS_BIG_ENDIAN_16BIT_INDEXED is only selected by m68k. CONFIG_MINIX_FS_NATIVE_ENDIAN is selected by the architectures which use native byte order bitmaps (h8300, microblaze, s390, sparc, m68knommu, m32r, mips, sh, xtensa).
The architectures which always use little-endian bitmaps do not select these options.

I haven't created any Kconfig option for little/big endian microblaze but there should be a little bit different handling for MINIX_FS_NATIVE_ENDIAN as you are describing above.
Anyway I think you don't need to reflect this in your patch because we are not using that filesystem and I will write it to my to-do list and will fix it later.

Thanks,
Michal

Signature · 4 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian
Acked-by on v2 22/22
#43 lore raw

Re: [PATCH v2 22/22] bitops: remove minix bitops from asm/bitops.h

In reply to Akinobu Mita
Quoted 28 lines · Akinobu Mita

minix bit operations are only used by minix filesystem and useless by other modules. Because byte order of inode and block bitmaps is defferent on each architecture like below:

m68k:
big-endian 16bit indexed bitmaps

h8300, microblaze, s390, sparc, m68knommu:
big-endian 32 or 64bit indexed bitmaps

m32r, mips, sh, xtensa:
big-endian 32 or 64bit indexed bitmaps for big-endian mode little-endian bitmaps for little-endian mode

Others:
little-endian bitmaps

In order to move minix bit operations from asm/bitops.h to architecture independent code in minix file system, this provides two config options.

CONFIG_MINIX_FS_BIG_ENDIAN_16BIT_INDEXED is only selected by m68k. CONFIG_MINIX_FS_NATIVE_ENDIAN is selected by the architectures which use native byte order bitmaps (h8300, microblaze, s390, sparc, m68knommu, m32r, mips, sh, xtensa).
The architectures which always use little-endian bitmaps do not select these options.

Quoted 5 lines

Finally, we can remove minix bit operations from asm/bitops.h for all architectures.

I have no problems with the m68k part.

Quoted 517 lines
Cc Geert Uytterhoeven<[email protected]>
Cc Roman Zippel<[email protected]>
Cc Andreas Schwab<[email protected]>
Cc Martin Schwidefsky<[email protected]>
Cc Heiko Carstens<[email protected]>
Cc Yoshinori Sato<[email protected]>
Cc Michal Simek<[email protected]>
Cc "David S. Miller"<[email protected]>
Cc Hirokazu Takata<[email protected]>
Cc Ralf Baechle<[email protected]>
Cc Paul Mundt<[email protected]>
Cc Chris Zankel<[email protected]>

---
Mostly rewritten since previous submission

  arch/alpha/include/asm/bitops.h       |    2 -
  arch/arm/include/asm/bitops.h         |   14 ------
  arch/avr32/include/asm/bitops.h       |    1 -
  arch/blackfin/include/asm/bitops.h    |    1 -
  arch/cris/include/asm/bitops.h        |    1 -
  arch/frv/include/asm/bitops.h         |    2 -
  arch/h8300/include/asm/bitops.h       |    1 -
  arch/ia64/include/asm/bitops.h        |    1 -
  arch/m32r/include/asm/bitops.h        |    1 -
  arch/m68k/include/asm/bitops_mm.h     |   30 ------------
  arch/mips/include/asm/bitops.h        |    1 -
  arch/mn10300/include/asm/bitops.h     |    1 -
  arch/parisc/include/asm/bitops.h      |    2 -
  arch/powerpc/include/asm/bitops.h     |   14 ------
  arch/s390/include/asm/bitops.h        |    1 -
  arch/sh/include/asm/bitops.h          |    1 -
  arch/sparc/include/asm/bitops_32.h    |    1 -
  arch/sparc/include/asm/bitops_64.h    |    2 -
  arch/tile/include/asm/bitops.h        |    1 -
  arch/x86/include/asm/bitops.h         |    2 -
  arch/xtensa/include/asm/bitops.h      |    1 -
  fs/minix/Kconfig                      |    8 +++
  fs/minix/minix.h                      |   79 +++++++++++++++++++++++++++++++++
  include/asm-generic/bitops.h          |    1 -
  include/asm-generic/bitops/minix-le.h |   15 ------
  include/asm-generic/bitops/minix.h    |   15 ------
  26 files changed, 87 insertions(+), 112 deletions(-)

delete mode 100644 include/asm-generic/bitops/minix-le.h delete mode 100644 include/asm-generic/bitops/minix.h

arch/alpha/include/asm/bitops.h +0 -2
index 822433a..85b8152 100644
@@ -459,8 +459,6 @@ sched_find_first_bit(const unsigned long b[2])
  #define ext2_set_bit_atomic(l,n,a)   test_and_set_bit(n,a)
  #define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a)
 
-#include<asm-generic/bitops/minix.h>
-
  #endif /* __KERNEL__ */
 
  #endif /* _ALPHA_BITOPS_H */
arch/arm/include/asm/bitops.h +0 -14
index ac2edb4..59a2a2b 100644
@@ -332,20 +332,6 @@ static inline int fls(int x)
  #define ext2_clear_bit_atomic(lock,nr,p)        \
  		test_and_clear_le_bit(nr, (unsigned long *)(p))
 
-/*
- * Minix is defined to use little-endian byte ordering.
- * These do not need to be atomic.
- */
-#define minix_set_bit(nr,p)			\
-		__set_le_bit(nr, (unsigned long *)(p))
-#define minix_test_bit(nr,p)			\
-		test_le_bit(nr, (unsigned long *)(p))
-#define minix_test_and_set_bit(nr,p)		\
-		__test_and_set_le_bit(nr, (unsigned long *)(p))
-#define minix_test_and_clear_bit(nr,p)		\
-		__test_and_clear_le_bit(nr, (unsigned long *)(p))
-#define minix_find_first_zero_bit(p,sz)		\
-		find_first_zero_le_bit((unsigned long *)(p), sz)
 
  #endif /* __KERNEL__ */
 
arch/avr32/include/asm/bitops.h +0 -1
index 73a163a..72444d9 100644
@@ -301,6 +301,5 @@ static inline int ffs(unsigned long word)
 
  #include<asm-generic/bitops/le.h>
  #include<asm-generic/bitops/ext2-atomic.h>
-#include<asm-generic/bitops/minix-le.h>
 
  #endif /* __ASM_AVR32_BITOPS_H */
arch/blackfin/include/asm/bitops.h +0 -1
index 2c549f7..68843fa 100644
@@ -27,7 +27,6 @@
 
  #include<asm-generic/bitops/le.h>
  #include<asm-generic/bitops/ext2-atomic.h>
-#include<asm-generic/bitops/minix.h>
 
  #ifndef CONFIG_SMP
  #include<linux/irqflags.h>
arch/cris/include/asm/bitops.h +0 -1
index 71bea40..310e0de 100644
@@ -159,7 +159,6 @@ static inline int test_and_change_bit(int nr, volatile unsigned long *addr)
  #define ext2_set_bit_atomic(l,n,a)   test_and_set_bit(n,a)
  #define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a)
 
-#include<asm-generic/bitops/minix.h>
  #include<asm-generic/bitops/sched.h>
 
  #endif /* __KERNEL__ */
arch/frv/include/asm/bitops.h +0 -2
index e3ea644..a1d00b0 100644
@@ -406,8 +406,6 @@ int __ilog2_u64(u64 n)
  #define ext2_set_bit_atomic(lock,nr,addr)	test_and_set_bit  ((nr) ^ 0x18, (addr))
  #define ext2_clear_bit_atomic(lock,nr,addr)	test_and_clear_bit((nr) ^ 0x18, (addr))
 
-#include<asm-generic/bitops/minix-le.h>
-
  #endif /* __KERNEL__ */
 
  #endif /* _ASM_BITOPS_H */
arch/h8300/include/asm/bitops.h +0 -1
index 23cea66..e856c1b 100644
@@ -202,7 +202,6 @@ static __inline__ unsigned long __ffs(unsigned long word)
  #include<asm-generic/bitops/lock.h>
  #include<asm-generic/bitops/le.h>
  #include<asm-generic/bitops/ext2-atomic.h>
-#include<asm-generic/bitops/minix.h>
 
  #endif /* __KERNEL__ */
 
arch/ia64/include/asm/bitops.h +0 -1
index 336984a..b76f7e0 100644
@@ -461,7 +461,6 @@ static __inline__ unsigned long __arch_hweight64(unsigned long x)
  #define ext2_set_bit_atomic(l,n,a)	test_and_set_bit(n,a)
  #define ext2_clear_bit_atomic(l,n,a)	test_and_clear_bit(n,a)
 
-#include<asm-generic/bitops/minix.h>
  #include<asm-generic/bitops/sched.h>
 
  #endif /* __KERNEL__ */
arch/m32r/include/asm/bitops.h +0 -1
index cdfb4c8..6300f22 100644
@@ -268,7 +268,6 @@ static __inline__ int test_and_change_bit(int nr, volatile void * addr)
 
  #include<asm-generic/bitops/le.h>
  #include<asm-generic/bitops/ext2-atomic.h>
-#include<asm-generic/bitops/minix.h>
 
  #endif /* __KERNEL__ */
 
arch/m68k/include/asm/bitops_mm.h +0 -30
index f31ed5a..5f06275 100644
@@ -325,36 +325,6 @@ static inline int __fls(int x)
  #include<asm-generic/bitops/hweight.h>
  #include<asm-generic/bitops/lock.h>
 
-/* Bitmap functions for the minix filesystem */
-
-static inline int minix_find_first_zero_bit(const void *vaddr, unsigned size)
-{
-	const unsigned short *p = vaddr, *addr = vaddr;
-	unsigned short num;
-
-	if (!size)
-		return 0;
-
-	size = (size>>  4) + ((size&  15)>  0);
-	while (*p++ == 0xffff) {
-		if (--size == 0)
-			return (p - addr)<<  4;
-	}
-
-	num = *--p;
-	return ((p - addr)<<  4) + ffz(num);
-}
-
-#define minix_test_and_set_bit(nr, addr)	__test_and_set_bit((nr) ^ 16, (unsigned long *)(addr))
-#define minix_set_bit(nr,addr)			__set_bit((nr) ^ 16, (unsigned long *)(addr))
-#define minix_test_and_clear_bit(nr, addr)	__test_and_clear_bit((nr) ^ 16, (unsigned long *)(addr))
-
-static inline int minix_test_bit(int nr, const void *vaddr)
-{
-	const unsigned short *p = vaddr;
-	return (p[nr>>  4]&  (1U<<  (nr&  15))) != 0;
-}
-
  /* Bitmap functions for little endian. */
 
  #define __set_le_bit(nr, addr)	\
arch/mips/include/asm/bitops.h +0 -1
index 07ce5aa..6a2202c 100644
@@ -706,7 +706,6 @@ static inline int ffs(int word)
 
  #include<asm-generic/bitops/le.h>
  #include<asm-generic/bitops/ext2-atomic.h>
-#include<asm-generic/bitops/minix.h>
 
  #endif /* __KERNEL__ */
 
arch/mn10300/include/asm/bitops.h +0 -1
index e1a9768..94ee844 100644
@@ -234,7 +234,6 @@ int ffs(int x)
  	test_and_clear_bit((nr), (addr))
 
  #include<asm-generic/bitops/le.h>
-#include<asm-generic/bitops/minix-le.h>
 
  #endif /* __KERNEL__ */
  #endif /* __ASM_BITOPS_H */
arch/parisc/include/asm/bitops.h +0 -2
index 919d7ed..43c516f 100644
@@ -234,6 +234,4 @@ static __inline__ int fls(int x)
 
  #endif	/* __KERNEL__ */
 
-#include<asm-generic/bitops/minix-le.h>
-
  #endif /* _PARISC_BITOPS_H */
arch/powerpc/include/asm/bitops.h +0 -14
index eb9ce7f..bf5ccfc 100644
@@ -308,20 +308,6 @@ unsigned long find_next_le_bit(const unsigned long *addr,
  #define ext2_clear_bit_atomic(lock, nr, addr) \
  	test_and_clear_le_bit((nr), (unsigned long*)addr)
 
-/* Bitmap functions for the minix filesystem.  */
-
-#define minix_test_and_set_bit(nr,addr) \
-	__test_and_set_le_bit(nr, (unsigned long *)addr)
-#define minix_set_bit(nr,addr) \
-	__set_le_bit(nr, (unsigned long *)addr)
-#define minix_test_and_clear_bit(nr,addr) \
-	__test_and_clear_le_bit(nr, (unsigned long *)addr)
-#define minix_test_bit(nr,addr) \
-	test_le_bit(nr, (unsigned long *)addr)
-
-#define minix_find_first_zero_bit(addr,size) \
-	find_first_zero_le_bit((unsigned long *)addr, size)
-
  #include<asm-generic/bitops/sched.h>
 
  #endif /* __KERNEL__ */
arch/s390/include/asm/bitops.h +0 -1
index 1bd1e11..e537613 100644
@@ -842,7 +842,6 @@ static inline int find_next_le_bit(void *vaddr, unsigned long size,
  #define ext2_clear_bit_atomic(lock, nr, addr)     \
  	test_and_clear_le_bit((nr), (unsigned long *)(addr))
 
-#include<asm-generic/bitops/minix.h>
 
  #endif /* __KERNEL__ */
 
arch/sh/include/asm/bitops.h +0 -1
index fc5cd5b..90fa3e4 100644
@@ -96,7 +96,6 @@ static inline unsigned long ffz(unsigned long word)
  #include<asm-generic/bitops/sched.h>
  #include<asm-generic/bitops/le.h>
  #include<asm-generic/bitops/ext2-atomic.h>
-#include<asm-generic/bitops/minix.h>
  #include<asm-generic/bitops/fls.h>
  #include<asm-generic/bitops/__fls.h>
  #include<asm-generic/bitops/fls64.h>
arch/sparc/include/asm/bitops_32.h +0 -1
index 75da6f8..25a6766 100644
@@ -105,7 +105,6 @@ static inline void change_bit(unsigned long nr, volatile unsigned long *addr)
  #include<asm-generic/bitops/find.h>
  #include<asm-generic/bitops/le.h>
  #include<asm-generic/bitops/ext2-atomic.h>
-#include<asm-generic/bitops/minix.h>
 
  #endif /* __KERNEL__ */
 
arch/sparc/include/asm/bitops_64.h +0 -2
index 66db28e..38e9aa1 100644
@@ -96,8 +96,6 @@ static inline unsigned int __arch_hweight8(unsigned int w)
  #define ext2_clear_bit_atomic(lock,nr,addr) \
  	test_and_clear_bit((nr) ^ 0x38,(unsigned long *)(addr))
 
-#include<asm-generic/bitops/minix.h>
-
  #endif /* __KERNEL__ */
 
  #endif /* defined(_SPARC64_BITOPS_H) */
arch/tile/include/asm/bitops.h +0 -1
index 5447add..132e6bb 100644
@@ -123,6 +123,5 @@ static inline unsigned long __arch_hweight64(__u64 w)
  #include<asm-generic/bitops/find.h>
  #include<asm-generic/bitops/sched.h>
  #include<asm-generic/bitops/le.h>
-#include<asm-generic/bitops/minix.h>
 
  #endif /* _ASM_TILE_BITOPS_H */
arch/x86/include/asm/bitops.h +0 -2
index 3c95e07..69d5813 100644
@@ -463,7 +463,5 @@ static inline int fls(int x)
  #define ext2_clear_bit_atomic(lock, nr, addr)			\
  	test_and_clear_bit((nr), (unsigned long *)(addr))
 
-#include<asm-generic/bitops/minix.h>
-
  #endif /* __KERNEL__ */
  #endif /* _ASM_X86_BITOPS_H */
arch/xtensa/include/asm/bitops.h +0 -1
index a56b7b5..c8fac8d 100644
@@ -125,7 +125,6 @@ static inline unsigned long __fls(unsigned long word)
  #include<asm-generic/bitops/hweight.h>
  #include<asm-generic/bitops/lock.h>
  #include<asm-generic/bitops/sched.h>
-#include<asm-generic/bitops/minix.h>
 
  #endif	/* __KERNEL__ */
 
fs/minix/Kconfig +8 -0
index 0fd7ca9..6624684 100644
@@ -15,3 +15,11 @@ config MINIX_FS
  	  module will be called minix.  Note that the file system of your root
  	  partition (the one containing the directory /) cannot be compiled as
  	  a module.
+
+config MINIX_FS_NATIVE_ENDIAN
+	def_bool MINIX_FS
+	depends on H8300 || M32R || MICROBLAZE || MIPS || S390 || SUPERH || SPARC || XTENSA || (M68K&&  !MMU)
+
+config MINIX_FS_BIG_ENDIAN_16BIT_INDEXED
+	def_bool MINIX_FS
+	depends on M68K&&  MMU
fs/minix/minix.h +79 -0
index 407b1c8..9dfd62c 100644
@@ -88,4 +88,83 @@ static inline struct minix_inode_info *minix_i(struct inode *inode)
  	return list_entry(inode, struct minix_inode_info, vfs_inode);
  }
 
+#if defined(CONFIG_MINIX_FS_NATIVE_ENDIAN)&&  \
+	defined(CONFIG_MINIX_FS_BIG_ENDIAN_16BIT_INDEXED)
+
+#error Minix file system byte order broken
+
+#elif defined(CONFIG_MINIX_FS_NATIVE_ENDIAN)
+
+/*
+ * big-endian 32 or 64 bit indexed bitmaps on big-endian system or
+ * little-endian bitmaps on little-endian system
+ */
+
+#define minix_test_and_set_bit(nr, addr)	\
+	__test_and_set_bit((nr), (unsigned long *)(addr))
+#define minix_set_bit(nr, addr)		\
+	__set_bit((nr), (unsigned long *)(addr))
+#define minix_test_and_clear_bit(nr, addr) \
+	__test_and_clear_bit((nr), (unsigned long *)(addr))
+#define minix_test_bit(nr, addr)		\
+	test_bit((nr), (unsigned long *)(addr))
+#define minix_find_first_zero_bit(addr, size) \
+	find_first_zero_bit((unsigned long *)(addr), (size))
+
+#elif defined(CONFIG_MINIX_FS_BIG_ENDIAN_16BIT_INDEXED)
+
+/*
+ * big-endian 16bit indexed bitmaps
+ */
+
+static inline int minix_find_first_zero_bit(const void *vaddr, unsigned size)
+{
+	const unsigned short *p = vaddr, *addr = vaddr;
+	unsigned short num;
+
+	if (!size)
+		return 0;
+
+	size = (size>>  4) + ((size&  15)>  0);
+	while (*p++ == 0xffff) {
+		if (--size == 0)
+			return (p - addr)<<  4;
+	}
+
+	num = *--p;
+	return ((p - addr)<<  4) + ffz(num);
+}
+
+#define minix_test_and_set_bit(nr, addr)	\
+	__test_and_set_bit((nr) ^ 16, (unsigned long *)(addr))
+#define minix_set_bit(nr, addr)	\
+	__set_bit((nr) ^ 16, (unsigned long *)(addr))
+#define minix_test_and_clear_bit(nr, addr)	\
+	__test_and_clear_bit((nr) ^ 16, (unsigned long *)(addr))
+
+static inline int minix_test_bit(int nr, const void *vaddr)
+{
+	const unsigned short *p = vaddr;
+	return (p[nr>>  4]&  (1U<<  (nr&  15))) != 0;
+}
+
+#else
+
+/*
+ * little-endian bitmaps
+ */
+
+#define minix_test_and_set_bit(nr, addr)	\
+	__test_and_set_le_bit((nr), (unsigned long *)(addr))
+#define minix_set_bit(nr, addr)		\
+	__set_le_bit((nr), (unsigned long *)(addr))
+#define minix_test_and_clear_bit(nr, addr) \
+	__test_and_clear_le_bit((nr), (unsigned long *)(addr))
+#define minix_test_bit(nr, addr)		\
+	test_le_bit((nr), (unsigned long *)(addr))
+#define minix_find_first_zero_bit(addr, size) \
+	find_first_zero_le_bit((unsigned long *)(addr), (size))
+
+#endif
+
  #endif /* FS_MINIX_H */
include/asm-generic/bitops.h +0 -1
index dd7c014..280ca7a 100644
@@ -40,6 +40,5 @@
  #include<asm-generic/bitops/non-atomic.h>
  #include<asm-generic/bitops/le.h>
  #include<asm-generic/bitops/ext2-atomic.h>
-#include<asm-generic/bitops/minix.h>
 
  #endif /* __ASM_GENERIC_BITOPS_H */
include/asm-generic/bitops/minix-le.h deleted +0 -15
deleted file mode 100644
index f366cfa..0000000
@@ -1,15 +0,0 @@
-#ifndef _ASM_GENERIC_BITOPS_MINIX_LE_H_
-#define _ASM_GENERIC_BITOPS_MINIX_LE_H_
-
-#define minix_test_and_set_bit(nr,addr)	\
-	__test_and_set_le_bit((nr), (unsigned long *)(addr))
-#define minix_set_bit(nr,addr)		\
-	__set_le_bit((nr), (unsigned long *)(addr))
-#define minix_test_and_clear_bit(nr,addr) \
-	__test_and_clear_le_bit((nr), (unsigned long *)(addr))
-#define minix_test_bit(nr,addr)		\
-	test_le_bit((nr), (unsigned long *)(addr))
-#define minix_find_first_zero_bit(addr,size) \
-	find_first_zero_le_bit((unsigned long *)(addr), (size))
-
-#endif /* _ASM_GENERIC_BITOPS_MINIX_LE_H_ */
include/asm-generic/bitops/minix.h deleted +0 -15
deleted file mode 100644
index 91f42e8..0000000
@@ -1,15 +0,0 @@
-#ifndef _ASM_GENERIC_BITOPS_MINIX_H_
-#define _ASM_GENERIC_BITOPS_MINIX_H_
-
-#define minix_test_and_set_bit(nr,addr)	\
-	__test_and_set_bit((nr),(unsigned long *)(addr))
-#define minix_set_bit(nr,addr)		\
-	__set_bit((nr),(unsigned long *)(addr))
-#define minix_test_and_clear_bit(nr,addr) \
-	__test_and_clear_bit((nr),(unsigned long *)(addr))
-#define minix_test_bit(nr,addr)		\
-	test_bit((nr),(unsigned long *)(addr))
-#define minix_find_first_zero_bit(addr,size) \
-	find_first_zero_bit((unsigned long *)(addr),(size))
-
-#endif /* _ASM_GENERIC_BITOPS_MINIX_H_ */
Signature · 5 lines
------------------------------------------------------------------------
Greg Ungerer  --  Principal Engineer        EMAIL:     [email protected]
SnapGear Group, McAfee                      PHONE:       +61 7 3435 2888
8 Gardner Close                             FAX:         +61 7 3217 5323
Milton, QLD, 4064, Australia                WEB: http://www.SnapGear.com
Acked-by on v2 22/22
#44 lore raw

Re: [PATCH v2 22/22] bitops: remove minix bitops from asm/bitops.h

In reply to Akinobu Mita
Quoted 28 lines · Akinobu Mita

minix bit operations are only used by minix filesystem and useless by other modules. Because byte order of inode and block bitmaps is defferent on each architecture like below:

m68k:
big-endian 16bit indexed bitmaps

h8300, microblaze, s390, sparc, m68knommu:
big-endian 32 or 64bit indexed bitmaps

m32r, mips, sh, xtensa:
big-endian 32 or 64bit indexed bitmaps for big-endian mode little-endian bitmaps for little-endian mode

Others:
little-endian bitmaps

In order to move minix bit operations from asm/bitops.h to architecture independent code in minix file system, this provides two config options.

CONFIG_MINIX_FS_BIG_ENDIAN_16BIT_INDEXED is only selected by m68k. CONFIG_MINIX_FS_NATIVE_ENDIAN is selected by the architectures which use native byte order bitmaps (h8300, microblaze, s390, sparc, m68knommu, m32r, mips, sh, xtensa).
The architectures which always use little-endian bitmaps do not select these options.

Quoted 5 lines

Finally, we can remove minix bit operations from asm/bitops.h for all architectures.

I have no problems with the m68k part.

Quoted 517 lines
Cc Geert Uytterhoeven<[email protected]>
Cc Roman Zippel<[email protected]>
Cc Andreas Schwab<[email protected]>
Cc Martin Schwidefsky<[email protected]>
Cc Heiko Carstens<[email protected]>
Cc Yoshinori Sato<[email protected]>
Cc Michal Simek<[email protected]>
Cc "David S. Miller"<[email protected]>
Cc Hirokazu Takata<[email protected]>
Cc Ralf Baechle<[email protected]>
Cc Paul Mundt<[email protected]>
Cc Chris Zankel<[email protected]>

---
Mostly rewritten since previous submission

  arch/alpha/include/asm/bitops.h       |    2 -
  arch/arm/include/asm/bitops.h         |   14 ------
  arch/avr32/include/asm/bitops.h       |    1 -
  arch/blackfin/include/asm/bitops.h    |    1 -
  arch/cris/include/asm/bitops.h        |    1 -
  arch/frv/include/asm/bitops.h         |    2 -
  arch/h8300/include/asm/bitops.h       |    1 -
  arch/ia64/include/asm/bitops.h        |    1 -
  arch/m32r/include/asm/bitops.h        |    1 -
  arch/m68k/include/asm/bitops_mm.h     |   30 ------------
  arch/mips/include/asm/bitops.h        |    1 -
  arch/mn10300/include/asm/bitops.h     |    1 -
  arch/parisc/include/asm/bitops.h      |    2 -
  arch/powerpc/include/asm/bitops.h     |   14 ------
  arch/s390/include/asm/bitops.h        |    1 -
  arch/sh/include/asm/bitops.h          |    1 -
  arch/sparc/include/asm/bitops_32.h    |    1 -
  arch/sparc/include/asm/bitops_64.h    |    2 -
  arch/tile/include/asm/bitops.h        |    1 -
  arch/x86/include/asm/bitops.h         |    2 -
  arch/xtensa/include/asm/bitops.h      |    1 -
  fs/minix/Kconfig                      |    8 +++
  fs/minix/minix.h                      |   79 +++++++++++++++++++++++++++++++++
  include/asm-generic/bitops.h          |    1 -
  include/asm-generic/bitops/minix-le.h |   15 ------
  include/asm-generic/bitops/minix.h    |   15 ------
  26 files changed, 87 insertions(+), 112 deletions(-)

delete mode 100644 include/asm-generic/bitops/minix-le.h delete mode 100644 include/asm-generic/bitops/minix.h

arch/alpha/include/asm/bitops.h +0 -2
index 822433a..85b8152 100644
@@ -459,8 +459,6 @@ sched_find_first_bit(const unsigned long b[2])
  #define ext2_set_bit_atomic(l,n,a)   test_and_set_bit(n,a)
  #define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a)
 
-#include<asm-generic/bitops/minix.h>
-
  #endif /* __KERNEL__ */
 
  #endif /* _ALPHA_BITOPS_H */
arch/arm/include/asm/bitops.h +0 -14
index ac2edb4..59a2a2b 100644
@@ -332,20 +332,6 @@ static inline int fls(int x)
  #define ext2_clear_bit_atomic(lock,nr,p)        \
  		test_and_clear_le_bit(nr, (unsigned long *)(p))
 
-/*
- * Minix is defined to use little-endian byte ordering.
- * These do not need to be atomic.
- */
-#define minix_set_bit(nr,p)			\
-		__set_le_bit(nr, (unsigned long *)(p))
-#define minix_test_bit(nr,p)			\
-		test_le_bit(nr, (unsigned long *)(p))
-#define minix_test_and_set_bit(nr,p)		\
-		__test_and_set_le_bit(nr, (unsigned long *)(p))
-#define minix_test_and_clear_bit(nr,p)		\
-		__test_and_clear_le_bit(nr, (unsigned long *)(p))
-#define minix_find_first_zero_bit(p,sz)		\
-		find_first_zero_le_bit((unsigned long *)(p), sz)
 
  #endif /* __KERNEL__ */
 
arch/avr32/include/asm/bitops.h +0 -1
index 73a163a..72444d9 100644
@@ -301,6 +301,5 @@ static inline int ffs(unsigned long word)
 
  #include<asm-generic/bitops/le.h>
  #include<asm-generic/bitops/ext2-atomic.h>
-#include<asm-generic/bitops/minix-le.h>
 
  #endif /* __ASM_AVR32_BITOPS_H */
arch/blackfin/include/asm/bitops.h +0 -1
index 2c549f7..68843fa 100644
@@ -27,7 +27,6 @@
 
  #include<asm-generic/bitops/le.h>
  #include<asm-generic/bitops/ext2-atomic.h>
-#include<asm-generic/bitops/minix.h>
 
  #ifndef CONFIG_SMP
  #include<linux/irqflags.h>
arch/cris/include/asm/bitops.h +0 -1
index 71bea40..310e0de 100644
@@ -159,7 +159,6 @@ static inline int test_and_change_bit(int nr, volatile unsigned long *addr)
  #define ext2_set_bit_atomic(l,n,a)   test_and_set_bit(n,a)
  #define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a)
 
-#include<asm-generic/bitops/minix.h>
  #include<asm-generic/bitops/sched.h>
 
  #endif /* __KERNEL__ */
arch/frv/include/asm/bitops.h +0 -2
index e3ea644..a1d00b0 100644
@@ -406,8 +406,6 @@ int __ilog2_u64(u64 n)
  #define ext2_set_bit_atomic(lock,nr,addr)	test_and_set_bit  ((nr) ^ 0x18, (addr))
  #define ext2_clear_bit_atomic(lock,nr,addr)	test_and_clear_bit((nr) ^ 0x18, (addr))
 
-#include<asm-generic/bitops/minix-le.h>
-
  #endif /* __KERNEL__ */
 
  #endif /* _ASM_BITOPS_H */
arch/h8300/include/asm/bitops.h +0 -1
index 23cea66..e856c1b 100644
@@ -202,7 +202,6 @@ static __inline__ unsigned long __ffs(unsigned long word)
  #include<asm-generic/bitops/lock.h>
  #include<asm-generic/bitops/le.h>
  #include<asm-generic/bitops/ext2-atomic.h>
-#include<asm-generic/bitops/minix.h>
 
  #endif /* __KERNEL__ */
 
arch/ia64/include/asm/bitops.h +0 -1
index 336984a..b76f7e0 100644
@@ -461,7 +461,6 @@ static __inline__ unsigned long __arch_hweight64(unsigned long x)
  #define ext2_set_bit_atomic(l,n,a)	test_and_set_bit(n,a)
  #define ext2_clear_bit_atomic(l,n,a)	test_and_clear_bit(n,a)
 
-#include<asm-generic/bitops/minix.h>
  #include<asm-generic/bitops/sched.h>
 
  #endif /* __KERNEL__ */
arch/m32r/include/asm/bitops.h +0 -1
index cdfb4c8..6300f22 100644
@@ -268,7 +268,6 @@ static __inline__ int test_and_change_bit(int nr, volatile void * addr)
 
  #include<asm-generic/bitops/le.h>
  #include<asm-generic/bitops/ext2-atomic.h>
-#include<asm-generic/bitops/minix.h>
 
  #endif /* __KERNEL__ */
 
arch/m68k/include/asm/bitops_mm.h +0 -30
index f31ed5a..5f06275 100644
@@ -325,36 +325,6 @@ static inline int __fls(int x)
  #include<asm-generic/bitops/hweight.h>
  #include<asm-generic/bitops/lock.h>
 
-/* Bitmap functions for the minix filesystem */
-
-static inline int minix_find_first_zero_bit(const void *vaddr, unsigned size)
-{
-	const unsigned short *p = vaddr, *addr = vaddr;
-	unsigned short num;
-
-	if (!size)
-		return 0;
-
-	size = (size>>  4) + ((size&  15)>  0);
-	while (*p++ == 0xffff) {
-		if (--size == 0)
-			return (p - addr)<<  4;
-	}
-
-	num = *--p;
-	return ((p - addr)<<  4) + ffz(num);
-}
-
-#define minix_test_and_set_bit(nr, addr)	__test_and_set_bit((nr) ^ 16, (unsigned long *)(addr))
-#define minix_set_bit(nr,addr)			__set_bit((nr) ^ 16, (unsigned long *)(addr))
-#define minix_test_and_clear_bit(nr, addr)	__test_and_clear_bit((nr) ^ 16, (unsigned long *)(addr))
-
-static inline int minix_test_bit(int nr, const void *vaddr)
-{
-	const unsigned short *p = vaddr;
-	return (p[nr>>  4]&  (1U<<  (nr&  15))) != 0;
-}
-
  /* Bitmap functions for little endian. */
 
  #define __set_le_bit(nr, addr)	\
arch/mips/include/asm/bitops.h +0 -1
index 07ce5aa..6a2202c 100644
@@ -706,7 +706,6 @@ static inline int ffs(int word)
 
  #include<asm-generic/bitops/le.h>
  #include<asm-generic/bitops/ext2-atomic.h>
-#include<asm-generic/bitops/minix.h>
 
  #endif /* __KERNEL__ */
 
arch/mn10300/include/asm/bitops.h +0 -1
index e1a9768..94ee844 100644
@@ -234,7 +234,6 @@ int ffs(int x)
  	test_and_clear_bit((nr), (addr))
 
  #include<asm-generic/bitops/le.h>
-#include<asm-generic/bitops/minix-le.h>
 
  #endif /* __KERNEL__ */
  #endif /* __ASM_BITOPS_H */
arch/parisc/include/asm/bitops.h +0 -2
index 919d7ed..43c516f 100644
@@ -234,6 +234,4 @@ static __inline__ int fls(int x)
 
  #endif	/* __KERNEL__ */
 
-#include<asm-generic/bitops/minix-le.h>
-
  #endif /* _PARISC_BITOPS_H */
arch/powerpc/include/asm/bitops.h +0 -14
index eb9ce7f..bf5ccfc 100644
@@ -308,20 +308,6 @@ unsigned long find_next_le_bit(const unsigned long *addr,
  #define ext2_clear_bit_atomic(lock, nr, addr) \
  	test_and_clear_le_bit((nr), (unsigned long*)addr)
 
-/* Bitmap functions for the minix filesystem.  */
-
-#define minix_test_and_set_bit(nr,addr) \
-	__test_and_set_le_bit(nr, (unsigned long *)addr)
-#define minix_set_bit(nr,addr) \
-	__set_le_bit(nr, (unsigned long *)addr)
-#define minix_test_and_clear_bit(nr,addr) \
-	__test_and_clear_le_bit(nr, (unsigned long *)addr)
-#define minix_test_bit(nr,addr) \
-	test_le_bit(nr, (unsigned long *)addr)
-
-#define minix_find_first_zero_bit(addr,size) \
-	find_first_zero_le_bit((unsigned long *)addr, size)
-
  #include<asm-generic/bitops/sched.h>
 
  #endif /* __KERNEL__ */
arch/s390/include/asm/bitops.h +0 -1
index 1bd1e11..e537613 100644
@@ -842,7 +842,6 @@ static inline int find_next_le_bit(void *vaddr, unsigned long size,
  #define ext2_clear_bit_atomic(lock, nr, addr)     \
  	test_and_clear_le_bit((nr), (unsigned long *)(addr))
 
-#include<asm-generic/bitops/minix.h>
 
  #endif /* __KERNEL__ */
 
arch/sh/include/asm/bitops.h +0 -1
index fc5cd5b..90fa3e4 100644
@@ -96,7 +96,6 @@ static inline unsigned long ffz(unsigned long word)
  #include<asm-generic/bitops/sched.h>
  #include<asm-generic/bitops/le.h>
  #include<asm-generic/bitops/ext2-atomic.h>
-#include<asm-generic/bitops/minix.h>
  #include<asm-generic/bitops/fls.h>
  #include<asm-generic/bitops/__fls.h>
  #include<asm-generic/bitops/fls64.h>
arch/sparc/include/asm/bitops_32.h +0 -1
index 75da6f8..25a6766 100644
@@ -105,7 +105,6 @@ static inline void change_bit(unsigned long nr, volatile unsigned long *addr)
  #include<asm-generic/bitops/find.h>
  #include<asm-generic/bitops/le.h>
  #include<asm-generic/bitops/ext2-atomic.h>
-#include<asm-generic/bitops/minix.h>
 
  #endif /* __KERNEL__ */
 
arch/sparc/include/asm/bitops_64.h +0 -2
index 66db28e..38e9aa1 100644
@@ -96,8 +96,6 @@ static inline unsigned int __arch_hweight8(unsigned int w)
  #define ext2_clear_bit_atomic(lock,nr,addr) \
  	test_and_clear_bit((nr) ^ 0x38,(unsigned long *)(addr))
 
-#include<asm-generic/bitops/minix.h>
-
  #endif /* __KERNEL__ */
 
  #endif /* defined(_SPARC64_BITOPS_H) */
arch/tile/include/asm/bitops.h +0 -1
index 5447add..132e6bb 100644
@@ -123,6 +123,5 @@ static inline unsigned long __arch_hweight64(__u64 w)
  #include<asm-generic/bitops/find.h>
  #include<asm-generic/bitops/sched.h>
  #include<asm-generic/bitops/le.h>
-#include<asm-generic/bitops/minix.h>
 
  #endif /* _ASM_TILE_BITOPS_H */
arch/x86/include/asm/bitops.h +0 -2
index 3c95e07..69d5813 100644
@@ -463,7 +463,5 @@ static inline int fls(int x)
  #define ext2_clear_bit_atomic(lock, nr, addr)			\
  	test_and_clear_bit((nr), (unsigned long *)(addr))
 
-#include<asm-generic/bitops/minix.h>
-
  #endif /* __KERNEL__ */
  #endif /* _ASM_X86_BITOPS_H */
arch/xtensa/include/asm/bitops.h +0 -1
index a56b7b5..c8fac8d 100644
@@ -125,7 +125,6 @@ static inline unsigned long __fls(unsigned long word)
  #include<asm-generic/bitops/hweight.h>
  #include<asm-generic/bitops/lock.h>
  #include<asm-generic/bitops/sched.h>
-#include<asm-generic/bitops/minix.h>
 
  #endif	/* __KERNEL__ */
 
fs/minix/Kconfig +8 -0
index 0fd7ca9..6624684 100644
@@ -15,3 +15,11 @@ config MINIX_FS
  	  module will be called minix.  Note that the file system of your root
  	  partition (the one containing the directory /) cannot be compiled as
  	  a module.
+
+config MINIX_FS_NATIVE_ENDIAN
+	def_bool MINIX_FS
+	depends on H8300 || M32R || MICROBLAZE || MIPS || S390 || SUPERH || SPARC || XTENSA || (M68K&&  !MMU)
+
+config MINIX_FS_BIG_ENDIAN_16BIT_INDEXED
+	def_bool MINIX_FS
+	depends on M68K&&  MMU
fs/minix/minix.h +79 -0
index 407b1c8..9dfd62c 100644
@@ -88,4 +88,83 @@ static inline struct minix_inode_info *minix_i(struct inode *inode)
  	return list_entry(inode, struct minix_inode_info, vfs_inode);
  }
 
+#if defined(CONFIG_MINIX_FS_NATIVE_ENDIAN)&&  \
+	defined(CONFIG_MINIX_FS_BIG_ENDIAN_16BIT_INDEXED)
+
+#error Minix file system byte order broken
+
+#elif defined(CONFIG_MINIX_FS_NATIVE_ENDIAN)
+
+/*
+ * big-endian 32 or 64 bit indexed bitmaps on big-endian system or
+ * little-endian bitmaps on little-endian system
+ */
+
+#define minix_test_and_set_bit(nr, addr)	\
+	__test_and_set_bit((nr), (unsigned long *)(addr))
+#define minix_set_bit(nr, addr)		\
+	__set_bit((nr), (unsigned long *)(addr))
+#define minix_test_and_clear_bit(nr, addr) \
+	__test_and_clear_bit((nr), (unsigned long *)(addr))
+#define minix_test_bit(nr, addr)		\
+	test_bit((nr), (unsigned long *)(addr))
+#define minix_find_first_zero_bit(addr, size) \
+	find_first_zero_bit((unsigned long *)(addr), (size))
+
+#elif defined(CONFIG_MINIX_FS_BIG_ENDIAN_16BIT_INDEXED)
+
+/*
+ * big-endian 16bit indexed bitmaps
+ */
+
+static inline int minix_find_first_zero_bit(const void *vaddr, unsigned size)
+{
+	const unsigned short *p = vaddr, *addr = vaddr;
+	unsigned short num;
+
+	if (!size)
+		return 0;
+
+	size = (size>>  4) + ((size&  15)>  0);
+	while (*p++ == 0xffff) {
+		if (--size == 0)
+			return (p - addr)<<  4;
+	}
+
+	num = *--p;
+	return ((p - addr)<<  4) + ffz(num);
+}
+
+#define minix_test_and_set_bit(nr, addr)	\
+	__test_and_set_bit((nr) ^ 16, (unsigned long *)(addr))
+#define minix_set_bit(nr, addr)	\
+	__set_bit((nr) ^ 16, (unsigned long *)(addr))
+#define minix_test_and_clear_bit(nr, addr)	\
+	__test_and_clear_bit((nr) ^ 16, (unsigned long *)(addr))
+
+static inline int minix_test_bit(int nr, const void *vaddr)
+{
+	const unsigned short *p = vaddr;
+	return (p[nr>>  4]&  (1U<<  (nr&  15))) != 0;
+}
+
+#else
+
+/*
+ * little-endian bitmaps
+ */
+
+#define minix_test_and_set_bit(nr, addr)	\
+	__test_and_set_le_bit((nr), (unsigned long *)(addr))
+#define minix_set_bit(nr, addr)		\
+	__set_le_bit((nr), (unsigned long *)(addr))
+#define minix_test_and_clear_bit(nr, addr) \
+	__test_and_clear_le_bit((nr), (unsigned long *)(addr))
+#define minix_test_bit(nr, addr)		\
+	test_le_bit((nr), (unsigned long *)(addr))
+#define minix_find_first_zero_bit(addr, size) \
+	find_first_zero_le_bit((unsigned long *)(addr), (size))
+
+#endif
+
  #endif /* FS_MINIX_H */
include/asm-generic/bitops.h +0 -1
index dd7c014..280ca7a 100644
@@ -40,6 +40,5 @@
  #include<asm-generic/bitops/non-atomic.h>
  #include<asm-generic/bitops/le.h>
  #include<asm-generic/bitops/ext2-atomic.h>
-#include<asm-generic/bitops/minix.h>
 
  #endif /* __ASM_GENERIC_BITOPS_H */
include/asm-generic/bitops/minix-le.h deleted +0 -15
deleted file mode 100644
index f366cfa..0000000
@@ -1,15 +0,0 @@
-#ifndef _ASM_GENERIC_BITOPS_MINIX_LE_H_
-#define _ASM_GENERIC_BITOPS_MINIX_LE_H_
-
-#define minix_test_and_set_bit(nr,addr)	\
-	__test_and_set_le_bit((nr), (unsigned long *)(addr))
-#define minix_set_bit(nr,addr)		\
-	__set_le_bit((nr), (unsigned long *)(addr))
-#define minix_test_and_clear_bit(nr,addr) \
-	__test_and_clear_le_bit((nr), (unsigned long *)(addr))
-#define minix_test_bit(nr,addr)		\
-	test_le_bit((nr), (unsigned long *)(addr))
-#define minix_find_first_zero_bit(addr,size) \
-	find_first_zero_le_bit((unsigned long *)(addr), (size))
-
-#endif /* _ASM_GENERIC_BITOPS_MINIX_LE_H_ */
include/asm-generic/bitops/minix.h deleted +0 -15
deleted file mode 100644
index 91f42e8..0000000
@@ -1,15 +0,0 @@
-#ifndef _ASM_GENERIC_BITOPS_MINIX_H_
-#define _ASM_GENERIC_BITOPS_MINIX_H_
-
-#define minix_test_and_set_bit(nr,addr)	\
-	__test_and_set_bit((nr),(unsigned long *)(addr))
-#define minix_set_bit(nr,addr)		\
-	__set_bit((nr),(unsigned long *)(addr))
-#define minix_test_and_clear_bit(nr,addr) \
-	__test_and_clear_bit((nr),(unsigned long *)(addr))
-#define minix_test_bit(nr,addr)		\
-	test_bit((nr),(unsigned long *)(addr))
-#define minix_find_first_zero_bit(addr,size) \
-	find_first_zero_bit((unsigned long *)(addr),(size))
-
-#endif /* _ASM_GENERIC_BITOPS_MINIX_H_ */
Signature · 5 lines
------------------------------------------------------------------------
Greg Ungerer  --  Principal Engineer        EMAIL:     [email protected]
SnapGear Group, McAfee                      PHONE:       +61 7 3435 2888
8 Gardner Close                             FAX:         +61 7 3217 5323
Milton, QLD, 4064, Australia                WEB: http://www.SnapGear.com
Acked-by on v2 6/22
#15 lore raw

Re: [PATCH v2 06/22] m68knommu: introduce little-endian bitops

In reply to Akinobu Mita
Quoted 7 lines · Akinobu Mita

Introduce little-endian bit operations by renaming native ext2 bit operations. The ext2 bit operations are kept as wrapper macros using little-endian bit operations to maintain bisectability until the conversions are finished.

I see no problems here.

Quoted 103 lines
Cc Geert Uytterhoeven<[email protected]>
Cc Roman Zippel<[email protected]>
Cc Andreas Schwab<[email protected]>

---
No change from previous submission

  arch/m68k/include/asm/bitops_no.h |   40 +++++++++++++++++++++++++++++-------
  1 files changed, 32 insertions(+), 8 deletions(-)
arch/m68k/include/asm/bitops_no.h +32 -8
index 292e1ce..9f5eb02 100644
@@ -196,7 +196,15 @@ static __inline__ int __test_bit(int nr, const volatile unsigned long * addr)
  #include<asm-generic/bitops/hweight.h>
  #include<asm-generic/bitops/lock.h>
 
-static __inline__ int ext2_set_bit(int nr, volatile void * addr)
+#define BITOP_LE_SWIZZLE	((BITS_PER_LONG-1)&  ~0x7)
+
+#define __set_le_bit(nr, addr) \
+	__set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
+
+#define __clear_le_bit(nr, addr) \
+	__clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
+
+static inline int __test_and_set_le_bit(int nr, volatile void *addr)
  {
  	char retval;
 
@@ -215,7 +223,7 @@ static __inline__ int ext2_set_bit(int nr, volatile void * addr)
  	return retval;
  }
 
-static __inline__ int ext2_clear_bit(int nr, volatile void * addr)
+static inline int __test_and_clear_le_bit(int nr, volatile void *addr)
  {
  	char retval;
 
@@ -238,7 +246,7 @@ static __inline__ int ext2_clear_bit(int nr, volatile void * addr)
  	({						\
  		int ret;				\
  		spin_lock(lock);			\
-		ret = ext2_set_bit((nr), (addr));	\
+		ret = __test_and_set_le_bit((nr), (addr));	\
  		spin_unlock(lock);			\
  		ret;					\
  	})
@@ -247,12 +255,12 @@ static __inline__ int ext2_clear_bit(int nr, volatile void * addr)
  	({						\
  		int ret;				\
  		spin_lock(lock);			\
-		ret = ext2_clear_bit((nr), (addr));	\
+		ret = __test_and_clear_le_bit((nr), (addr));	\
  		spin_unlock(lock);			\
  		ret;					\
  	})
 
-static __inline__ int ext2_test_bit(int nr, const volatile void * addr)
+static inline int test_le_bit(int nr, const volatile void *addr)
  {
  	char retval;
 
@@ -271,10 +279,10 @@ static __inline__ int ext2_test_bit(int nr, const volatile void * addr)
  	return retval;
  }
 
-#define ext2_find_first_zero_bit(addr, size) \
-        ext2_find_next_zero_bit((addr), (size), 0)
+#define find_first_zero_le_bit(addr, size)	\
+	find_next_zero_le_bit((addr), (size), 0)
 
-static __inline__ unsigned long ext2_find_next_zero_bit(void *addr, unsigned long size, unsigned long offset)
+static inline unsigned long find_next_zero_le_bit(void *addr, unsigned long size, unsigned long offset)
  {
  	unsigned long *p = ((unsigned long *) addr) + (offset>>  5);
  	unsigned long result = offset&  ~31UL;
@@ -324,8 +332,24 @@ found_middle:
  	return result + ffz(__swab32(tmp));
  }
 
+#define ext2_set_bit(nr, addr)	\
+	__test_and_set_le_bit(nr, addr)
+
+#define ext2_clear_bit(nr, addr)	\
+	test_and_clear_le_bit(nr, addr)
+
+#define ext2_test_bit(nr, addr)	\
+	test_le_bit(nr, addr)
+
+#define ext2_find_first_zero_bit(addr, size) \
+	find_first_zero_le_bit(addr, size)
+
+#define ext2_find_next_zero_bit(addr, size, offset)	\
+	find_next_zero_le_bit(addr, size, offset)
+
  #define ext2_find_next_bit(addr, size, off) \
  	find_next_le_bit((unsigned long *)(addr), (size), (off))
+
  #include<asm-generic/bitops/minix.h>
 
  #endif /* __KERNEL__ */
Signature · 5 lines
------------------------------------------------------------------------
Greg Ungerer  --  Principal Engineer        EMAIL:     [email protected]
SnapGear Group, McAfee                      PHONE:       +61 7 3435 2888
8 Gardner Close                             FAX:         +61 7 3217 5323
Milton, QLD, 4064, Australia                WEB: http://www.SnapGear.com
#38 lore raw

Re: [PATCH v2 22/22] bitops: remove minix bitops from asm/bitops.h

In reply to Michal Simek

2010/10/22 Michal Simek <[email protected]>:

Quoted 34 lines
Quoted 9 lines · Akinobu Mita

minix bit operations are only used by minix filesystem and useless by other modules. Because byte order of inode and block bitmaps is defferent on each architecture like below:

m68k:
      big-endian 16bit indexed bitmaps

h8300, microblaze, s390, sparc, m68knommu:
      big-endian 32 or 64bit indexed bitmaps

Just one small fix microblaze little endian support is ready for merging to mainline which means that microblaze is
big-endian 32bit  and  little-endian 32bit

Quoted 12 lines

m32r, mips, sh, xtensa:
      big-endian 32 or 64bit indexed bitmaps for big-endian mode little-endian bitmaps for little-endian mode

Others:
      little-endian bitmaps

In order to move minix bit operations from asm/bitops.h to architecture independent code in minix file system, this provides two config options.

Quoted 6 lines

CONFIG_MINIX_FS_BIG_ENDIAN_16BIT_INDEXED is only selected by m68k. CONFIG_MINIX_FS_NATIVE_ENDIAN is selected by the architectures which use native byte order bitmaps (h8300, microblaze, s390, sparc, m68knommu, m32r, mips, sh, xtensa).
The architectures which always use little-endian bitmaps do not select these options.

Quoted 6 lines

I haven't created any Kconfig option for little/big endian microblaze but there should be a little bit different handling for MINIX_FS_NATIVE_ENDIAN as you are describing above.
Anyway I think you don't need to reflect this in your patch because we are not using that filesystem and I will write it to my to-do list and will fix it later.

If upcomming microblade little-endian mode will use little-endian bitmaps for minixfs, microblade can continue to select CONFIG_MINIX_FS_NATIVE_ENDIAN and you don't need to change it.

But if it will use big-endian bitmaps, it may need some extra work to support it. Becuase there is no little-endian architecture which uses bit-endian bitmaps for minixfs.
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#41 lore raw

Re: [PATCH v2 22/22] bitops: remove minix bitops from asm/bitops.h

In reply to Michal Simek

2010/10/22 Michal Simek <[email protected]>:

Quoted 34 lines
Quoted 9 lines · Akinobu Mita

minix bit operations are only used by minix filesystem and useless by other modules. Because byte order of inode and block bitmaps is defferent on each architecture like below:

m68k:
      big-endian 16bit indexed bitmaps

h8300, microblaze, s390, sparc, m68knommu:
      big-endian 32 or 64bit indexed bitmaps

Just one small fix microblaze little endian support is ready for merging to mainline which means that microblaze is
big-endian 32bit  and  little-endian 32bit

Quoted 12 lines

m32r, mips, sh, xtensa:
      big-endian 32 or 64bit indexed bitmaps for big-endian mode little-endian bitmaps for little-endian mode

Others:
      little-endian bitmaps

In order to move minix bit operations from asm/bitops.h to architecture independent code in minix file system, this provides two config options.

Quoted 6 lines

CONFIG_MINIX_FS_BIG_ENDIAN_16BIT_INDEXED is only selected by m68k. CONFIG_MINIX_FS_NATIVE_ENDIAN is selected by the architectures which use native byte order bitmaps (h8300, microblaze, s390, sparc, m68knommu, m32r, mips, sh, xtensa).
The architectures which always use little-endian bitmaps do not select these options.

Quoted 6 lines

I haven't created any Kconfig option for little/big endian microblaze but there should be a little bit different handling for MINIX_FS_NATIVE_ENDIAN as you are describing above.
Anyway I think you don't need to reflect this in your patch because we are not using that filesystem and I will write it to my to-do list and will fix it later.

If upcomming microblade little-endian mode will use little-endian bitmaps for minixfs, microblade can continue to select CONFIG_MINIX_FS_NATIVE_ENDIAN and you don't need to change it.

But if it will use big-endian bitmaps, it may need some extra work to support it. Becuase there is no little-endian architecture which uses bit-endian bitmaps for minixfs.

#31 lore raw

Re: [PATCH v2 20/22] bitops: remove ext2 non-atomic bitops from asm/bitops.h

In reply to Andreas Dilger

2010/10/22 Andreas Dilger <[email protected]>:

Quoted 7 lines · Akinobu Mita
Quoted 4 lines

As the result of conversions, there are no users of ext2 non-atomic bit operations except for ext2 file system itself.  Now we can put them into architecture independent code in ext2 file system, and remove from asm/bitops.h for all architectures.

Presumably there will be a separate patch series to remove the atomic ext2 bitops?  I was going to suggest removing the ext2 comment in bitops.h, but I notice that there are still the atomic bitops left.

I wanted to remove them altogether, but it turns out that I need more consideration (what is the better name? where should they move to?) and I have already touched more files than I expected in this patch series. So I decided to make it a pending question.

#39 lore raw

Re: [microblaze-uclinux] Re: [PATCH v2 22/22] bitops: remove minix bitops from asm/bitops.h

In reply to Akinobu Mita
Quoted 39 lines · Akinobu Mita

2010/10/22 Michal Simek <[email protected]>:

Quoted 31 lines
Quoted 9 lines · Akinobu Mita

minix bit operations are only used by minix filesystem and useless by other modules. Because byte order of inode and block bitmaps is defferent on each architecture like below:

m68k:
big-endian 16bit indexed bitmaps

h8300, microblaze, s390, sparc, m68knommu:
big-endian 32 or 64bit indexed bitmaps

Just one small fix microblaze little endian support is ready for merging to mainline which means that microblaze is
big-endian 32bit and little-endian 32bit

Quoted 11 lines

m32r, mips, sh, xtensa:
big-endian 32 or 64bit indexed bitmaps for big-endian mode little-endian bitmaps for little-endian mode

Others:
little-endian bitmaps

In order to move minix bit operations from asm/bitops.h to architecture independent code in minix file system, this provides two config options.

Quoted 6 lines

CONFIG_MINIX_FS_BIG_ENDIAN_16BIT_INDEXED is only selected by m68k. CONFIG_MINIX_FS_NATIVE_ENDIAN is selected by the architectures which use native byte order bitmaps (h8300, microblaze, s390, sparc, m68knommu, m32r, mips, sh, xtensa).
The architectures which always use little-endian bitmaps do not select these options.

Quoted 6 lines

I haven't created any Kconfig option for little/big endian microblaze but there should be a little bit different handling for MINIX_FS_NATIVE_ENDIAN as you are describing above.
Anyway I think you don't need to reflect this in your patch because we are not using that filesystem and I will write it to my to-do list and will fix it later.

Quoted 7 lines

If upcomming microblade little-endian mode will use little-endian bitmaps for minixfs, microblade can continue to select CONFIG_MINIX_FS_NATIVE_ENDIAN and you don't need to change it.

But if it will use big-endian bitmaps, it may need some extra work to support it. Becuase there is no little-endian architecture which uses bit-endian bitmaps for minixfs.

As I wrote I don't know anybody who wants to use minixfs that's why we don't need to do anything with it. I can test it but it has no high priority.

Michal

Signature · 4 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian
maintainer
#40 lore raw

Re: [microblaze-uclinux] Re: [PATCH v2 22/22] bitops: remove minix bitops from asm/bitops.h

Quoted 10 lines · Michal Simek
Quoted 7 lines

If upcomming microblade little-endian mode will use little-endian bitmaps for minixfs, microblade can continue to select CONFIG_MINIX_FS_NATIVE_ENDIAN and you don't need to change it.

But if it will use big-endian bitmaps, it may need some extra work to support it. Becuase there is no little-endian architecture which uses bit-endian bitmaps for minixfs.

As I wrote I don't know anybody who wants to use minixfs that's why we don't need to do anything with it. I can test it but it has no high priority.

I think it needs to be set up in a way that new architectures (and those that never cared about minixfs) automatically get a reasonable default and should not need to set anything.

I don't see a reason why little-endian microblaze should use big-endian bitops in minixfs, since that file system layout would also be incompatible with every other one.

CONFIG_MINIX_FS_NATIVE_ENDIAN seems reasonable for both big- and little- endian microblaze, but new architectures should just keep the default little-endian bitops IMHO.
I also don't see a reason for testing. Any new users on microblaze or future architectures would use a modern file system anyway.

Arnd

Acked-by on v2 2/22
#6 lore raw
In reply to Akinobu Mita
Quoted 32 lines · Akinobu Mita

As a preparation for providing little-endian bitops for all architectures, This removes generic_ prefix from little-endian bitops function names in asm-generic/bitops/le.h.

s/generic_find_next_le_bit/find_next_le_bit/ s/generic_find_next_zero_le_bit/find_next_zero_le_bit/ s/generic_find_first_zero_le_bit/find_first_zero_le_bit/ s/generic___test_and_set_le_bit/__test_and_set_le_bit/ s/generic___test_and_clear_le_bit/__test_and_clear_le_bit/ s/generic_test_le_bit/test_le_bit/ s/generic___set_le_bit/__set_le_bit/ s/generic___clear_le_bit/__clear_le_bit/ s/generic_test_and_set_le_bit/test_and_set_le_bit/ s/generic_test_and_clear_le_bit/test_and_clear_le_bit/

Cc Hans-Christian Egtvedt <[email protected]>
Cc Geert Uytterhoeven <[email protected]>
Cc Roman Zippel <[email protected]>
Cc Andreas Schwab <[email protected]>
Cc Greg Ungerer <[email protected]>
Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Andy Grover <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Avi Kivity <[email protected]>
Cc Marcelo Tosatti <[email protected]>
Quoted 5 lines

---
No change from previous submission

 arch/avr32/kernel/avr32_ksyms.c              |    4 ++--
 arch/avr32/lib/findbit.S                     |    4 ++--

For the AVR32 changes.

<snipp patch>

Signature · 1 line
Best regards, Hans-Christian Egtvedt