diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2011-07-26 19:09:04 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-26 19:49:46 -0400 |
commit | 148817ba092f9f6edd35bad3c6c6b8e8f90fe2ed (patch) | |
tree | 75cc7df62c9713bc1a44738026878a79653faa38 /arch | |
parent | b2c9cd3793e5878e301ec2219785a7b8ca402ef1 (diff) |
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>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/alpha/include/asm/bitops.h | 3 | ||||
-rw-r--r-- | arch/arm/include/asm/bitops.h | 5 | ||||
-rw-r--r-- | arch/cris/include/asm/bitops.h | 3 | ||||
-rw-r--r-- | arch/frv/include/asm/bitops.h | 3 | ||||
-rw-r--r-- | arch/ia64/include/asm/bitops.h | 3 | ||||
-rw-r--r-- | arch/mn10300/include/asm/bitops.h | 7 | ||||
-rw-r--r-- | arch/parisc/include/asm/bitops.h | 9 | ||||
-rw-r--r-- | arch/powerpc/include/asm/bitops.h | 5 | ||||
-rw-r--r-- | arch/s390/include/asm/bitops.h | 5 | ||||
-rw-r--r-- | arch/sparc/include/asm/bitops_64.h | 5 | ||||
-rw-r--r-- | arch/tile/include/asm/bitops_64.h | 5 | ||||
-rw-r--r-- | arch/x86/include/asm/bitops.h | 5 | ||||
-rw-r--r-- | arch/xtensa/include/asm/bitops.h | 14 |
13 files changed, 13 insertions, 59 deletions
diff --git a/arch/alpha/include/asm/bitops.h b/arch/alpha/include/asm/bitops.h index 85b815215776..a19ba5efea4c 100644 --- a/arch/alpha/include/asm/bitops.h +++ b/arch/alpha/include/asm/bitops.h | |||
@@ -456,8 +456,7 @@ sched_find_first_bit(const unsigned long b[2]) | |||
456 | 456 | ||
457 | #include <asm-generic/bitops/le.h> | 457 | #include <asm-generic/bitops/le.h> |
458 | 458 | ||
459 | #define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a) | 459 | #include <asm-generic/bitops/ext2-atomic-setbit.h> |
460 | #define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a) | ||
461 | 460 | ||
462 | #endif /* __KERNEL__ */ | 461 | #endif /* __KERNEL__ */ |
463 | 462 | ||
diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h index f4280593dfa3..f7419ef9c8f9 100644 --- a/arch/arm/include/asm/bitops.h +++ b/arch/arm/include/asm/bitops.h | |||
@@ -310,10 +310,7 @@ static inline int find_next_bit_le(const void *p, int size, int offset) | |||
310 | /* | 310 | /* |
311 | * Ext2 is defined to use little-endian byte ordering. | 311 | * Ext2 is defined to use little-endian byte ordering. |
312 | */ | 312 | */ |
313 | #define ext2_set_bit_atomic(lock, nr, p) \ | 313 | #include <asm-generic/bitops/ext2-atomic-setbit.h> |
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) | ||
317 | 314 | ||
318 | #endif /* __KERNEL__ */ | 315 | #endif /* __KERNEL__ */ |
319 | 316 | ||
diff --git a/arch/cris/include/asm/bitops.h b/arch/cris/include/asm/bitops.h index 310e0de67aa6..c0092fc7d846 100644 --- a/arch/cris/include/asm/bitops.h +++ b/arch/cris/include/asm/bitops.h | |||
@@ -156,8 +156,7 @@ static inline int test_and_change_bit(int nr, volatile unsigned long *addr) | |||
156 | 156 | ||
157 | #include <asm-generic/bitops/le.h> | 157 | #include <asm-generic/bitops/le.h> |
158 | 158 | ||
159 | #define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a) | 159 | #include <asm-generic/bitops/ext2-atomic-setbit.h> |
160 | #define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a) | ||
161 | 160 | ||
162 | #include <asm-generic/bitops/sched.h> | 161 | #include <asm-generic/bitops/sched.h> |
163 | 162 | ||
diff --git a/arch/frv/include/asm/bitops.h b/arch/frv/include/asm/bitops.h index a1d00b0c6ed7..57bf85db893f 100644 --- a/arch/frv/include/asm/bitops.h +++ b/arch/frv/include/asm/bitops.h | |||
@@ -403,8 +403,7 @@ int __ilog2_u64(u64 n) | |||
403 | 403 | ||
404 | #include <asm-generic/bitops/le.h> | 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)) | 406 | #include <asm-generic/bitops/ext2-atomic-setbit.h> |
407 | #define ext2_clear_bit_atomic(lock,nr,addr) test_and_clear_bit((nr) ^ 0x18, (addr)) | ||
408 | 407 | ||
409 | #endif /* __KERNEL__ */ | 408 | #endif /* __KERNEL__ */ |
410 | 409 | ||
diff --git a/arch/ia64/include/asm/bitops.h b/arch/ia64/include/asm/bitops.h index b76f7e009218..8e20bff39f79 100644 --- a/arch/ia64/include/asm/bitops.h +++ b/arch/ia64/include/asm/bitops.h | |||
@@ -458,8 +458,7 @@ static __inline__ unsigned long __arch_hweight64(unsigned long x) | |||
458 | 458 | ||
459 | #include <asm-generic/bitops/le.h> | 459 | #include <asm-generic/bitops/le.h> |
460 | 460 | ||
461 | #define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a) | 461 | #include <asm-generic/bitops/ext2-atomic-setbit.h> |
462 | #define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a) | ||
463 | 462 | ||
464 | #include <asm-generic/bitops/sched.h> | 463 | #include <asm-generic/bitops/sched.h> |
465 | 464 | ||
diff --git a/arch/mn10300/include/asm/bitops.h b/arch/mn10300/include/asm/bitops.h index 0939462967e3..596bb2706d81 100644 --- a/arch/mn10300/include/asm/bitops.h +++ b/arch/mn10300/include/asm/bitops.h | |||
@@ -227,12 +227,7 @@ int ffs(int x) | |||
227 | #include <asm-generic/bitops/find.h> | 227 | #include <asm-generic/bitops/find.h> |
228 | #include <asm-generic/bitops/sched.h> | 228 | #include <asm-generic/bitops/sched.h> |
229 | #include <asm-generic/bitops/hweight.h> | 229 | #include <asm-generic/bitops/hweight.h> |
230 | 230 | #include <asm-generic/bitops/ext2-atomic-setbit.h> | |
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 | |||
236 | #include <asm-generic/bitops/le.h> | 231 | #include <asm-generic/bitops/le.h> |
237 | 232 | ||
238 | #endif /* __KERNEL__ */ | 233 | #endif /* __KERNEL__ */ |
diff --git a/arch/parisc/include/asm/bitops.h b/arch/parisc/include/asm/bitops.h index 43c516fa17ff..4e833aa05a44 100644 --- a/arch/parisc/include/asm/bitops.h +++ b/arch/parisc/include/asm/bitops.h | |||
@@ -223,14 +223,7 @@ static __inline__ int fls(int x) | |||
223 | #ifdef __KERNEL__ | 223 | #ifdef __KERNEL__ |
224 | 224 | ||
225 | #include <asm-generic/bitops/le.h> | 225 | #include <asm-generic/bitops/le.h> |
226 | 226 | #include <asm-generic/bitops/ext2-atomic-setbit.h> | |
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) | ||
234 | 227 | ||
235 | #endif /* __KERNEL__ */ | 228 | #endif /* __KERNEL__ */ |
236 | 229 | ||
diff --git a/arch/powerpc/include/asm/bitops.h b/arch/powerpc/include/asm/bitops.h index f18c6d9b9510..e137afcc10fa 100644 --- a/arch/powerpc/include/asm/bitops.h +++ b/arch/powerpc/include/asm/bitops.h | |||
@@ -327,10 +327,7 @@ unsigned long find_next_bit_le(const void *addr, | |||
327 | unsigned long size, unsigned long offset); | 327 | unsigned long size, unsigned long offset); |
328 | /* Bitmap functions for the ext2 filesystem */ | 328 | /* Bitmap functions for the ext2 filesystem */ |
329 | 329 | ||
330 | #define ext2_set_bit_atomic(lock, nr, addr) \ | 330 | #include <asm-generic/bitops/ext2-atomic-setbit.h> |
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) | ||
334 | 331 | ||
335 | #include <asm-generic/bitops/sched.h> | 332 | #include <asm-generic/bitops/sched.h> |
336 | 333 | ||
diff --git a/arch/s390/include/asm/bitops.h b/arch/s390/include/asm/bitops.h index 667c6e9f6a34..e5beb490959b 100644 --- a/arch/s390/include/asm/bitops.h +++ b/arch/s390/include/asm/bitops.h | |||
@@ -832,10 +832,7 @@ static inline int find_next_bit_le(void *vaddr, unsigned long size, | |||
832 | 832 | ||
833 | #include <asm-generic/bitops/le.h> | 833 | #include <asm-generic/bitops/le.h> |
834 | 834 | ||
835 | #define ext2_set_bit_atomic(lock, nr, addr) \ | 835 | #include <asm-generic/bitops/ext2-atomic-setbit.h> |
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) | ||
839 | 836 | ||
840 | 837 | ||
841 | #endif /* __KERNEL__ */ | 838 | #endif /* __KERNEL__ */ |
diff --git a/arch/sparc/include/asm/bitops_64.h b/arch/sparc/include/asm/bitops_64.h index 38e9aa1b2cea..325e295d60de 100644 --- a/arch/sparc/include/asm/bitops_64.h +++ b/arch/sparc/include/asm/bitops_64.h | |||
@@ -91,10 +91,7 @@ static inline unsigned int __arch_hweight8(unsigned int w) | |||
91 | 91 | ||
92 | #include <asm-generic/bitops/le.h> | 92 | #include <asm-generic/bitops/le.h> |
93 | 93 | ||
94 | #define ext2_set_bit_atomic(lock,nr,addr) \ | 94 | #include <asm-generic/bitops/ext2-atomic-setbit.h> |
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)) | ||
98 | 95 | ||
99 | #endif /* __KERNEL__ */ | 96 | #endif /* __KERNEL__ */ |
100 | 97 | ||
diff --git a/arch/tile/include/asm/bitops_64.h b/arch/tile/include/asm/bitops_64.h index 99615e8d2d8b..68f8c5bc0679 100644 --- a/arch/tile/include/asm/bitops_64.h +++ b/arch/tile/include/asm/bitops_64.h | |||
@@ -97,9 +97,6 @@ static inline int test_and_change_bit(unsigned nr, | |||
97 | return (oldval & mask) != 0; | 97 | return (oldval & mask) != 0; |
98 | } | 98 | } |
99 | 99 | ||
100 | #define ext2_set_bit_atomic(lock, nr, addr) \ | 100 | #include <asm-generic/bitops/ext2-atomic-setbit.h> |
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)) | ||
104 | 101 | ||
105 | #endif /* _ASM_TILE_BITOPS_64_H */ | 102 | #endif /* _ASM_TILE_BITOPS_64_H */ |
diff --git a/arch/x86/include/asm/bitops.h b/arch/x86/include/asm/bitops.h index 69d58131bc8e..1775d6e5920e 100644 --- a/arch/x86/include/asm/bitops.h +++ b/arch/x86/include/asm/bitops.h | |||
@@ -458,10 +458,7 @@ static inline int fls(int x) | |||
458 | 458 | ||
459 | #include <asm-generic/bitops/le.h> | 459 | #include <asm-generic/bitops/le.h> |
460 | 460 | ||
461 | #define ext2_set_bit_atomic(lock, nr, addr) \ | 461 | #include <asm-generic/bitops/ext2-atomic-setbit.h> |
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)) | ||
465 | 462 | ||
466 | #endif /* __KERNEL__ */ | 463 | #endif /* __KERNEL__ */ |
467 | #endif /* _ASM_X86_BITOPS_H */ | 464 | #endif /* _ASM_X86_BITOPS_H */ |
diff --git a/arch/xtensa/include/asm/bitops.h b/arch/xtensa/include/asm/bitops.h index c8fac8d8190d..40aa7fe77f66 100644 --- a/arch/xtensa/include/asm/bitops.h +++ b/arch/xtensa/include/asm/bitops.h | |||
@@ -108,19 +108,7 @@ static inline unsigned long __fls(unsigned long word) | |||
108 | #include <asm-generic/bitops/find.h> | 108 | #include <asm-generic/bitops/find.h> |
109 | #include <asm-generic/bitops/le.h> | 109 | #include <asm-generic/bitops/le.h> |
110 | 110 | ||
111 | #ifdef __XTENSA_EL__ | 111 | #include <asm-generic/bitops/ext2-atomic-setbit.h> |
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 | ||
124 | 112 | ||
125 | #include <asm-generic/bitops/hweight.h> | 113 | #include <asm-generic/bitops/hweight.h> |
126 | #include <asm-generic/bitops/lock.h> | 114 | #include <asm-generic/bitops/lock.h> |