Introduce little endian bitops
Subsystems (25)
v4 cover Introduce little endian bitops
The little-endian bitops patch series version 4 is available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mita/linux-2.6.git le-bitops-v4
Linus found the little-endian bitops patch series annoying for two reasons:
Quoted 3 lines
- The naming.
Hiding that "little-endian" part in the middle of the name is just odd.
This problem is fixed by changing to the post-fix notation (e.g. s/test_le_bit/test_bit_le/)
Quoted 10 lines
- The change of prototype. This is replacing a function that just took a "void *" or something like that, but it replaces it with something that takes a "unsigned long *". Resulting in a patch like this:
Quoted 6 lines
include/linux/ext3_fs.h renamed from include/linux/ext3_fs.h~ext3-use-little-endian-bitops +0
-0@@ -418,13 +418,18 @@ struct ext3_inode {#define EXT2_MOUNT_DATA_FLAGS EXT3_MOUNT_DATA_FLAGS#endif
Quoted 6 lines
include/linux/ext3_fs.h struct ext3_inode { · line 422
Quoted 3 lines
include/linux/ext3_fs.h renamed from include/linux/ext3_fs.h~ext3-use-little-endian-bitops +2
-1-#define ext3_set_bit ext2_set_bit +#define ext3_set_bit (nr, addr) \ + __test_and_set_le_bit((nr), (unsigned long *)(addr))Where for the life of me I can't say that I think the new code is better than the old code. Quite the reverse.
This problem is not touched.
ext2_set_bit and other ext2_*_bit functions took a "void *", but they implicitly need a long aligned address.
Because almost all architectures defined them as
#define ext2_set_bit(nr, addr) \
__test_and_set_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)The little-endian bitops takes a "unsigned long *" because it can ensure the correct result only for a long aligned address. It is better than ext2 bitops which takes a "void *" but it can't ensure the correct result for an unaligned address.
So the explicit cast is better than no cast that implicitly needs aligned address.
Adding new bitops like *_bit_le_unaligned(int nr, void *addr) may be usefull. But using such bitops here introduces unwanted overhead.
Changelog:
* v4
- change to the post-fix notation e.g. s/test_le_bit/test_bit_le/
- introduce CONFIG_GENERIC_FIND_BIT_LE
- fix m68knommu build
- fix inefficienct find_first_zero_le_bit()
* v3
- add Acked-by: lines
* v2
(cover letter for v2 was not delivered to any mailing lists I've CCed may be due to Too many recipients to the message)
- fix argument of test_and_{set,clear}_le_bit() for s390, arm, m68k
- move ext2 bitops to fs/ext2/ext2.h, not include/linux/ext2_fs.h
- fix m68k minix bitops incorrect conversion noticed by Andreas Schwab
- rewrite minix bitops removal patch based on the suggestion by Arnd
This patch series introduces little-endian bit operations in asm/bitops.h for all architectures and converts all ext2 non-atomic and minix bit operations to use little-endian bit operations. It enables us to remove ext2 non-atomic and minix bit operations from asm/bitops.h. The reason they should be removed from asm/bitops.h is as follows:
For ext2 non-atomic bit operations, they are used for little-endian byte order bitmap access by some filesystems and modules. But using ext2_*() functions on a module other than ext2 filesystem makes some feel strange. The other problem is that they take a "void *" but implicitly need a long aligned address.
For minix bit operations, they are only used by minix filesystem and are useless by other modules. Because byte order of inode and block bitmap is different on each architecture.
Akinobu Mita (24):
bitops: merge little and big endian definisions in
asm-generic/bitops/le.h
asm-generic: rename generic little-endian bitops functions
powerpc: introduce little-endian bitops
s390: introduce little-endian bitops
arm: introduce little-endian bitops
m68k: introduce little-endian bitops
bitops: introduce CONFIG_GENERIC_FIND_BIT_LE
m68knommu: introduce little-endian bitops
bitops: introduce little-endian bitops for most architectures
rds: stop including asm-generic/bitops/le.h
kvm: stop including asm-generic/bitops/le.h
asm-generic: use little-endian bitops
ext3: use little-endian bitops
ext4: use little-endian bitops
ocfs2: use little-endian bitops
nilfs2: use little-endian bitops
reiserfs: use little-endian bitops
udf: use little-endian bitops
ufs: use little-endian bitops
md: use little-endian bit operations
dm: use little-endian bit operations
bitops: remove ext2 non-atomic bitops from asm/bitops.h
m68k: remove inline asm from minix_find_first_zero_bit
bitops: remove minix bitops from asm/bitops.h
arch/alpha/include/asm/bitops.h | 4 +- arch/arm/include/asm/bitops.h | 50 ++++++-------- arch/avr32/include/asm/bitops.h | 3 +- arch/avr32/kernel/avr32_ksyms.c | 4 +- arch/avr32/lib/findbit.S | 4 +- arch/blackfin/include/asm/bitops.h | 3 +- arch/cris/include/asm/bitops.h | 3 +- arch/frv/Kconfig | 4 + arch/frv/include/asm/bitops.h | 4 +- arch/h8300/Kconfig | 4 + arch/h8300/include/asm/bitops.h | 3 +- arch/ia64/include/asm/bitops.h | 3 +- arch/m32r/Kconfig | 4 + arch/m32r/include/asm/bitops.h | 3 +- arch/m68k/include/asm/bitops_mm.h | 89 ++++++++++---------------- arch/m68k/include/asm/bitops_no.h | 28 +++++---- arch/microblaze/Kconfig | 3 + arch/mips/Kconfig | 4 + arch/mips/include/asm/bitops.h | 3 +- arch/mn10300/include/asm/bitops.h | 3 +- arch/parisc/Kconfig | 4 + arch/parisc/include/asm/bitops.h | 4 +- arch/powerpc/Kconfig | 4 + arch/powerpc/include/asm/bitops.h | 53 ++++------------ arch/s390/include/asm/bitops.h | 45 ++++++++------ arch/sh/Kconfig | 3 + arch/sh/include/asm/bitops.h | 3 +- arch/sparc/Kconfig | 4 + arch/sparc/include/asm/bitops_32.h | 3 +- arch/sparc/include/asm/bitops_64.h | 4 +- arch/tile/include/asm/bitops.h | 3 +- arch/x86/include/asm/bitops.h | 4 +- arch/xtensa/Kconfig | 3 + arch/xtensa/include/asm/bitops.h | 3 +- drivers/md/bitmap.c | 6 +- drivers/md/dm-log.c | 8 +- fs/ext2/ext2.h | 11 +++ fs/ext4/ext4.h | 18 ++++-- fs/minix/Kconfig | 8 ++ fs/minix/minix.h | 79 +++++++++++++++++++++++ fs/nilfs2/alloc.h | 3 +- fs/ocfs2/ocfs2.h | 13 ++-- fs/udf/balloc.c | 11 ++- fs/ufs/util.h | 2 +- include/asm-generic/bitops.h | 3 +- include/asm-generic/bitops/ext2-atomic.h | 4 +- include/asm-generic/bitops/ext2-non-atomic.h | 20 ------ include/asm-generic/bitops/le.h | 60 ++++++++---------- include/asm-generic/bitops/minix-le.h | 17 ----- include/asm-generic/bitops/minix.h | 15 ---- include/linux/ext3_fs.h | 15 +++-- include/linux/reiserfs_fs.h | 34 ++++++---- lib/Kconfig | 3 + lib/Makefile | 1 + lib/find_next_bit.c | 12 ++-- net/rds/cong.c | 8 +-- virt/kvm/kvm_main.c | 3 +- 57 files changed, 378 insertions(+), 342 deletions(-) delete mode 100644 include/asm-generic/bitops/ext2-non-atomic.h delete mode 100644 include/asm-generic/bitops/minix-le.h delete mode 100644 include/asm-generic/bitops/minix.h
Signature · 1 line
1.7.3.4
PATCH v4 1/24 bitops: merge little and big endian definisions in asm-generic/bitops/le.h
This patch series introduces little-endian bit operations in asm/bitops.h for all architectures and converts all ext2 non-atomic and minix bit operations to use little-endian bit operations. It enables us to remove ext2 non-atomic and minix bit operations from asm/bitops.h. The reason they should be removed from asm/bitops.h is as follows:
For ext2 non-atomic bit operations, they are used for little-endian byte order bitmap access by some filesystems and modules. But using ext2_*() functions on a module other than ext2 filesystem makes some feel strange. The other problem is that they take a "void *" but implicitly need a long aligned address.
For minix bit operations, they are only used by minix filesystem and are useless by other modules. Because byte order of inode and block bitmap is different on each architecture.
This patch:
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.
---
Change from v3:
- fix inefficienct find_first_zero_le_bit() for a few architectures
The whole series is available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mita/linux-2.6.git le-bitops-v4
include/asm-generic/bitops/le.h | 46 +++++++++++++++++---------------------- 1 files changed, 20 insertions(+), 26 deletions(-)
include/asm-generic/bitops/le.h +20 -26
@@ -4,27 +4,33 @@#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 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_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) +#define generic_find_first_zero_le_bit (addr, size) \ + find_first_zero_bit(addr, size)#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); + +#define generic_find_first_zero_le_bit (addr, size) \ + generic_find_next_zero_le_bit((addr), (size), 0) + +#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,16 +48,4 @@#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) -#endif /* _ASM_GENERIC_BITOPS_LE_H_ */
Signature · 1 line
1.7.3.4
PATCH v4 2/24 asm-generic: rename generic little-endian bitops functions
In reply to Akinobu MitaAs a preparation for providing little-endian bitops for all architectures, This renames generic implementation of little-endian bitops.
s/generic_find_next_le_bit/find_next_bit_le/ s/generic_find_next_zero_le_bit/find_next_zero_bit_le/ s/generic_find_first_zero_le_bit/find_first_zero_bit_le/ s/generic___test_and_set_le_bit/__test_and_set_bit_le/ s/generic___test_and_clear_le_bit/__test_and_clear_bit_le/ s/generic_test_le_bit/test_bit_le/ s/generic___set_le_bit/__set_bit_le/ s/generic___clear_le_bit/__clear_bit_le/ s/generic_test_and_set_le_bit/test_and_set_bit_le/ s/generic_test_and_clear_le_bit/test_and_clear_bit_le/
---
Change from v3:
- change to the post-fix notation e.g. s/test_le_bit/test_bit_le/
The whole series is available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mita/linux-2.6.git le-bitops-v4
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 | 28 +++++++++++++------------- 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, 48 insertions(+), 48 deletions(-)
arch/avr32/kernel/avr32_ksyms.c +2 -2
@@ -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_bit_le); +EXPORT_SYMBOL (find_next_zero_bit_le);/* I/O primitives (lib/io-*.S) */ EXPORT_SYMBOL (__raw_readsb);
arch/avr32/lib/findbit.S +2 -2
@@ -123,7 +123,7 @@ ENTRY(find_next_bit) brgt 1b retal r11 -ENTRY(generic_find_next_le_bit) +ENTRY(find_next_bit_le) 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_bit_le) lsr r8, r10, 5 sub r9, r11, r10 retle r11
arch/m68k/include/asm/bitops_mm.h +4 -4
@@ -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_bit_le((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_bit_le((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_bit_le (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_bit_le (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
@@ -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_bit_le((unsigned long *)(addr), (size), (off))#include <asm-generic/bitops/minix.h> #endif /* __KERNEL__ */
arch/powerpc/include/asm/bitops.h +6 -5
@@ -303,11 +303,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_bit_le((addr), (size), 0) +unsigned long find_next_zero_bit_le (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_bit_le (const unsigned long *addr,unsigned long size,unsigned long offset);/* Bitmap functions for the ext2 filesystem */
@@ -326,10 +327,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_bit_le((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_bit_le((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
@@ -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_bit_le((nr), (unsigned long *)(addr))#define ext2_clear_bit (nr,addr) \ - generic___test_and_clear_le_bit((nr),(unsigned long *)(addr)) + __test_and_clear_bit_le((nr), (unsigned long *)(addr))#define ext2_test_bit (nr,addr) \ - generic_test_le_bit((nr),(unsigned long *)(addr)) + test_bit_le((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_bit_le((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_bit_le((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_bit_le((unsigned long *)(addr), (size), (off))#endif /* _ASM_GENERIC_BITOPS_EXT2_NON_ATOMIC_H_ */
include/asm-generic/bitops/le.h +14 -14
@@ -8,44 +8,44 @@#define BITOP_LE_SWIZZLE 0 -#define generic_find_next_zero_le_bit (addr, size, offset) \ +#define find_next_zero_bit_le (addr, size, offset) \ find_next_zero_bit(addr, size, offset) -#define generic_find_next_le_bit (addr, size, offset) \ +#define find_next_bit_le (addr, size, offset) \ find_next_bit(addr, size, offset) -#define generic_find_first_zero_le_bit (addr, size) \ +#define find_first_zero_bit_le (addr, size) \ find_first_zero_bit(addr, size)#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_bit_le (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_bit_le (const unsigned long *addr,unsigned long size,unsigned long offset); -#define generic_find_first_zero_le_bit (addr, size) \ - generic_find_next_zero_le_bit((addr), (size), 0) +#define find_first_zero_bit_le (addr, size) \ + find_next_zero_bit_le((addr), (size), 0)#else #error "Please fix <asm/byteorder.h>"#endif -#define generic_test_le_bit (nr, addr) \ +#define test_bit_le (nr, addr) \ test_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) -#define generic___set_le_bit (nr, addr) \ +#define __set_bit_le (nr, addr) \ __set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) -#define generic___clear_le_bit (nr, addr) \ +#define __clear_bit_le (nr, addr) \ __clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) -#define generic_test_and_set_le_bit (nr, addr) \ +#define test_and_set_bit_le (nr, addr) \ test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) -#define generic_test_and_clear_le_bit (nr, addr) \ +#define test_and_clear_bit_le (nr, addr) \ test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) -#define generic___test_and_set_le_bit (nr, addr) \ +#define __test_and_set_bit_le (nr, addr) \ __test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) -#define generic___test_and_clear_le_bit (nr, addr) \ +#define __test_and_clear_bit_le (nr, addr) \ __test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))#endif /* _ASM_GENERIC_BITOPS_LE_H_ */
include/asm-generic/bitops/minix-le.h +5 -5
@@ -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_bit_le((nr), (unsigned long *)(addr))#define minix_set_bit (nr,addr) \ - generic___set_le_bit((nr),(unsigned long *)(addr)) + __set_bit_le((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_bit_le((nr), (unsigned long *)(addr))#define minix_test_bit (nr,addr) \ - generic_test_le_bit((nr),(unsigned long *)(addr)) + test_bit_le((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_bit_le((unsigned long *)(addr), (size))#endif /* _ASM_GENERIC_BITOPS_MINIX_LE_H_ */
lib/find_next_bit.c +4 -5
@@ -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_bit_le (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_bit_le); -EXPORT_SYMBOL (generic_find_next_zero_le_bit); - -unsigned long generic_find_next_le_bit (const unsigned long *addr,unsigned +unsigned long find_next_bit_le (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_bit_le);#endif /* __BIG_ENDIAN */
net/rds/cong.c +3 -3
@@ -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_bit_le (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_bit_le (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_bit_le (off, (void *)map->m_page_addrs[i]); }void rds_cong_add_socket (struct rds_sock *rs)
virt/kvm/kvm_main.c +1 -1
@@ -1421,7 +1421,7 @@ void mark_page_dirty_in_slot(struct kvm *kvm, struct kvm_memory_slot *memslot,if (memslot && memslot->dirty_bitmap) {unsigned long rel_gfn = gfn - memslot->base_gfn; -generic___set_le_bit (rel_gfn, memslot->dirty_bitmap); +__set_bit_le (rel_gfn, memslot->dirty_bitmap); } }
Signature · 1 line
1.7.3.4
PATCH v4 3/24 powerpc: introduce little-endian bitops
In reply to Akinobu MitaIntroduce little-endian bit operations by renaming existing powerpc native little-endian bit operations.
---
The whole series is available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mita/linux-2.6.git le-bitops-v4
arch/powerpc/include/asm/bitops.h | 38 ++++++++++++++++++------------------ 1 files changed, 19 insertions(+), 19 deletions(-)
arch/powerpc/include/asm/bitops.h +19 -19
@@ -281,29 +281,29 @@ unsigned long __arch_hweight64(__u64 w);/* Little-endian versions */ -static __inline__int test_le_bit (unsigned long nr, +static __inline__int test_bit_le (unsigned long nr,__const__ unsigned long *addr) { __const__ unsigned char *tmp = (__const__ unsigned char *) addr;return (tmp[nr >>3 ] >> (nr &7 )) &1 ; } -#define __set_le_bit (nr, addr) \ +#define __set_bit_le (nr, addr) \ __set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) -#define __clear_le_bit (nr, addr) \ +#define __clear_bit_le (nr, addr) \ __clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) -#define test_and_set_le_bit (nr, addr) \ +#define test_and_set_bit_le (nr, addr) \ test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) -#define test_and_clear_le_bit (nr, addr) \ +#define test_and_clear_bit_le (nr, addr) \ test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) -#define __test_and_set_le_bit (nr, addr) \ +#define __test_and_set_bit_le (nr, addr) \ __test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) -#define __test_and_clear_le_bit (nr, addr) \ +#define __test_and_clear_bit_le (nr, addr) \ __test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) -#define find_first_zero_le_bit (addr, size) \ +#define find_first_zero_bit_le (addr, size) \ find_next_zero_bit_le((addr), (size), 0)unsigned long find_next_zero_bit_le (const unsigned long *addr,unsigned long size,unsigned long offset);
@@ -313,19 +313,19 @@ unsigned long find_next_bit_le(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) + __test_and_set_bit_le((nr), (unsigned long*)addr)#define ext2_clear_bit (nr, addr) \ - __test_and_clear_le_bit((nr), (unsigned long*)addr) + __test_and_clear_bit_le((nr), (unsigned long*)addr)#define ext2_set_bit_atomic (lock, nr, addr) \ - test_and_set_le_bit((nr), (unsigned long*)addr) + test_and_set_bit_le((nr), (unsigned long*)addr)#define ext2_clear_bit_atomic (lock, nr, addr) \ - test_and_clear_le_bit((nr), (unsigned long*)addr) + test_and_clear_bit_le((nr), (unsigned long*)addr) -#define ext2_test_bit (nr, addr) test_le_bit((nr),(unsigned long*)addr) +#define ext2_test_bit (nr, addr) test_bit_le((nr),(unsigned long*)addr)#define ext2_find_first_zero_bit (addr, size) \ - find_first_zero_le_bit((unsigned long*)addr, size) + find_first_zero_bit_le((unsigned long*)addr, size)#define ext2_find_next_zero_bit (addr, size, off) \ find_next_zero_bit_le((unsigned long *)addr, size, off)
@@ -334,16 +334,16 @@ unsigned long find_next_bit_le(const 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) + __test_and_set_bit_le(nr, (unsigned long *)addr)#define minix_set_bit (nr,addr) \ - __set_le_bit(nr, (unsigned long *)addr) + __set_bit_le(nr, (unsigned long *)addr)#define minix_test_and_clear_bit (nr,addr) \ - __test_and_clear_le_bit(nr, (unsigned long *)addr) + __test_and_clear_bit_le(nr, (unsigned long *)addr)#define minix_test_bit (nr,addr) \ - test_le_bit(nr, (unsigned long *)addr) + test_bit_le(nr, (unsigned long *)addr)#define minix_find_first_zero_bit (addr,size) \ - find_first_zero_le_bit((unsigned long *)addr, size) + find_first_zero_bit_le((unsigned long *)addr, size)#include <asm-generic/bitops/sched.h>
Signature · 1 line
1.7.3.4
PATCH v4 4/24 s390: introduce little-endian bitops
In reply to Akinobu MitaIntroduce 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 v3:
- change to the post-fix notation e.g. s/test_le_bit/test_bit_le/
The whole series is available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mita/linux-2.6.git le-bitops-v4
arch/s390/include/asm/bitops.h | 59 +++++++++++++++++++++++++++------------ 1 files changed, 41 insertions(+), 18 deletions(-)
arch/s390/include/asm/bitops.h +41 -18
@@ -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_bit_le (nr, addr) \ + __set_bit((nr)^(__BITOPS_WORDSIZE - 8), (addr)) +#define __clear_bit_le (nr, addr) \ + __clear_bit((nr)^(__BITOPS_WORDSIZE - 8), (addr)) +#define __test_and_set_bit_le (nr, addr) \ + __test_and_set_bit((nr)^(__BITOPS_WORDSIZE - 8), (addr)) +#define test_and_set_bit_le (nr, addr) \ + test_and_set_bit((nr)^(__BITOPS_WORDSIZE - 8), (addr)) +#define __test_and_clear_bit_le (nr, addr) \ + __test_and_clear_bit((nr)^(__BITOPS_WORDSIZE - 8), (addr)) +#define test_and_clear_bit_le (nr, addr) \ + test_and_clear_bit((nr)^(__BITOPS_WORDSIZE - 8), (addr)) +#define test_bit_le (nr, addr) \ + test_bit((nr)^(__BITOPS_WORDSIZE - 8), (addr)) + +static inline int find_first_zero_bit_le (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_bit_le (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_bit_le (p, size); } -static inline unsigned long ext2_find_first_bit (void *vaddr, -unsigned long size) +static inline unsigned long find_first_bit_le (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_bit_le (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_bit_le (p, size); } +#define ext2_set_bit (nr, addr) \ + __test_and_set_bit_le((nr), (unsigned long *)(addr)) +#define ext2_set_bit_atomic (lock, nr, addr) \ + test_and_set_bit_le((nr), (unsigned long *)(addr)) +#define ext2_clear_bit (nr, addr) \ + __test_and_clear_bit_le((nr), (unsigned long *)(addr)) +#define ext2_clear_bit_atomic (lock, nr, addr) \ + test_and_clear_bit_le((nr), (unsigned long *)(addr)) +#define ext2_test_bit (nr, addr) \ + test_bit_le((nr), (unsigned long *)(addr)) + +#define ext2_find_first_zero_bit (vaddr, size) \ + find_first_zero_bit_le((unsigned long *)(vaddr), (size)) +#define ext2_find_next_zero_bit (vaddr, size, offset) \ + find_next_zero_bit_le((unsigned long *)(vaddr), (size), (offset)) +#define ext2_find_first_bit (vaddr, size) \ + find_first_bit_le((unsigned long *)(vaddr), (size)) +#define ext2_find_next_bit (vaddr, size, offset) \ + find_next_bit_le((unsigned long *)(vaddr), (size), (offset)) +#include <asm-generic/bitops/minix.h> #endif /* __KERNEL__ */
Signature · 1 line
1.7.3.4
PATCH v4 5/24 arm: introduce little-endian bitops
In reply to Akinobu MitaIntroduce 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 v3:
- change to the post-fix notation e.g. s/test_le_bit/test_bit_le/
The whole series is available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mita/linux-2.6.git le-bitops-v4
arch/arm/include/asm/bitops.h | 46 +++++++++++++++++++++++++++++----------- 1 files changed, 33 insertions(+), 13 deletions(-)
arch/arm/include/asm/bitops.h +33 -13
@@ -303,41 +303,61 @@ static inline int fls(int x)#include <asm-generic/bitops/hweight.h> #include <asm-generic/bitops/lock.h> +#define __set_bit_le (nr, p) \ + __set_bit(WORD_BITOFF_TO_LE(nr), (p)) +#define __clear_bit_le (nr, p) \ + __clear_bit(WORD_BITOFF_TO_LE(nr), (p)) +#define __test_and_set_bit_le (nr, p) \ + __test_and_set_bit(WORD_BITOFF_TO_LE(nr), (p)) +#define test_and_set_bit_le (nr, p) \ + test_and_set_bit(WORD_BITOFF_TO_LE(nr), (p)) +#define __test_and_clear_bit_le (nr, p) \ + __test_and_clear_bit(WORD_BITOFF_TO_LE(nr), (p)) +#define test_and_clear_bit_le (nr, p) \ + test_and_clear_bit(WORD_BITOFF_TO_LE(nr), (p)) +#define test_bit_le (nr, p) \ + test_bit(WORD_BITOFF_TO_LE(nr), (p)) +#define find_first_zero_bit_le (p, sz) \ + _find_first_zero_bit_le(p, sz) +#define find_next_zero_bit_le (p, sz, off) \ + _find_next_zero_bit_le(p, sz, off) +#define find_next_bit_le (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_bit_le(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_bit_le(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_bit_le(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_bit_le(nr, (unsigned long *)(p))#define ext2_test_bit (nr,p) \ - test_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p)) + test_bit_le(nr, (unsigned long *)(p))#define ext2_find_first_zero_bit (p,sz) \ - _find_first_zero_bit_le(p,sz) + find_first_zero_bit_le((unsigned long *)(p), sz)#define ext2_find_next_zero_bit (p,sz,off) \ - _find_next_zero_bit_le(p,sz,off) + find_next_zero_bit_le((unsigned long *)(p), sz, off)#define ext2_find_next_bit (p, sz, off) \ - _find_next_bit_le(p, sz, off) + find_next_bit_le((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_bit_le(nr, (unsigned long *)(p))#define minix_test_bit (nr,p) \ - test_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p)) + test_bit_le(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_bit_le(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_bit_le(nr, (unsigned long *)(p))#define minix_find_first_zero_bit (p,sz) \ - _find_first_zero_bit_le(p,sz) + find_first_zero_bit_le((unsigned long *)(p), sz)#endif /* __KERNEL__ */
Signature · 1 line
1.7.3.4
PATCH v4 8/24 m68knommu: introduce little-endian bitops
In reply to Akinobu MitaIntroduce 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 v3:
- change to the post-fix notation e.g. s/test_le_bit/test_bit_le/
- fix m68knommu build
The whole series is available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mita/linux-2.6.git le-bitops-v4
arch/m68k/include/asm/bitops_no.h | 40 +++++++++++++++++++++++++++++------- arch/m68knommu/Kconfig | 4 --- 2 files changed, 32 insertions(+), 12 deletions(-)
arch/m68k/include/asm/bitops_no.h +32 -8
@@ -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_bit_le (nr, addr) \ + __set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) + +#define __clear_bit_le (nr, addr) \ + __clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) + +static inline int __test_and_set_bit_le (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_bit_le (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_bit_le ((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_bit_le ((nr), (addr)); \spin_unlock (lock); \ ret; \ }) -static __inline__int ext2_test_bit (int nr,const volatile void * addr) +static inline int test_bit_le (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_bit_le (addr, size) \ + find_next_zero_bit_le((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_bit_le (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_bit_le(nr, addr) + +#define ext2_clear_bit (nr, addr) \ + __test_and_clear_bit_le(nr, addr) + +#define ext2_test_bit (nr, addr) \ + test_bit_le(nr, addr) + +#define ext2_find_first_zero_bit (addr, size) \ + find_first_zero_bit_le(addr, size) + +#define ext2_find_next_zero_bit (addr, size, offset) \ + find_next_zero_bit_le(addr, size, offset) +#define ext2_find_next_bit (addr, size, off) \ find_next_bit_le((unsigned long *)(addr), (size), (off)) +#include <asm-generic/bitops/minix.h> #endif /* __KERNEL__ */
arch/m68knommu/Kconfig +0 -4
@@ -40,10 +40,6 @@ config GENERIC_FIND_NEXT_BIT bool default y -config GENERIC_FIND_BIT_LE - bool - default y - config GENERIC_GPIO bool default n
Signature · 1 line
1.7.3.4
PATCH v4 6/24 m68k: introduce little-endian bitops
In reply to Akinobu MitaIntroduce 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 v3:
- change to the post-fix notation e.g. s/test_le_bit/test_bit_le/
The whole series is available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mita/linux-2.6.git le-bitops-v4
arch/m68k/include/asm/bitops_mm.h | 64 +++++++++++++++++++++++++----------- 1 files changed, 44 insertions(+), 20 deletions(-)
arch/m68k/include/asm/bitops_mm.h +44 -20
@@ -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_bit_le((unsigned long *)addr, size, offset) -#define ext2_find_next_bit (addr, size, offset) \ - find_next_bit_le((unsigned long *)addr, size, offset) - -static inline int ext2_test_bit (int nr,const void *vaddr) +/* Bitmap functions for little endian. */ + +#define __set_bit_le (nr, addr) \ + __set_bit((nr) ^ 24, (addr)) +#define __clear_bit_le (nr, addr) \ + __clear_bit((nr) ^ 24, (addr)) +#define __test_and_set_bit_le (nr, addr) \ + __test_and_set_bit((nr) ^ 24, (addr)) +#define test_and_set_bit_le (nr, addr) \ + test_and_set_bit((nr) ^ 24, (addr)) +#define __test_and_clear_bit_le (nr, addr) \ + __test_and_clear_bit((nr) ^ 24, (addr)) +#define test_and_clear_bit_le (nr, addr) \ + test_and_clear_bit((nr) ^ 24, (addr)) + +static inline int test_bit_le (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_bit_le (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_bit_le (res, p))break ;return (p - addr) *32 + res; }
@@ -410,16 +414,16 @@ static inline unsigned long find_next_zero_bit_le(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_bit_le (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_bit_le (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_bit_le (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_bit_le (res, p))break ;return (p - addr) *32 + res; }
@@ -452,15 +456,35 @@ static inline unsigned long find_next_bit_le(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_bit_le (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_bit_le (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_bit_le(nr, (unsigned long *)(addr)) +#define ext2_set_bit_atomic (lock, nr, addr) \ + test_and_set_bit_le(nr, (unsigned long *)(addr)) +#define ext2_clear_bit (nr, addr) \ + __test_and_clear_bit_le(nr, (unsigned long *)(addr)) +#define ext2_clear_bit_atomic (lock, nr, addr) \ + test_and_clear_bit_le(nr, (unsigned long *)(addr)) +#define ext2_find_next_zero_bit (addr, size, offset) \ + find_next_zero_bit_le((unsigned long *)(addr), size, offset) +#define ext2_find_next_bit (addr, size, offset) \ + find_next_bit_le((unsigned long *)(addr), size, offset) +#define ext2_test_bit (nr, vaddr) test_bit_le(nr, vaddr) +#define ext2_find_first_zero_bit (vaddr, size) \ + find_first_zero_bit_le((unsigned long *)(vaddr), size) +#define ext2_find_first_bit (vaddr, size) \ + find_first_bit_le((unsigned long *)(vaddr), size) +#endif /* __KERNEL__ */ #endif /* _M68K_BITOPS_H */
Signature · 1 line
1.7.3.4
PATCH v4 9/24 bitops: introduce little-endian bitops for most architectures
In reply to Akinobu MitaIntroduce 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).
---
Change from v3:
- No change
The whole series is available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mita/linux-2.6.git le-bitops-v4
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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -676,6 +676,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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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_bit_le((nr), (unsigned long *)(addr))#define ext2_clear_bit (nr,addr) \
include/asm-generic/bitops/minix-le.h +0 -2
@@ -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_bit_le((nr), (unsigned long *)(addr))#define minix_set_bit (nr,addr) \
Signature · 1 line
1.7.3.4
PATCH v4 7/24 bitops: introduce CONFIG_GENERIC_FIND_BIT_LE
In reply to Akinobu MitaThis introduces CONFIG_GENERIC_FIND_BIT_LE to tell whether to use generic implementation of find_*_bit_le() in lib/find_next_bit.c or not.
For now we select CONFIG_GENERIC_FIND_BIT_LE for all architectures which enable CONFIG_GENERIC_FIND_NEXT_BIT.
But m68knommu wants to define own faster find_next_zero_bit_le() and continues using generic find_next_{,zero_}bit(). (CONFIG_GENERIC_FIND_NEXT_BIT and !CONFIG_GENERIC_FIND_BIT_LE)
---
Change from v3:
- change to the post-fix notation (s/GENERIC_FIND_LE_BIT/GENERIC_FIND_BIT_LE/)
The whole series is available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mita/linux-2.6.git le-bitops-v4
arch/frv/Kconfig | 4 ++++ arch/h8300/Kconfig | 4 ++++ arch/m32r/Kconfig | 4 ++++ arch/m68knommu/Kconfig | 4 ++++ arch/microblaze/Kconfig | 3 +++ arch/mips/Kconfig | 4 ++++ arch/parisc/Kconfig | 4 ++++ arch/powerpc/Kconfig | 4 ++++ arch/sh/Kconfig | 3 +++ arch/sparc/Kconfig | 4 ++++ arch/xtensa/Kconfig | 3 +++ lib/Kconfig | 3 +++ lib/Makefile | 1 + lib/find_next_bit.c | 3 +++ 14 files changed, 48 insertions(+), 0 deletions(-)
arch/frv/Kconfig +4 -0
@@ -21,6 +21,10 @@ config GENERIC_FIND_NEXT_BIT bool default y +config GENERIC_FIND_BIT_LE + bool + default y + config GENERIC_HWEIGHT bool default y
arch/h8300/Kconfig +4 -0
@@ -43,6 +43,10 @@ config GENERIC_FIND_NEXT_BIT bool default y +config GENERIC_FIND_BIT_LE + bool + default y + config GENERIC_HWEIGHT bool default y
arch/m32r/Kconfig +4 -0
@@ -265,6 +265,10 @@ config GENERIC_FIND_NEXT_BIT bool default y +config GENERIC_FIND_BIT_LE + bool + default y + config GENERIC_HWEIGHT bool default y
arch/m68knommu/Kconfig +4 -0
@@ -40,6 +40,10 @@ config GENERIC_FIND_NEXT_BIT bool default y +config GENERIC_FIND_BIT_LE + bool + default y + config GENERIC_GPIO bool default n
arch/microblaze/Kconfig +3 -0
@@ -34,6 +34,9 @@ config ARCH_HAS_ILOG2_U64 config GENERIC_FIND_NEXT_BIT def_bool y +config GENERIC_FIND_BIT_LE + def_bool y + config GENERIC_HWEIGHT def_bool y
arch/mips/Kconfig +4 -0
@@ -755,6 +755,10 @@ config GENERIC_FIND_NEXT_BIT bool default y +config GENERIC_FIND_BIT_LE + bool + default y + config GENERIC_HWEIGHT bool default y
arch/parisc/Kconfig +4 -0
@@ -48,6 +48,10 @@ config GENERIC_FIND_NEXT_BIT bool default y +config GENERIC_FIND_BIT_LE + bool + default y + config GENERIC_BUG bool default y
arch/powerpc/Kconfig +4 -0
@@ -107,6 +107,10 @@ config GENERIC_FIND_NEXT_BIT bool default y +config GENERIC_FIND_BIT_LE + bool + default y + config GENERIC_GPIO bool help
arch/sh/Kconfig +3 -0
@@ -73,6 +73,9 @@ config GENERIC_CSUM config GENERIC_FIND_NEXT_BIT def_bool y +config GENERIC_FIND_BIT_LE + def_bool y + config GENERIC_HWEIGHT def_bool y
arch/sparc/Kconfig +4 -0
@@ -194,6 +194,10 @@ config GENERIC_FIND_NEXT_BIT bool default y +config GENERIC_FIND_BIT_LE + bool + default y + config GENERIC_HWEIGHT bool default y if !ULTRA_HAS_POPULATION_COUNT
arch/xtensa/Kconfig +3 -0
@@ -21,6 +21,9 @@ config RWSEM_XCHGADD_ALGORITHM config GENERIC_FIND_NEXT_BIT def_bool y +config GENERIC_FIND_BIT_LE + def_bool y + config GENERIC_HWEIGHT def_bool y
lib/Kconfig +3 -0
@@ -22,6 +22,9 @@ config GENERIC_FIND_FIRST_BIT config GENERIC_FIND_NEXT_BIT bool +config GENERIC_FIND_BIT_LE + bool + config GENERIC_FIND_LAST_BIT bool default y
lib/Makefile +1 -0
@@ -38,6 +38,7 @@ lib-$(CONFIG_RWSEM_GENERIC_SPINLOCK) += rwsem-spinlock.o lib-$(CONFIG_RWSEM_XCHGADD_ALGORITHM) += rwsem.o lib-$(CONFIG_GENERIC_FIND_FIRST_BIT) += find_next_bit.o lib-$(CONFIG_GENERIC_FIND_NEXT_BIT) += find_next_bit.o +lib-$(CONFIG_GENERIC_FIND_BIT_LE) += find_next_bit.o obj-$(CONFIG_GENERIC_FIND_LAST_BIT) += find_last_bit.o CFLAGS_hweight.o = $(subst $(quote),,$(CONFIG_ARCH_HWEIGHT_CFLAGS))
lib/find_next_bit.c +3 -0
@@ -160,6 +160,7 @@ EXPORT_SYMBOL(find_first_zero_bit);#endif /* CONFIG_GENERIC_FIND_FIRST_BIT */ #ifdef __BIG_ENDIAN +#ifdef CONFIG_GENERIC_FIND_BIT_LE /* include/linux/byteorder does not support "unsigned long" type */ static inline unsigned long ext2_swabp (const unsigned long * x)
@@ -271,4 +272,6 @@ found_middle_swap:return result +__ffs (ext2_swab (tmp)); }EXPORT_SYMBOL (find_next_bit_le); + +#endif /* CONFIG_GENERIC_FIND_BIT_LE */ #endif /* __BIG_ENDIAN */
Signature · 1 line
1.7.3.4
PATCH v4 13/24 ext3: use little-endian bitops
In reply to Akinobu MitaAs 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.
---
Change from v3:
- change to the post-fix notation e.g. s/test_le_bit/test_bit_le/
The whole series is available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mita/linux-2.6.git le-bitops-v4
include/linux/ext3_fs.h | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-)
include/linux/ext3_fs.h +10 -5
@@ -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_bit_le((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_bit_le((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_bit_le((nr), (unsigned long *)(addr)) +#define ext3_find_first_zero_bit (addr, size) \ + find_first_zero_bit_le((unsigned long *)(addr), (size)) +#define ext3_find_next_zero_bit (addr, size, off) \ + find_next_zero_bit_le((unsigned long *)(addr), (size), (off))/* * Maximal mount counts between two filesystem checks
Signature · 1 line
1.7.3.4
PATCH v4 14/24 ext4: use little-endian bitops
In reply to Akinobu MitaAs 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.
---
Change from v3:
- change to the post-fix notation e.g. s/test_le_bit/test_bit_le/
The whole series is available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mita/linux-2.6.git le-bitops-v4
fs/ext4/ext4.h | 18 ++++++++++++------ 1 files changed, 12 insertions(+), 6 deletions(-)
fs/ext4/ext4.h +12 -6
@@ -922,14 +922,20 @@ struct ext4_inode_info {#define test_opt2 (sb, opt) (EXT4_SB(sb)->s_mount_opt2 & \ EXT4_MOUNT2_##opt) -#define ext4_set_bit ext2_set_bit +#define ext4_set_bit (nr, addr) \ + __test_and_set_bit_le((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_bit_le((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_bit_le((nr), (unsigned long *)(addr)) +#define ext4_find_first_zero_bit (addr, size) \ + find_first_zero_bit_le((unsigned long *)(addr), (size)) +#define ext4_find_next_zero_bit (addr, size, off) \ + find_next_zero_bit_le((unsigned long *)(addr), (size), (off)) +#define ext4_find_next_bit (addr, size, off) \ + find_next_bit_le((unsigned long *)(addr), (size), (off))/* * Maximal mount counts between two filesystem checks
Signature · 1 line
1.7.3.4
PATCH v4 18/24 udf: use little-endian bitops
In reply to Akinobu MitaAs 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.
---
Change from v3:
- change to the post-fix notation e.g. s/test_le_bit/test_bit_le/
The whole series is available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mita/linux-2.6.git le-bitops-v4
fs/udf/balloc.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-)
fs/udf/balloc.c +7 -4
@@ -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_bit_le(nr, (unsigned long *)(addr)) +#define udf_set_bit (nr, addr) \ + __test_and_set_bit_le(nr, (unsigned long *)(addr)) +#define udf_test_bit (nr, addr) \ + test_bit_le(nr, (unsigned long *)(addr))#define udf_find_next_one_bit (addr, size, offset) \ - ext2_find_next_bit(addr, size, offset) + find_next_bit_le((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.3.4
PATCH v4 19/24 ufs: use little-endian bitops
In reply to Akinobu MitaAs 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.
---
Change from v3:
- change to the post-fix notation e.g. s/test_le_bit/test_bit_le/
The whole series is available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mita/linux-2.6.git le-bitops-v4
fs/ufs/util.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
fs/ufs/util.h +1 -1
@@ -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_bit_le ((unsigned long *)ubh->bh[base]->b_data, count, offset);if (pos < count || !size)break ; base++;
Signature · 1 line
1.7.3.4
PATCH v4 20/24 md: use little-endian bit operations
In reply to Akinobu MitaAs 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.
---
Change from v3:
- change to the post-fix notation e.g. s/test_le_bit/test_bit_le/
The whole series is available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mita/linux-2.6.git le-bitops-v4
drivers/md/bitmap.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/md/bitmap.c +3 -3
@@ -854,7 +854,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_bit_le (bit, kaddr);kunmap_atomic (kaddr,KM_USER0 );PRINTK ("set file bit %lu page %lu\n" , bit, page->index); }
@@ -1050,7 +1050,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_bit_le (bit, paddr);kunmap_atomic (paddr,KM_USER0 );if (b) {/* if the disk bit is set, set the memory bit */
@@ -1226,7 +1226,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_bit_le (file_page_offset (bitmap ,j ),paddr );kunmap_atomic (paddr,KM_USER0 ); }else
Signature · 1 line
1.7.3.4
PATCH v4 21/24 dm: use little-endian bit operations
In reply to Akinobu MitaAs 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.
---
Change from v3:
- change to the post-fix notation e.g. s/test_le_bit/test_bit_le/
The whole series is available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mita/linux-2.6.git le-bitops-v4
drivers/md/dm-log.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/md/dm-log.c +4 -4
@@ -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_bit_le (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_bit_le (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_bit_le (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_bit_le( (unsigned long *) lc->sync_bits, lc->region_count, lc->sync_search);
Signature · 1 line
1.7.3.4
PATCH v4 22/24 bitops: remove ext2 non-atomic bitops from asm/bitops.h
In reply to Akinobu MitaAs 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 v3:
- change to the post-fix notation e.g. s/test_le_bit/test_bit_le/
The whole series is available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mita/linux-2.6.git le-bitops-v4
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
@@ -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
@@ -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_bit_le(nr, (unsigned long *)(p))#define ext2_set_bit_atomic (lock,nr,p) \ test_and_set_bit_le(nr, (unsigned long *)(p)) -#define ext2_clear_bit (nr,p) \ - __test_and_clear_bit_le(nr, (unsigned long *)(p))#define ext2_clear_bit_atomic (lock,nr,p) \ test_and_clear_bit_le(nr, (unsigned long *)(p)) -#define ext2_test_bit (nr,p) \ - test_bit_le(nr, (unsigned long *)(p)) -#define ext2_find_first_zero_bit (p,sz) \ - find_first_zero_bit_le((unsigned long *)(p), sz) -#define ext2_find_next_zero_bit (p,sz,off) \ - find_next_zero_bit_le((unsigned long *)(p), sz, off) -#define ext2_find_next_bit (p, sz, off) \ - find_next_bit_le((unsigned long *)(p), sz, off)/* * Minix is defined to use little-endian byte ordering.
arch/avr32/include/asm/bitops.h +0 -1
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -467,23 +467,10 @@ static inline unsigned long find_next_bit_le(const unsigned long *addr,/* Bitmap functions for the ext2 filesystem. */ -#define ext2_set_bit (nr, addr) \ - __test_and_set_bit_le(nr, (unsigned long *)(addr))#define ext2_set_bit_atomic (lock, nr, addr) \ test_and_set_bit_le(nr, (unsigned long *)(addr)) -#define ext2_clear_bit (nr, addr) \ - __test_and_clear_bit_le(nr, (unsigned long *)(addr))#define ext2_clear_bit_atomic (lock, nr, addr) \ test_and_clear_bit_le(nr, (unsigned long *)(addr)) -#define ext2_find_next_zero_bit (addr, size, offset) \ - find_next_zero_bit_le((unsigned long *)(addr), size, offset) -#define ext2_find_next_bit (addr, size, offset) \ - find_next_bit_le((unsigned long *)(addr), size, offset) -#define ext2_test_bit (nr, vaddr) test_bit_le(nr, vaddr) -#define ext2_find_first_zero_bit (vaddr, size) \ - find_first_zero_bit_le((unsigned long *)(vaddr), size) -#define ext2_find_first_bit (vaddr, size) \ - find_first_bit_le((unsigned long *)(vaddr), size)#endif /* __KERNEL__ */
arch/m68k/include/asm/bitops_no.h +0 -20
@@ -332,26 +332,6 @@ found_middle: return result + ffz(__swab32(tmp)); } -#define ext2_set_bit (nr, addr) \ - __test_and_set_bit_le(nr, addr) - -#define ext2_clear_bit (nr, addr) \ - __test_and_clear_bit_le(nr, addr) - -#define ext2_test_bit (nr, addr) \ - test_bit_le(nr, addr) - -#define ext2_find_first_zero_bit (addr, size) \ - find_first_zero_bit_le(addr, size) - -#define ext2_find_next_zero_bit (addr, size, offset) \ - find_next_zero_bit_le(addr, size, offset) - -#define ext2_find_next_bit (addr, size, off) \ - find_next_bit_le((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
@@ -677,7 +677,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
@@ -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
@@ -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
@@ -312,25 +312,11 @@ unsigned long find_next_bit_le(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_bit_le((nr), (unsigned long*)addr) -#define ext2_clear_bit (nr, addr) \ - __test_and_clear_bit_le((nr), (unsigned long*)addr) -#define ext2_set_bit_atomic (lock, nr, addr) \ test_and_set_bit_le((nr), (unsigned long*)addr)#define ext2_clear_bit_atomic (lock, nr, addr) \ test_and_clear_bit_le((nr), (unsigned long*)addr) -#define ext2_test_bit (nr, addr) test_bit_le((nr),(unsigned long*)addr) - -#define ext2_find_first_zero_bit (addr, size) \ - find_first_zero_bit_le((unsigned long*)addr, size) -#define ext2_find_next_zero_bit (addr, size, off) \ - find_next_zero_bit_le((unsigned long *)addr, size, off) - -#define ext2_find_next_bit (addr, size, off) \ - find_next_bit_le((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
@@ -837,25 +837,10 @@ static inline int find_next_bit_le(void *vaddr, unsigned long size,return offset +find_first_bit_le (p, size); } -#define ext2_set_bit (nr, addr) \ - __test_and_set_bit_le((nr), (unsigned long *)(addr))#define ext2_set_bit_atomic (lock, nr, addr) \ test_and_set_bit_le((nr), (unsigned long *)(addr)) -#define ext2_clear_bit (nr, addr) \ - __test_and_clear_bit_le((nr), (unsigned long *)(addr))#define ext2_clear_bit_atomic (lock, nr, addr) \ test_and_clear_bit_le((nr), (unsigned long *)(addr)) -#define ext2_test_bit (nr, addr) \ - test_bit_le((nr), (unsigned long *)(addr)) - -#define ext2_find_first_zero_bit (vaddr, size) \ - find_first_zero_bit_le((unsigned long *)(vaddr), (size)) -#define ext2_find_next_zero_bit (vaddr, size, offset) \ - find_next_zero_bit_le((unsigned long *)(vaddr), (size), (offset)) -#define ext2_find_first_bit (vaddr, size) \ - find_first_bit_le((unsigned long *)(vaddr), (size)) -#define ext2_find_next_bit (vaddr, size, offset) \ - find_next_bit_le((unsigned long *)(vaddr), (size), (offset))#include <asm-generic/bitops/minix.h>
arch/sh/include/asm/bitops.h +0 -1
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -174,3 +174,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_bit_le((nr), (unsigned long *)(addr)) +#define ext2_clear_bit (nr, addr) \ + __test_and_clear_bit_le((nr), (unsigned long *)(addr)) +#define ext2_test_bit (nr, addr) \ + test_bit_le((nr), (unsigned long *)(addr)) +#define ext2_find_first_zero_bit (addr, size) \ + find_first_zero_bit_le((unsigned long *)(addr), (size)) +#define ext2_find_next_zero_bit (addr, size, off) \ + find_next_zero_bit_le((unsigned long *)(addr), (size), (off))
include/asm-generic/bitops.h +0 -1
@@ -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
@@ -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_bit_le((nr), (unsigned long *)(addr)) -#define ext2_clear_bit (nr,addr) \ - __test_and_clear_bit_le((nr), (unsigned long *)(addr)) - -#define ext2_test_bit (nr,addr) \ - test_bit_le((nr), (unsigned long *)(addr)) -#define ext2_find_first_zero_bit (addr, size) \ - find_first_zero_bit_le((unsigned long *)(addr), (size)) -#define ext2_find_next_zero_bit (addr, size, off) \ - find_next_zero_bit_le((unsigned long *)(addr), (size), (off)) -#define ext2_find_next_bit (addr, size, off) \ - find_next_bit_le((unsigned long *)(addr), (size), (off)) - -#endif /* _ASM_GENERIC_BITOPS_EXT2_NON_ATOMIC_H_ */
Signature · 1 line
1.7.3.4
PATCH v4 10/24 rds: stop including asm-generic/bitops/le.h
In reply to Akinobu MitaNo need to include asm-generic/bitops/le.h as all architectures provide little-endian bit operations now.
---
Change from v3:
- No change
The whole series is available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mita/linux-2.6.git le-bitops-v4
net/rds/cong.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
net/rds/cong.c +0 -2
@@ -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.3.4
PATCH v4 11/24 kvm: stop including asm-generic/bitops/le.h
In reply to Akinobu MitaNo need to include asm-generic/bitops/le.h as all architectures provide little-endian bit operations now.
---
Change from v3:
- No change
The whole series is available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mita/linux-2.6.git le-bitops-v4
virt/kvm/kvm_main.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
virt/kvm/kvm_main.c +0 -1
@@ -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" #include "async_pf.h"
Signature · 1 line
1.7.3.4
PATCH v4 12/24 asm-generic: use little-endian bitops
In reply to Akinobu MitaAs 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.
---
Change from v3:
- change to the post-fix notation e.g. s/test_le_bit/test_bit_le/
The whole series is available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mita/linux-2.6.git le-bitops-v4
include/asm-generic/bitops/ext2-atomic.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
include/asm-generic/bitops/ext2-atomic.h +2 -2
@@ -5,7 +5,7 @@ ({ \int ret; \spin_lock (lock); \ - ret =ext2_set_bit ((nr), (unsigned long *)(addr)); \ + ret =__test_and_set_bit_le ((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_bit_le ((nr), (unsigned long *)(addr)); \spin_unlock (lock); \ ret; \ })
Signature · 1 line
1.7.3.4
PATCH v4 15/24 ocfs2: use little-endian bitops
In reply to Akinobu MitaAs 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.
---
Change from v3:
- change to the post-fix notation e.g. s/test_le_bit/test_bit_le/
The whole series is available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mita/linux-2.6.git le-bitops-v4
fs/ocfs2/ocfs2.h | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-)
fs/ocfs2/ocfs2.h +8 -5
@@ -831,18 +831,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_bit_le (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_bit_le (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_bit_le(nr, (unsigned long *)(addr)) +#define ocfs2_find_next_zero_bit (addr, size, off) \ + find_next_zero_bit_le((unsigned long *)(addr), size, off) +#define ocfs2_find_next_bit (addr, size, off) \ + find_next_bit_le((unsigned long *)(addr), size, off)#endif /* OCFS2_H */
Signature · 1 line
1.7.3.4
PATCH v4 16/24 nilfs2: use little-endian bitops
In reply to Akinobu MitaAs 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.
---
Change from v3:
- change to the post-fix notation e.g. s/test_le_bit/test_bit_le/
The whole series is available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mita/linux-2.6.git le-bitops-v4
fs/nilfs2/alloc.h | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
fs/nilfs2/alloc.h +2 -1
@@ -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_bit_le((unsigned long *)(addr), (size), (off))/* * persistent object allocator cache
Signature · 1 line
1.7.3.4
PATCH v4 17/24 reiserfs: use little-endian bitops
In reply to Akinobu MitaAs 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.
---
Change from v3:
- change to the post-fix notation e.g. s/test_le_bit/test_bit_le/
The whole series is available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mita/linux-2.6.git le-bitops-v4
include/linux/reiserfs_fs.h | 34 ++++++++++++++++++++-------------- 1 files changed, 20 insertions(+), 14 deletions(-)
include/linux/reiserfs_fs.h +20 -14
@@ -1124,15 +1124,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_bit_le((nr) + unaligned_offset(addr), aligned_address(addr)) +# define clear_bit_unaligned (nr, addr) \ + __test_and_clear_bit_le((nr) + unaligned_offset(addr), aligned_address(addr)) +# define test_bit_unaligned (nr, addr) \ + test_bit_le((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_bit_le(nr, (unsigned long *)(addr)) +# define clear_bit_unaligned (nr, addr) \ + __test_and_clear_bit_le(nr, (unsigned long *)(addr)) +# define test_bit_unaligned (nr, addr) \ + test_bit_le(nr, (unsigned long *)(addr))#endif
@@ -2329,14 +2335,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_bit_le((nr), (unsigned long *)(addr)) +#define reiserfs_test_and_clear_le_bit (nr, addr) \ + __test_and_clear_bit_le((nr), (unsigned long *)(addr)) +#define reiserfs_test_le_bit (nr, addr) \ + test_bit_le((nr), (unsigned long *)(addr)) +#define reiserfs_find_next_zero_le_bit (addr, size, off) \ + find_next_zero_bit_le((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.3.4
PATCH v4 23/24 m68k: remove inline asm from minix_find_first_zero_bit
In reply to Akinobu MitaAs 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.
---
Change from v3:
- No change
The whole series is available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mita/linux-2.6.git le-bitops-v4
arch/m68k/include/asm/bitops_mm.h | 10 +++------- 1 files changed, 3 insertions(+), 7 deletions(-)
arch/m68k/include/asm/bitops_mm.h +3 -7
@@ -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.3.4
PATCH v4 24/24 bitops: remove minix bitops from asm/bitops.h
In reply to Akinobu Mitaminix bit operations are only used by minix filesystem and useless by other modules. Because byte order of inode and block bitmaps is different 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.
---
Change from v3:
- change to the post-fix notation e.g. s/test_le_bit/test_bit_le/
The whole series is available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mita/linux-2.6.git le-bitops-v4
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
@@ -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
@@ -332,20 +332,6 @@ static inline int fls(int x)#define ext2_clear_bit_atomic (lock,nr,p) \ test_and_clear_bit_le(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_bit_le(nr, (unsigned long *)(p)) -#define minix_test_bit (nr,p) \ - test_bit_le(nr, (unsigned long *)(p)) -#define minix_test_and_set_bit (nr,p) \ - __test_and_set_bit_le(nr, (unsigned long *)(p)) -#define minix_test_and_clear_bit (nr,p) \ - __test_and_clear_bit_le(nr, (unsigned long *)(p)) -#define minix_find_first_zero_bit (p,sz) \ - find_first_zero_bit_le((unsigned long *)(p), sz)#endif /* __KERNEL__ */
arch/avr32/include/asm/bitops.h +0 -1
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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_bit_le (nr, addr) \
arch/mips/include/asm/bitops.h +0 -1
@@ -678,7 +678,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
@@ -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
@@ -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
@@ -317,20 +317,6 @@ unsigned long find_next_bit_le(const unsigned long *addr,#define ext2_clear_bit_atomic (lock, nr, addr) \ test_and_clear_bit_le((nr), (unsigned long*)addr) -/* Bitmap functions for the minix filesystem. */ - -#define minix_test_and_set_bit (nr,addr) \ - __test_and_set_bit_le(nr, (unsigned long *)addr) -#define minix_set_bit (nr,addr) \ - __set_bit_le(nr, (unsigned long *)addr) -#define minix_test_and_clear_bit (nr,addr) \ - __test_and_clear_bit_le(nr, (unsigned long *)addr) -#define minix_test_bit (nr,addr) \ - test_bit_le(nr, (unsigned long *)addr) - -#define minix_find_first_zero_bit (addr,size) \ - find_first_zero_bit_le((unsigned long *)addr, size) -#include <asm-generic/bitops/sched.h> #endif /* __KERNEL__ */
arch/s390/include/asm/bitops.h +0 -1
@@ -842,7 +842,6 @@ static inline int find_next_bit_le(void *vaddr, unsigned long size,#define ext2_clear_bit_atomic (lock, nr, addr) \ test_and_clear_bit_le((nr), (unsigned long *)(addr)) -#include <asm-generic/bitops/minix.h> #endif /* __KERNEL__ */
arch/sh/include/asm/bitops.h +0 -1
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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_bit_le((nr), (unsigned long *)(addr)) -#define minix_set_bit (nr,addr) \ - __set_bit_le((nr), (unsigned long *)(addr)) -#define minix_test_and_clear_bit (nr,addr) \ - __test_and_clear_bit_le((nr), (unsigned long *)(addr)) -#define minix_test_bit (nr,addr) \ - test_bit_le((nr), (unsigned long *)(addr)) -#define minix_find_first_zero_bit (addr,size) \ - find_first_zero_bit_le((unsigned long *)(addr), (size)) - -#endif /* _ASM_GENERIC_BITOPS_MINIX_LE_H_ */
include/asm-generic/bitops/minix.h deleted +0 -15
@@ -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.3.4
Re: [PATCH v4 05/24] arm: introduce little-endian bitops
In reply to Akinobu MitaQuoted 4 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.
This looks fine to me - is there any chance we can get this in to mainline so we can avoid conflicts between this and some patches I'm working on atm to fix the unsafe UP+SMP kernel combination with ARMs bitops ?
It's doing some stuff which needs to be done anyway (the casting to unsigned long pointers for the ext2/minix find bit functions) which otherwise will be duplicated in my patches.
Signature · 3 lines
Russell King Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/ maintainer of:
Quoted 2 lines · Akinobu Mita
This problem is not touched.
So why not? The thing is supposed to be a cleanup, but it generates uglier code and more lines added than removed. Why should I pull something like that?
Linus
H. Peter Anvin
reviewerRe: [PATCH v4 09/24] bitops: introduce little-endian bitops for most architectures
In reply to Akinobu MitaQuoted 8 lines · Akinobu Mita
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).
ACK on the patch, but the description is confusing for actual littleendian architectures -- the native bit operations on x86, for example, are in fact littleendian (and as such <asm-generic/bitops/le.h> just wraps the existing native bitops.)
-hpa
Re: [PATCH v4 05/24] arm: introduce little-endian bitops
In reply to Russell King2011/1/17 Russell King <[email protected]>:
Quoted 9 lines · Akinobu Mita
Quoted 4 lines
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.
This looks fine to me - is there any chance we can get this in to mainline so we can avoid conflicts between this and some patches I'm working on atm to fix the unsafe UP+SMP kernel combination with ARMs bitops ?
The le bitops is still unacceptable to mainline. So please do the fixes without bothering about the conflict.
2011/1/17 Linus Torvalds <[email protected]>:
Quoted 7 lines · Akinobu Mita
Quoted 2 lines
This problem is not touched.
So why not? The thing is supposed to be a cleanup, but it generates uglier code and more lines added than removed. Why should I pull something like that?
Changing *_bit_le() to take "void *" instead of "unsigned long *" makes this patch series acceptable?
Or do we also need to change *_bit_le() to handle unaligned address correctly? (i.e. not only long aligned address but also byte aligned address)
Quoted 3 lines · Akinobu Mita
Changing
*_bit_le()to take "void *" instead of "unsigned long *" makes this patch series acceptable?
That would seem to at least make all the filesystem code happier, and they can continue to do just something like
#define ext2_set_bit __set_bit_le
(or whatever the exact sequence ends up being).
Quoted 3 lines
Or do we also need to change
*_bit_le()to handle unaligned address correctly? (i.e. not only long aligned address but also byte aligned address)
No, I don't think that is required. We've never done it before, and we've never had the type-safety for the little-endian (aka "minix") bitops historically. So I'd just keep the status quo.
Linus
Quoted 12 lines · Linus Torvalds
Quoted 3 lines · Akinobu Mita
Changing
*_bit_le()to take "void *" instead of "unsigned long *" makes this patch series acceptable?That would seem to at least make all the filesystem code happier, and they can continue to do just something like
#define ext2_set_bit __set_bit_le(or whatever the exact sequence ends up being).
Quoted 7 lines
Quoted 3 lines
Or do we also need to change
*_bit_le()to handle unaligned address correctly? (i.e. not only long aligned address but also byte aligned address)No, I don't think that is required. We've never done it before, and we've never had the type-safety for the little-endian (aka "minix") bitops historically. So I'd just keep the status quo.
The ARM bitops (set_bit/clear_bit/change_bit) have always taken an unsigned long argument and we have casts in our preprocessor macros for them. Only a couple of the find_bit functions have taken a void pointer.
I really don't want to have to change the function prototypes on ARM, and I really don't want to hide this fact from non-fs users that ARM bitops require such pointers, with the exception of what's required for ext2/minix. If we do hide it, at some point we'll have someone believing that ARM's wrong to be requiring stricter alignment.
As ARM bitops now (in my tree) require strict alignment to unsigned long. A 32-bit load exclusive assembly instruction must never be misaligned, there's no way to safely fix that kind thing up. (No, you can't reliably use spinlocks and normal stores - what if another thread does an aligned load exclusive/store exclusive, which won't trap?)
The reason for this change is to avoid the current situation where people are building kernels which support multiple platforms - including SMP - but because the instructions used for the SMP-safe bitops (byte load exclusive) are not supported on some of the selected processors, we fall back to the SMP-unsafe versions. However, using the word load exclusive instructions are supported.
I've also added tests in the assembly to ensure pointer alignment (which, as we're talking about filesystem data corruption if for some reason these misbehave due to misaligned pointers is something I've done anyway).
If the generic bitops are going to be changed to void pointers, maybe the solution to this is to document that bitops require 'unsigned long *' alignment on some platforms?
Re: [PATCH v4 09/24] bitops: introduce little-endian bitops for most architectures
In reply to Akinobu MitaQuoted 31 lines · Akinobu Mita
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).Signed-off-by Akinobu Mita <[email protected]>Cc Richard Henderson <[email protected]>Cc Ivan Kokshaysky <[email protected]>Cc Hans-Christian Egtvedt <[email protected]>Cc Bryan Wu <[email protected]>Cc Mikael Starvik <[email protected]>Cc David Howells <[email protected]>Cc Yoshinori Sato <[email protected]>Cc "Luck, Tony" <[email protected]>Cc Ralf Baechle <[email protected]>Cc Kyle McMartin <[email protected]>Cc Matthew Wilcox <[email protected]>Cc Grant Grundler <[email protected]>Cc Paul Mundt <[email protected]>Cc Kazumoto Kojima <[email protected]>Cc "David S. Miller" <[email protected]>Cc Chris Zankel <[email protected]>Cc Ingo Molnar <[email protected]>Cc Thomas Gleixner <[email protected]>Cc "H. Peter Anvin" <[email protected]>Signed-off-by Andrew Morton <[email protected]>---
Quoted 8 lines
Change from v3:
- No changeThe whole series is available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mita/linux-2.6.gitle-bitops-v4arch/alpha/include/asm/bitops.h | 1 + arch/avr32/include/asm/bitops.h | 1 +
For the AVR32 related change,
<snipp>
Signature · 1 line
Hans-Christian Egtvedt
2011/1/17 Russell King <[email protected]>:
Quoted 10 lines
The ARM bitops (set_bit/clear_bit/change_bit) have always taken an unsigned long argument and we have casts in our preprocessor macros for them. Only a couple of the
find_bitfunctions have taken a void pointer.I really don't want to have to change the function prototypes on ARM, and I really don't want to hide this fact from non-fs users that ARM bitops require such pointers, with the exception of what's required for ext2/minix. If we do hide it, at some point we'll have someone believing that ARM's wrong to be requiring stricter alignment.
I have updated in my local branch and attached the diff between v4 and updated one. It only changes the function prototypes for le bitops. The function prototypes for the other bitops are not changed.
Assuming that ext2_*_bit() bitops is renamed to *_bit_le() bitops by this patch series, it doesn't make the things worse. (i.e. both bitops hide the fact that require long aligned pointers)
What do you think?
arch/arm/include/asm/bitops.h +12 -14
@@ -304,34 +304,32 @@ static inline int fls(int x)#include <asm-generic/bitops/lock.h> #define __set_bit_le (nr, p) \ - __set_bit(WORD_BITOFF_TO_LE(nr), (p)) + __set_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))#define __clear_bit_le (nr, p) \ - __clear_bit(WORD_BITOFF_TO_LE(nr), (p)) + __clear_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))#define __test_and_set_bit_le (nr, p) \ - __test_and_set_bit(WORD_BITOFF_TO_LE(nr), (p)) + __test_and_set_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))#define test_and_set_bit_le (nr, p) \ - test_and_set_bit(WORD_BITOFF_TO_LE(nr), (p)) + test_and_set_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))#define __test_and_clear_bit_le (nr, p) \ - __test_and_clear_bit(WORD_BITOFF_TO_LE(nr), (p)) + __test_and_clear_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))#define test_and_clear_bit_le (nr, p) \ - test_and_clear_bit(WORD_BITOFF_TO_LE(nr), (p)) + test_and_clear_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))#define test_bit_le (nr, p) \ - test_bit(WORD_BITOFF_TO_LE(nr), (p)) + test_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))#define find_first_zero_bit_le (p, sz) \ _find_first_zero_bit_le(p, sz)#define find_next_zero_bit_le (p, sz, off) \ _find_next_zero_bit_le(p, sz, off)#define find_next_bit_le (p, sz, off) \ - _find_next_bit_le(p, sz, off) + _find_next_bit_le((unsigned long *)(p), sz, off)/* * Ext2 is defined to use little-endian byte ordering. -* These do not need to be atomic. */ -#define ext2_set_bit_atomic (lock,nr,p) \ - test_and_set_bit_le(nr, (unsigned long *)(p)) -#define ext2_clear_bit_atomic (lock,nr,p) \ - test_and_clear_bit_le(nr, (unsigned long *)(p)) - +#define ext2_set_bit_atomic (lock, nr, p) \ + test_and_set_bit_le(nr, p) +#define ext2_clear_bit_atomic (lock, nr, p) \ + test_and_clear_bit_le(nr, p)#endif /* __KERNEL__ */
arch/m68k/include/asm/bitops_mm.h +16 -12
@@ -328,17 +328,17 @@ static inline int __fls(int x)/* Bitmap functions for little endian. */ #define __set_bit_le (nr, addr) \ - __set_bit((nr) ^ 24, (addr)) + __set_bit((nr) ^ 24, (unsigned long *)(addr))#define __clear_bit_le (nr, addr) \ - __clear_bit((nr) ^ 24, (addr)) + __clear_bit((nr) ^ 24, (unsigned long *)(addr))#define __test_and_set_bit_le (nr, addr) \ - __test_and_set_bit((nr) ^ 24, (addr)) + __test_and_set_bit((nr) ^ 24, (unsigned long *)(addr))#define test_and_set_bit_le (nr, addr) \ - test_and_set_bit((nr) ^ 24, (addr)) + test_and_set_bit((nr) ^ 24, (unsigned long *)(addr))#define __test_and_clear_bit_le (nr, addr) \ - __test_and_clear_bit((nr) ^ 24, (addr)) + __test_and_clear_bit((nr) ^ 24, (unsigned long *)(addr))#define test_and_clear_bit_le (nr, addr) \ - test_and_clear_bit((nr) ^ 24, (addr)) + test_and_clear_bit((nr) ^ 24, (unsigned long *)(addr))static inline int test_bit_le (int nr,const void *vaddr) {
@@ -368,15 +368,17 @@ static inline int find_first_zero_bit_lereturn (p - addr) *32 + res; } -static inline unsigned long find_next_zero_bit_le (const unsigned long *addr, +static inline unsigned long find_next_zero_bit_le (const void *addr,unsigned long size,unsigned long offset) { -const unsigned long *p = addr + (offset >>5 ); +const unsigned long *p = addr;int bit = offset &31UL , res;if (offset >= size)return size; + p += offset >>5 ; +if (bit) {/* Look for zero in first longword */ for (res = bit; res <32 ; res++)
@@ -410,15 +412,17 @@ static inline int find_first_bit_le(consreturn (p - addr) *32 + res; } -static inline unsigned long find_next_bit_le (const unsigned long *addr, +static inline unsigned long find_next_bit_le (const void *addr,unsigned long size,unsigned long offset) { -const unsigned long *p = addr + (offset >>5 ); +const unsigned long *p = addr;int bit = offset &31UL , res;if (offset >= size)return size; + p += offset >>5 ; +if (bit) {/* Look for one in first longword */ for (res = bit; res <32 ; res++)
@@ -434,9 +438,9 @@ static inline unsigned long find_next_bi/* Bitmap functions for the ext2 filesystem. */ #define ext2_set_bit_atomic (lock, nr, addr) \ - test_and_set_bit_le(nr, (unsigned long *)(addr)) + test_and_set_bit_le(nr, addr)#define ext2_clear_bit_atomic (lock, nr, addr) \ - test_and_clear_bit_le(nr, (unsigned long *)(addr)) + test_and_clear_bit_le(nr, addr)#endif /* __KERNEL__ */
arch/m68k/include/asm/bitops_no.h +2 -2
@@ -199,10 +199,10 @@ static __inline__ int __test_bit(int nr,#define BITOP_LE_SWIZZLE ((BITS_PER_LONG-1) & ~0x7)#define __set_bit_le (nr, addr) \ - __set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) + __set_bit((nr) ^ BITOP_LE_SWIZZLE, (unsigned long *)(addr))#define __clear_bit_le (nr, addr) \ - __clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) + __clear_bit((nr) ^ BITOP_LE_SWIZZLE, (unsigned long *)(addr))static inline int __test_and_set_bit_le (int nr,volatile void *addr) {
arch/powerpc/include/asm/bitops.h +9 -9
@@ -273,33 +273,33 @@ static __inline__ int fls64(__u64 x)/* Little-endian versions */ static __inline__int test_bit_le (unsigned long nr, -__const__ unsigned long *addr) + __const__ void *addr) { __const__ unsigned char *tmp = (__const__ unsigned char *) addr;return (tmp[nr >>3 ] >> (nr &7 )) &1 ; }#define __set_bit_le (nr, addr) \ - __set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) + __set_bit((nr) ^ BITOP_LE_SWIZZLE, (unsigned long *)(addr))#define __clear_bit_le (nr, addr) \ - __clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) + __clear_bit((nr) ^ BITOP_LE_SWIZZLE, (unsigned long *)(addr))#define test_and_set_bit_le (nr, addr) \ - test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) + test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (unsigned long *)(addr))#define test_and_clear_bit_le (nr, addr) \ - test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) + test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (unsigned long *)(addr))#define __test_and_set_bit_le (nr, addr) \ - __test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) + __test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (unsigned long *)(addr))#define __test_and_clear_bit_le (nr, addr) \ - __test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) + __test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (unsigned long *)(addr))#define find_first_zero_bit_le (addr, size) \ find_next_zero_bit_le((addr), (size), 0) -unsigned long find_next_zero_bit_le (const unsigned long *addr, +unsigned long find_next_zero_bit_le (const void *addr,unsigned long size,unsigned long offset); -unsigned long find_next_bit_le (const unsigned long *addr, +unsigned long find_next_bit_le (const void *addr,unsigned long size,unsigned long offset);/* Bitmap functions for the ext2 filesystem */
arch/s390/include/asm/bitops.h +11 -11
@@ -743,19 +743,19 @@ static inline int sched_find_first_bit(u*/ #define __set_bit_le (nr, addr) \ - __set_bit((nr)^(__BITOPS_WORDSIZE - 8), (addr)) + __set_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)(addr))#define __clear_bit_le (nr, addr) \ - __clear_bit((nr)^(__BITOPS_WORDSIZE - 8), (addr)) + __clear_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)(addr))#define __test_and_set_bit_le (nr, addr) \ - __test_and_set_bit((nr)^(__BITOPS_WORDSIZE - 8), (addr)) + __test_and_set_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)(addr))#define test_and_set_bit_le (nr, addr) \ - test_and_set_bit((nr)^(__BITOPS_WORDSIZE - 8), (addr)) + test_and_set_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)(addr))#define __test_and_clear_bit_le (nr, addr) \ - __test_and_clear_bit((nr)^(__BITOPS_WORDSIZE - 8), (addr)) + __test_and_clear_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)(addr))#define test_and_clear_bit_le (nr, addr) \ - test_and_clear_bit((nr)^(__BITOPS_WORDSIZE - 8), (addr)) + test_and_clear_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)(addr))#define test_bit_le (nr, addr) \ - test_bit((nr)^(__BITOPS_WORDSIZE - 8), (addr)) + test_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)(addr))static inline int find_first_zero_bit_le (void *vaddr,unsigned int size) {
@@ -837,10 +837,10 @@ static inline int find_next_bit_le(void return offset + find_first_bit_le(p, size); } -#define ext2_set_bit_atomic (lock, nr, addr) \ - test_and_set_bit_le((nr), (unsigned long *)(addr)) -#define ext2_clear_bit_atomic (lock, nr, addr) \ - test_and_clear_bit_le((nr), (unsigned long *)(addr)) +#define ext2_set_bit_atomic (lock, nr, addr) \ + test_and_set_bit_le(nr, addr) +#define ext2_clear_bit_atomic (lock, nr, addr) \ + test_and_clear_bit_le(nr, addr)#endif /* __KERNEL__ */
fs/ext2/ext2.h +5 -10
@@ -175,13 +175,8 @@ ext2_group_first_block_no(struct super_ble32_to_cpu (EXT2_SB (sb)->s_es->s_first_data_block); } -#define ext2_set_bit (nr, addr) \ - __test_and_set_bit_le((nr), (unsigned long *)(addr)) -#define ext2_clear_bit (nr, addr) \ - __test_and_clear_bit_le((nr), (unsigned long *)(addr)) -#define ext2_test_bit (nr, addr) \ - test_bit_le((nr), (unsigned long *)(addr)) -#define ext2_find_first_zero_bit (addr, size) \ - find_first_zero_bit_le((unsigned long *)(addr), (size)) -#define ext2_find_next_zero_bit (addr, size, off) \ - find_next_zero_bit_le((unsigned long *)(addr), (size), (off)) +#define ext2_set_bit __test_and_set_bit_le +#define ext2_clear_bit __test_and_clear_bit_le +#define ext2_test_bit test_bit_le +#define ext2_find_first_zero_bit find_first_zero_bit_le +#define ext2_find_next_zero_bit find_next_zero_bit_le
fs/ext4/ext4.h +6 -12
@@ -922,20 +922,14 @@ struct ext4_inode_info {#define test_opt (sb, opt) (EXT4_SB(sb)->s_mount_opt & \ EXT4_MOUNT_##opt) -#define ext4_set_bit (nr, addr) \ - __test_and_set_bit_le((nr), (unsigned long *)(addr)) +#define ext4_set_bit __test_and_set_bit_le#define ext4_set_bit_atomic ext2_set_bit_atomic -#define ext4_clear_bit (nr, addr) \ - __test_and_clear_bit_le((nr), (unsigned long *)(addr)) +#define ext4_clear_bit __test_and_clear_bit_le#define ext4_clear_bit_atomic ext2_clear_bit_atomic -#define ext4_test_bit (nr, addr) \ - test_bit_le((nr), (unsigned long *)(addr)) -#define ext4_find_first_zero_bit (addr, size) \ - find_first_zero_bit_le((unsigned long *)(addr), (size)) -#define ext4_find_next_zero_bit (addr, size, off) \ - find_next_zero_bit_le((unsigned long *)(addr), (size), (off)) -#define ext4_find_next_bit (addr, size, off) \ - find_next_bit_le((unsigned long *)(addr), (size), (off)) +#define ext4_test_bit test_bit_le +#define ext4_find_first_zero_bit find_first_zero_bit_le +#define ext4_find_next_zero_bit find_next_zero_bit_le +#define ext4_find_next_bit find_next_bit_le/* * Maximal mount counts between two filesystem checks
fs/minix/minix.h +5 -10
@@ -154,16 +154,11 @@ static inline int minix_test_bit(int nr,* little-endian bitmaps */ -#define minix_test_and_set_bit (nr, addr) \ - __test_and_set_bit_le((nr), (unsigned long *)(addr)) -#define minix_set_bit (nr, addr) \ - __set_bit_le((nr), (unsigned long *)(addr)) -#define minix_test_and_clear_bit (nr, addr) \ - __test_and_clear_bit_le((nr), (unsigned long *)(addr)) -#define minix_test_bit (nr, addr) \ - test_bit_le((nr), (unsigned long *)(addr)) -#define minix_find_first_zero_bit (addr, size) \ - find_first_zero_bit_le((unsigned long *)(addr), (size)) +#define minix_test_and_set_bit __test_and_set_bit_le +#define minix_set_bit __set_bit_le +#define minix_test_and_clear_bit __test_and_clear_bit_le +#define minix_test_bit test_bit_le +#define minix_find_first_zero_bit find_first_zero_bit_le#endif
fs/nilfs2/alloc.h +1 -2
@@ -74,8 +74,7 @@ int nilfs_palloc_freev(struct inode *, _#define nilfs_set_bit_atomic ext2_set_bit_atomic#define nilfs_clear_bit_atomic ext2_clear_bit_atomic -#define nilfs_find_next_zero_bit (addr, size, off) \ - find_next_zero_bit_le((unsigned long *)(addr), (size), (off)) +#define nilfs_find_next_zero_bit find_next_zero_bit_le/* * persistent object allocator cache
fs/ocfs2/ocfs2.h +3 -6
@@ -836,11 +836,8 @@ static inline void _ocfs2_clear_bit(unsi }#define ocfs2_clear_bit (bit, addr) _ocfs2_clear_bit((bit), (unsigned long *)(addr)) -#define ocfs2_test_bit (nr, addr) \ - test_bit_le(nr, (unsigned long *)(addr)) -#define ocfs2_find_next_zero_bit (addr, size, off) \ - find_next_zero_bit_le((unsigned long *)(addr), size, off) -#define ocfs2_find_next_bit (addr, size, off) \ - find_next_bit_le((unsigned long *)(addr), size, off) +#define ocfs2_test_bit test_bit_le +#define ocfs2_find_next_zero_bit find_next_zero_bit_le +#define ocfs2_find_next_bit find_next_bit_le#endif /* OCFS2_H */
fs/udf/balloc.c +4 -8
@@ -27,14 +27,10 @@#include "udf_i.h" #include "udf_sb.h" -#define udf_clear_bit (nr, addr) \ - __test_and_clear_bit_le(nr, (unsigned long *)(addr)) -#define udf_set_bit (nr, addr) \ - __test_and_set_bit_le(nr, (unsigned long *)(addr)) -#define udf_test_bit (nr, addr) \ - test_bit_le(nr, (unsigned long *)(addr)) -#define udf_find_next_one_bit (addr, size, offset) \ - find_next_bit_le((unsigned long *)(addr), size, offset) +#define udf_clear_bit __test_and_clear_bit_le +#define udf_set_bit __test_and_set_bit_le +#define udf_test_bit test_bit_le +#define udf_find_next_one_bit find_next_bit_le static int read_block_bitmap(struct super_block *sb, struct udf_bitmap *bitmap, unsigned int block,
fs/ufs/util.h +1 -1
@@ -408,7 +408,7 @@ static inline unsigned _ubh_find_next_zefor (;;) { count = min_t(unsigned int, size + offset, uspi->s_bpf); size -= count - offset; - pos =find_next_zero_bit_le ((unsigned long *)ubh->bh[base]->b_data, count, offset); + pos =find_next_zero_bit_le (ubh->bh[base]->b_data, count, offset);if (pos < count || !size)break ; base++;
include/asm-generic/bitops/ext2-atomic.h +2 -2
@@ -5,7 +5,7 @@ ({ \int ret; \spin_lock (lock); \ - ret =__test_and_set_bit_le ((nr), (unsigned long *)(addr)); \ + ret =__test_and_set_bit_le (nr, addr); \spin_unlock (lock); \ ret; \ })
@@ -14,7 +14,7 @@ ({ \int ret; \spin_lock (lock); \ - ret =__test_and_clear_bit_le ((nr), (unsigned long *)(addr)); \ + ret =__test_and_clear_bit_le (nr, addr); \spin_unlock (lock); \ ret; \ })
include/asm-generic/bitops/le.h +12 -12
@@ -9,19 +9,19 @@#define BITOP_LE_SWIZZLE 0#define find_next_zero_bit_le (addr, size, offset) \ - find_next_zero_bit(addr, size, offset) + find_next_zero_bit((unsigned long *)(addr), size, offset)#define find_next_bit_le (addr, size, offset) \ - find_next_bit(addr, size, offset) + find_next_bit((unsigned long *)(addr), size, offset)#define find_first_zero_bit_le (addr, size) \ - find_first_zero_bit(addr, size) + find_first_zero_bit((unsigned long *)(addr), size)#elif defined(__BIG_ENDIAN)#define BITOP_LE_SWIZZLE ((BITS_PER_LONG-1) & ~0x7) -extern unsigned long find_next_zero_bit_le (const unsigned long *addr, +extern unsigned long find_next_zero_bit_le (const void *addr,unsigned long size,unsigned long offset); -extern unsigned long find_next_bit_le (const unsigned long *addr, +extern unsigned long find_next_bit_le (const void *addr,unsigned long size,unsigned long offset);#define find_first_zero_bit_le (addr, size) \
@@ -32,20 +32,20 @@ extern unsigned long find_next_bit_le(co#endif #define test_bit_le (nr, addr) \ - test_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) + test_bit((nr) ^ BITOP_LE_SWIZZLE, (unsigned long *)(addr))#define __set_bit_le (nr, addr) \ - __set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) + __set_bit((nr) ^ BITOP_LE_SWIZZLE, (unsigned long *)(addr))#define __clear_bit_le (nr, addr) \ - __clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) + __clear_bit((nr) ^ BITOP_LE_SWIZZLE, (unsigned long *)(addr))#define test_and_set_bit_le (nr, addr) \ - test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) + test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (unsigned long *)(addr))#define test_and_clear_bit_le (nr, addr) \ - test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) + test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (unsigned long *)(addr))#define __test_and_set_bit_le (nr, addr) \ - __test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) + __test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (unsigned long *)(addr))#define __test_and_clear_bit_le (nr, addr) \ - __test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) + __test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (unsigned long *)(addr))#endif /* _ASM_GENERIC_BITOPS_LE_H_ */
include/linux/ext3_fs.h +5 -10
@@ -418,18 +418,13 @@ struct ext3_inode {#define EXT2_MOUNT_DATA_FLAGS EXT3_MOUNT_DATA_FLAGS#endif -#define ext3_set_bit (nr, addr) \ - __test_and_set_bit_le((nr), (unsigned long *)(addr)) +#define ext3_set_bit __test_and_set_bit_le#define ext3_set_bit_atomic ext2_set_bit_atomic -#define ext3_clear_bit (nr, addr) \ - __test_and_clear_bit_le((nr), (unsigned long *)(addr)) +#define ext3_clear_bit __test_and_clear_bit_le#define ext3_clear_bit_atomic ext2_clear_bit_atomic -#define ext3_test_bit (nr, addr) \ - test_bit_le((nr), (unsigned long *)(addr)) -#define ext3_find_first_zero_bit (addr, size) \ - find_first_zero_bit_le((unsigned long *)(addr), (size)) -#define ext3_find_next_zero_bit (addr, size, off) \ - find_next_zero_bit_le((unsigned long *)(addr), (size), (off)) +#define ext3_test_bit test_bit_le +#define ext3_find_first_zero_bit find_first_zero_bit_le +#define ext3_find_next_zero_bit find_next_zero_bit_le/* * Maximal mount counts between two filesystem checks
include/linux/reiserfs_fs.h +7 -14
@@ -1133,12 +1133,9 @@ struct reiserfs_de_head {#else -# define set_bit_unaligned (nr, addr) \ - __test_and_set_bit_le(nr, (unsigned long *)(addr)) -# define clear_bit_unaligned (nr, addr) \ - __test_and_clear_bit_le(nr, (unsigned long *)(addr)) -# define test_bit_unaligned (nr, addr) \ - test_bit_le(nr, (unsigned long *)(addr)) +# define set_bit_unaligned (nr, addr) __test_and_set_bit_le(nr, addr) +# define clear_bit_unaligned (nr, addr) __test_and_clear_bit_le(nr, addr) +# define test_bit_unaligned (nr, addr) test_bit_le(nr, addr)#endif
@@ -2335,14 +2332,10 @@ __u32 keyed_hash(const signed char *msg,__u32 yura_hash (const signed char *msg,int len);__u32 r5_hash (const signed char *msg,int len); -#define reiserfs_test_and_set_le_bit (nr, addr) \ - __test_and_set_bit_le((nr), (unsigned long *)(addr)) -#define reiserfs_test_and_clear_le_bit (nr, addr) \ - __test_and_clear_bit_le((nr), (unsigned long *)(addr)) -#define reiserfs_test_le_bit (nr, addr) \ - test_bit_le((nr), (unsigned long *)(addr)) -#define reiserfs_find_next_zero_le_bit (addr, size, off) \ - find_next_zero_bit_le((unsigned long *)(addr), (size), (off)) +#define reiserfs_test_and_set_le_bit __test_and_set_bit_le +#define reiserfs_test_and_clear_le_bit __test_and_clear_bit_le +#define reiserfs_test_le_bit test_bit_le +#define reiserfs_find_next_zero_le_bit find_next_zero_bit_le/* sometimes reiserfs_truncate may require to allocate few new blocks to perform indirect2direct conversion. People probably used to
lib/find_next_bit.c +6 -4
@@ -186,15 +186,16 @@ static inline unsigned long ext2_swab(co#endif } -unsigned long find_next_zero_bit_le (const unsigned long *addr,unsigned +unsigned long find_next_zero_bit_le (const void *addr,unsigned long size,unsigned long offset) { -const unsigned long *p = addr +BITOP_WORD (offset); +const unsigned long *p = addr;unsigned long result = offset & ~(BITS_PER_LONG -1 );unsigned long tmp;if (offset >= size)return size; + p +=BITOP_WORD (offset); size -= result; offset &= (BITS_PER_LONG -1UL );if (offset) {
@@ -229,15 +230,16 @@ found_middle_swap: }EXPORT_SYMBOL (find_next_zero_bit_le); -unsigned long find_next_bit_le (const unsigned long *addr,unsigned +unsigned long find_next_bit_le (const void *addr,unsigned long size,unsigned long offset) { -const unsigned long *p = addr +BITOP_WORD (offset); +const unsigned long *p = addr;unsigned long result = offset & ~(BITS_PER_LONG -1 );unsigned long tmp;if (offset >= size)return size; + p +=BITOP_WORD (offset); size -= result; offset &= (BITS_PER_LONG -1UL );if (offset) {
net/rds/cong.c +1 -0
@@ -33,6 +33,7 @@#include <linux/slab.h> #include <linux/types.h> #include <linux/rbtree.h> +#include <linux/bitops.h> #include "rds.h"