Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

asm-generic: add another generic ext2 atomic bitops

The majority of architectures implement ext2 atomic bitops as
test_and_{set,clear}_bit() without spinlock.

This adds this type of generic implementation in ext2-atomic-setbit.h and
use it wherever possible.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Suggested-by: Andreas Dilger <adilger@dilger.ca>
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Akinobu Mita and committed by
Linus Torvalds
148817ba b2c9cd37

+28 -59
+1 -2
arch/alpha/include/asm/bitops.h
··· 456 456 457 457 #include <asm-generic/bitops/le.h> 458 458 459 - #define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a) 460 - #define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a) 459 + #include <asm-generic/bitops/ext2-atomic-setbit.h> 461 460 462 461 #endif /* __KERNEL__ */ 463 462
+1 -4
arch/arm/include/asm/bitops.h
··· 310 310 /* 311 311 * Ext2 is defined to use little-endian byte ordering. 312 312 */ 313 - #define ext2_set_bit_atomic(lock, nr, p) \ 314 - test_and_set_bit_le(nr, p) 315 - #define ext2_clear_bit_atomic(lock, nr, p) \ 316 - test_and_clear_bit_le(nr, p) 313 + #include <asm-generic/bitops/ext2-atomic-setbit.h> 317 314 318 315 #endif /* __KERNEL__ */ 319 316
+1 -2
arch/cris/include/asm/bitops.h
··· 156 156 157 157 #include <asm-generic/bitops/le.h> 158 158 159 - #define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a) 160 - #define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a) 159 + #include <asm-generic/bitops/ext2-atomic-setbit.h> 161 160 162 161 #include <asm-generic/bitops/sched.h> 163 162
+1 -2
arch/frv/include/asm/bitops.h
··· 403 403 404 404 #include <asm-generic/bitops/le.h> 405 405 406 - #define ext2_set_bit_atomic(lock,nr,addr) test_and_set_bit ((nr) ^ 0x18, (addr)) 407 - #define ext2_clear_bit_atomic(lock,nr,addr) test_and_clear_bit((nr) ^ 0x18, (addr)) 406 + #include <asm-generic/bitops/ext2-atomic-setbit.h> 408 407 409 408 #endif /* __KERNEL__ */ 410 409
+1 -2
arch/ia64/include/asm/bitops.h
··· 458 458 459 459 #include <asm-generic/bitops/le.h> 460 460 461 - #define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a) 462 - #define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a) 461 + #include <asm-generic/bitops/ext2-atomic-setbit.h> 463 462 464 463 #include <asm-generic/bitops/sched.h> 465 464
+1 -6
arch/mn10300/include/asm/bitops.h
··· 227 227 #include <asm-generic/bitops/find.h> 228 228 #include <asm-generic/bitops/sched.h> 229 229 #include <asm-generic/bitops/hweight.h> 230 - 231 - #define ext2_set_bit_atomic(lock, nr, addr) \ 232 - test_and_set_bit((nr), (addr)) 233 - #define ext2_clear_bit_atomic(lock, nr, addr) \ 234 - test_and_clear_bit((nr), (addr)) 235 - 230 + #include <asm-generic/bitops/ext2-atomic-setbit.h> 236 231 #include <asm-generic/bitops/le.h> 237 232 238 233 #endif /* __KERNEL__ */
+1 -8
arch/parisc/include/asm/bitops.h
··· 223 223 #ifdef __KERNEL__ 224 224 225 225 #include <asm-generic/bitops/le.h> 226 - 227 - /* '3' is bits per byte */ 228 - #define LE_BYTE_ADDR ((sizeof(unsigned long) - 1) << 3) 229 - 230 - #define ext2_set_bit_atomic(l,nr,addr) \ 231 - test_and_set_bit((nr) ^ LE_BYTE_ADDR, (unsigned long *)addr) 232 - #define ext2_clear_bit_atomic(l,nr,addr) \ 233 - test_and_clear_bit( (nr) ^ LE_BYTE_ADDR, (unsigned long *)addr) 226 + #include <asm-generic/bitops/ext2-atomic-setbit.h> 234 227 235 228 #endif /* __KERNEL__ */ 236 229
+1 -4
arch/powerpc/include/asm/bitops.h
··· 327 327 unsigned long size, unsigned long offset); 328 328 /* Bitmap functions for the ext2 filesystem */ 329 329 330 - #define ext2_set_bit_atomic(lock, nr, addr) \ 331 - test_and_set_bit_le((nr), (unsigned long*)addr) 332 - #define ext2_clear_bit_atomic(lock, nr, addr) \ 333 - test_and_clear_bit_le((nr), (unsigned long*)addr) 330 + #include <asm-generic/bitops/ext2-atomic-setbit.h> 334 331 335 332 #include <asm-generic/bitops/sched.h> 336 333
+1 -4
arch/s390/include/asm/bitops.h
··· 832 832 833 833 #include <asm-generic/bitops/le.h> 834 834 835 - #define ext2_set_bit_atomic(lock, nr, addr) \ 836 - test_and_set_bit_le(nr, addr) 837 - #define ext2_clear_bit_atomic(lock, nr, addr) \ 838 - test_and_clear_bit_le(nr, addr) 835 + #include <asm-generic/bitops/ext2-atomic-setbit.h> 839 836 840 837 841 838 #endif /* __KERNEL__ */
+1 -4
arch/sparc/include/asm/bitops_64.h
··· 91 91 92 92 #include <asm-generic/bitops/le.h> 93 93 94 - #define ext2_set_bit_atomic(lock,nr,addr) \ 95 - test_and_set_bit((nr) ^ 0x38,(unsigned long *)(addr)) 96 - #define ext2_clear_bit_atomic(lock,nr,addr) \ 97 - test_and_clear_bit((nr) ^ 0x38,(unsigned long *)(addr)) 94 + #include <asm-generic/bitops/ext2-atomic-setbit.h> 98 95 99 96 #endif /* __KERNEL__ */ 100 97
+1 -4
arch/tile/include/asm/bitops_64.h
··· 97 97 return (oldval & mask) != 0; 98 98 } 99 99 100 - #define ext2_set_bit_atomic(lock, nr, addr) \ 101 - test_and_set_bit((nr), (unsigned long *)(addr)) 102 - #define ext2_clear_bit_atomic(lock, nr, addr) \ 103 - test_and_clear_bit((nr), (unsigned long *)(addr)) 100 + #include <asm-generic/bitops/ext2-atomic-setbit.h> 104 101 105 102 #endif /* _ASM_TILE_BITOPS_64_H */
+1 -4
arch/x86/include/asm/bitops.h
··· 458 458 459 459 #include <asm-generic/bitops/le.h> 460 460 461 - #define ext2_set_bit_atomic(lock, nr, addr) \ 462 - test_and_set_bit((nr), (unsigned long *)(addr)) 463 - #define ext2_clear_bit_atomic(lock, nr, addr) \ 464 - test_and_clear_bit((nr), (unsigned long *)(addr)) 461 + #include <asm-generic/bitops/ext2-atomic-setbit.h> 465 462 466 463 #endif /* __KERNEL__ */ 467 464 #endif /* _ASM_X86_BITOPS_H */
+1 -13
arch/xtensa/include/asm/bitops.h
··· 108 108 #include <asm-generic/bitops/find.h> 109 109 #include <asm-generic/bitops/le.h> 110 110 111 - #ifdef __XTENSA_EL__ 112 - # define ext2_set_bit_atomic(lock,nr,addr) \ 113 - test_and_set_bit((nr), (unsigned long*)(addr)) 114 - # define ext2_clear_bit_atomic(lock,nr,addr) \ 115 - test_and_clear_bit((nr), (unsigned long*)(addr)) 116 - #elif defined(__XTENSA_EB__) 117 - # define ext2_set_bit_atomic(lock,nr,addr) \ 118 - test_and_set_bit((nr) ^ 0x18, (unsigned long*)(addr)) 119 - # define ext2_clear_bit_atomic(lock,nr,addr) \ 120 - test_and_clear_bit((nr) ^ 0x18, (unsigned long*)(addr)) 121 - #else 122 - # error processor byte order undefined! 123 - #endif 111 + #include <asm-generic/bitops/ext2-atomic-setbit.h> 124 112 125 113 #include <asm-generic/bitops/hweight.h> 126 114 #include <asm-generic/bitops/lock.h>
+11
include/asm-generic/bitops/ext2-atomic-setbit.h
··· 1 + #ifndef _ASM_GENERIC_BITOPS_EXT2_ATOMIC_SETBIT_H_ 2 + #define _ASM_GENERIC_BITOPS_EXT2_ATOMIC_SETBIT_H_ 3 + 4 + /* 5 + * Atomic bitops based version of ext2 atomic bitops 6 + */ 7 + 8 + #define ext2_set_bit_atomic(l, nr, addr) test_and_set_bit_le(nr, addr) 9 + #define ext2_clear_bit_atomic(l, nr, addr) test_and_clear_bit_le(nr, addr) 10 + 11 + #endif /* _ASM_GENERIC_BITOPS_EXT2_ATOMIC_SETBIT_H_ */
+4
include/asm-generic/bitops/ext2-atomic.h
··· 1 1 #ifndef _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_ 2 2 #define _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_ 3 3 4 + /* 5 + * Spinlock based version of ext2 atomic bitops 6 + */ 7 + 4 8 #define ext2_set_bit_atomic(lock, nr, addr) \ 5 9 ({ \ 6 10 int ret; \