aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAkinobu Mita <mita@miraclelinux.com>2006-03-26 04:39:05 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-26 11:57:10 -0500
commit67b0ad574b5ee90f8ea58196ff8a7f3780b75365 (patch)
treeca9bc212f6efa8f5170185ef1fa21f75de0684fd
parent72b61a3cfd80d1321eb898be8ceae2064f0fbea1 (diff)
[PATCH] bitops: use non atomic operations for minix_*_bit() and ext2_*_bit()
Bitmap functions for the minix filesystem and the ext2 filesystem except ext2_set_bit_atomic() and ext2_clear_bit_atomic() do not require the atomic guarantees. But these are defined by using atomic bit operations on several architectures. (cris, frv, h8300, ia64, m32r, m68k, m68knommu, mips, s390, sh, sh64, sparc, sparc64, v850, and xtensa) This patch switches to non atomic bit operation. Signed-off-by: Akinobu Mita <mita@miraclelinux.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--include/asm-cris/bitops.h8
-rw-r--r--include/asm-frv/bitops.h14
-rw-r--r--include/asm-h8300/bitops.h6
-rw-r--r--include/asm-ia64/bitops.h10
-rw-r--r--include/asm-m32r/bitops.h2
-rw-r--r--include/asm-m68k/bitops.h10
-rw-r--r--include/asm-m68knommu/bitops.h6
-rw-r--r--include/asm-mips/bitops.h6
-rw-r--r--include/asm-s390/bitops.h10
-rw-r--r--include/asm-sh/bitops.h16
-rw-r--r--include/asm-sh64/bitops.h16
-rw-r--r--include/asm-sparc/bitops.h6
-rw-r--r--include/asm-sparc64/bitops.h6
-rw-r--r--include/asm-v850/bitops.h10
-rw-r--r--include/asm-xtensa/bitops.h6
15 files changed, 60 insertions, 72 deletions
diff --git a/include/asm-cris/bitops.h b/include/asm-cris/bitops.h
index f8a674769314..b1fca1fd8a5f 100644
--- a/include/asm-cris/bitops.h
+++ b/include/asm-cris/bitops.h
@@ -352,17 +352,17 @@ found_middle:
352#define find_first_bit(addr, size) \ 352#define find_first_bit(addr, size) \
353 find_next_bit((addr), (size), 0) 353 find_next_bit((addr), (size), 0)
354 354
355#define ext2_set_bit test_and_set_bit 355#define ext2_set_bit __test_and_set_bit
356#define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a) 356#define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a)
357#define ext2_clear_bit test_and_clear_bit 357#define ext2_clear_bit __test_and_clear_bit
358#define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a) 358#define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a)
359#define ext2_test_bit test_bit 359#define ext2_test_bit test_bit
360#define ext2_find_first_zero_bit find_first_zero_bit 360#define ext2_find_first_zero_bit find_first_zero_bit
361#define ext2_find_next_zero_bit find_next_zero_bit 361#define ext2_find_next_zero_bit find_next_zero_bit
362 362
363/* Bitmap functions for the minix filesystem. */ 363/* Bitmap functions for the minix filesystem. */
364#define minix_set_bit(nr,addr) test_and_set_bit(nr,addr) 364#define minix_set_bit(nr,addr) __test_and_set_bit(nr,addr)
365#define minix_clear_bit(nr,addr) test_and_clear_bit(nr,addr) 365#define minix_clear_bit(nr,addr) __test_and_clear_bit(nr,addr)
366#define minix_test_bit(nr,addr) test_bit(nr,addr) 366#define minix_test_bit(nr,addr) test_bit(nr,addr)
367#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size) 367#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
368 368
diff --git a/include/asm-frv/bitops.h b/include/asm-frv/bitops.h
index f686b519878e..9c5db5c34c1b 100644
--- a/include/asm-frv/bitops.h
+++ b/include/asm-frv/bitops.h
@@ -259,11 +259,11 @@ static inline int sched_find_first_bit(const unsigned long *b)
259#define hweight16(x) generic_hweight16(x) 259#define hweight16(x) generic_hweight16(x)
260#define hweight8(x) generic_hweight8(x) 260#define hweight8(x) generic_hweight8(x)
261 261
262#define ext2_set_bit(nr, addr) test_and_set_bit ((nr) ^ 0x18, (addr)) 262#define ext2_set_bit(nr, addr) __test_and_set_bit ((nr) ^ 0x18, (addr))
263#define ext2_clear_bit(nr, addr) test_and_clear_bit((nr) ^ 0x18, (addr)) 263#define ext2_clear_bit(nr, addr) __test_and_clear_bit((nr) ^ 0x18, (addr))
264 264
265#define ext2_set_bit_atomic(lock,nr,addr) ext2_set_bit((nr), addr) 265#define ext2_set_bit_atomic(lock,nr,addr) test_and_set_bit ((nr) ^ 0x18, (addr))
266#define ext2_clear_bit_atomic(lock,nr,addr) ext2_clear_bit((nr), addr) 266#define ext2_clear_bit_atomic(lock,nr,addr) test_and_clear_bit((nr) ^ 0x18, (addr))
267 267
268static inline int ext2_test_bit(int nr, const volatile void * addr) 268static inline int ext2_test_bit(int nr, const volatile void * addr)
269{ 269{
@@ -331,9 +331,9 @@ found_middle:
331} 331}
332 332
333/* Bitmap functions for the minix filesystem. */ 333/* Bitmap functions for the minix filesystem. */
334#define minix_test_and_set_bit(nr,addr) ext2_set_bit(nr,addr) 334#define minix_test_and_set_bit(nr,addr) __test_and_set_bit ((nr) ^ 0x18, (addr))
335#define minix_set_bit(nr,addr) ext2_set_bit(nr,addr) 335#define minix_set_bit(nr,addr) __set_bit((nr) ^ 0x18, (addr))
336#define minix_test_and_clear_bit(nr,addr) ext2_clear_bit(nr,addr) 336#define minix_test_and_clear_bit(nr,addr) __test_and_clear_bit((nr) ^ 0x18, (addr))
337#define minix_test_bit(nr,addr) ext2_test_bit(nr,addr) 337#define minix_test_bit(nr,addr) ext2_test_bit(nr,addr)
338#define minix_find_first_zero_bit(addr,size) ext2_find_first_zero_bit(addr,size) 338#define minix_find_first_zero_bit(addr,size) ext2_find_first_zero_bit(addr,size)
339 339
diff --git a/include/asm-h8300/bitops.h b/include/asm-h8300/bitops.h
index ff7c2b721594..af95f914e51c 100644
--- a/include/asm-h8300/bitops.h
+++ b/include/asm-h8300/bitops.h
@@ -397,9 +397,9 @@ found_middle:
397} 397}
398 398
399/* Bitmap functions for the minix filesystem. */ 399/* Bitmap functions for the minix filesystem. */
400#define minix_test_and_set_bit(nr,addr) test_and_set_bit(nr,addr) 400#define minix_test_and_set_bit(nr,addr) __test_and_set_bit(nr,addr)
401#define minix_set_bit(nr,addr) set_bit(nr,addr) 401#define minix_set_bit(nr,addr) __set_bit(nr,addr)
402#define minix_test_and_clear_bit(nr,addr) test_and_clear_bit(nr,addr) 402#define minix_test_and_clear_bit(nr,addr) __test_and_clear_bit(nr,addr)
403#define minix_test_bit(nr,addr) test_bit(nr,addr) 403#define minix_test_bit(nr,addr) test_bit(nr,addr)
404#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size) 404#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
405 405
diff --git a/include/asm-ia64/bitops.h b/include/asm-ia64/bitops.h
index 36d0fb95ea89..eccb01c79c1a 100644
--- a/include/asm-ia64/bitops.h
+++ b/include/asm-ia64/bitops.h
@@ -394,18 +394,18 @@ extern int __find_next_bit(const void *addr, unsigned long size,
394 394
395#define __clear_bit(nr, addr) clear_bit(nr, addr) 395#define __clear_bit(nr, addr) clear_bit(nr, addr)
396 396
397#define ext2_set_bit test_and_set_bit 397#define ext2_set_bit __test_and_set_bit
398#define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a) 398#define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a)
399#define ext2_clear_bit test_and_clear_bit 399#define ext2_clear_bit __test_and_clear_bit
400#define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a) 400#define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a)
401#define ext2_test_bit test_bit 401#define ext2_test_bit test_bit
402#define ext2_find_first_zero_bit find_first_zero_bit 402#define ext2_find_first_zero_bit find_first_zero_bit
403#define ext2_find_next_zero_bit find_next_zero_bit 403#define ext2_find_next_zero_bit find_next_zero_bit
404 404
405/* Bitmap functions for the minix filesystem. */ 405/* Bitmap functions for the minix filesystem. */
406#define minix_test_and_set_bit(nr,addr) test_and_set_bit(nr,addr) 406#define minix_test_and_set_bit(nr,addr) __test_and_set_bit(nr,addr)
407#define minix_set_bit(nr,addr) set_bit(nr,addr) 407#define minix_set_bit(nr,addr) __set_bit(nr,addr)
408#define minix_test_and_clear_bit(nr,addr) test_and_clear_bit(nr,addr) 408#define minix_test_and_clear_bit(nr,addr) __test_and_clear_bit(nr,addr)
409#define minix_test_bit(nr,addr) test_bit(nr,addr) 409#define minix_test_bit(nr,addr) test_bit(nr,addr)
410#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size) 410#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
411 411
diff --git a/include/asm-m32r/bitops.h b/include/asm-m32r/bitops.h
index abea2fdd8689..f8e993e0bbc0 100644
--- a/include/asm-m32r/bitops.h
+++ b/include/asm-m32r/bitops.h
@@ -575,7 +575,7 @@ found_middle:
575 */ 575 */
576 576
577#ifdef __LITTLE_ENDIAN__ 577#ifdef __LITTLE_ENDIAN__
578#define ext2_set_bit test_and_set_bit 578#define ext2_set_bit __test_and_set_bit
579#define ext2_clear_bit __test_and_clear_bit 579#define ext2_clear_bit __test_and_clear_bit
580#define ext2_test_bit test_bit 580#define ext2_test_bit test_bit
581#define ext2_find_first_zero_bit find_first_zero_bit 581#define ext2_find_first_zero_bit find_first_zero_bit
diff --git a/include/asm-m68k/bitops.h b/include/asm-m68k/bitops.h
index 13f4c0048463..b7955b39d963 100644
--- a/include/asm-m68k/bitops.h
+++ b/include/asm-m68k/bitops.h
@@ -365,9 +365,9 @@ static inline int minix_find_first_zero_bit(const void *vaddr, unsigned size)
365 return ((p - addr) << 4) + (res ^ 31); 365 return ((p - addr) << 4) + (res ^ 31);
366} 366}
367 367
368#define minix_test_and_set_bit(nr, addr) test_and_set_bit((nr) ^ 16, (unsigned long *)(addr)) 368#define minix_test_and_set_bit(nr, addr) __test_and_set_bit((nr) ^ 16, (unsigned long *)(addr))
369#define minix_set_bit(nr,addr) set_bit((nr) ^ 16, (unsigned long *)(addr)) 369#define minix_set_bit(nr,addr) __set_bit((nr) ^ 16, (unsigned long *)(addr))
370#define minix_test_and_clear_bit(nr, addr) test_and_clear_bit((nr) ^ 16, (unsigned long *)(addr)) 370#define minix_test_and_clear_bit(nr, addr) __test_and_clear_bit((nr) ^ 16, (unsigned long *)(addr))
371 371
372static inline int minix_test_bit(int nr, const void *vaddr) 372static inline int minix_test_bit(int nr, const void *vaddr)
373{ 373{
@@ -377,9 +377,9 @@ static inline int minix_test_bit(int nr, const void *vaddr)
377 377
378/* Bitmap functions for the ext2 filesystem. */ 378/* Bitmap functions for the ext2 filesystem. */
379 379
380#define ext2_set_bit(nr, addr) test_and_set_bit((nr) ^ 24, (unsigned long *)(addr)) 380#define ext2_set_bit(nr, addr) __test_and_set_bit((nr) ^ 24, (unsigned long *)(addr))
381#define ext2_set_bit_atomic(lock, nr, addr) test_and_set_bit((nr) ^ 24, (unsigned long *)(addr)) 381#define ext2_set_bit_atomic(lock, nr, addr) test_and_set_bit((nr) ^ 24, (unsigned long *)(addr))
382#define ext2_clear_bit(nr, addr) test_and_clear_bit((nr) ^ 24, (unsigned long *)(addr)) 382#define ext2_clear_bit(nr, addr) __test_and_clear_bit((nr) ^ 24, (unsigned long *)(addr))
383#define ext2_clear_bit_atomic(lock, nr, addr) test_and_clear_bit((nr) ^ 24, (unsigned long *)(addr)) 383#define ext2_clear_bit_atomic(lock, nr, addr) test_and_clear_bit((nr) ^ 24, (unsigned long *)(addr))
384 384
385static inline int ext2_test_bit(int nr, const void *vaddr) 385static inline int ext2_test_bit(int nr, const void *vaddr)
diff --git a/include/asm-m68knommu/bitops.h b/include/asm-m68knommu/bitops.h
index 25d8a3cfef90..00c4a2548e60 100644
--- a/include/asm-m68knommu/bitops.h
+++ b/include/asm-m68knommu/bitops.h
@@ -476,9 +476,9 @@ found_middle:
476} 476}
477 477
478/* Bitmap functions for the minix filesystem. */ 478/* Bitmap functions for the minix filesystem. */
479#define minix_test_and_set_bit(nr,addr) test_and_set_bit(nr,addr) 479#define minix_test_and_set_bit(nr,addr) __test_and_set_bit(nr,addr)
480#define minix_set_bit(nr,addr) set_bit(nr,addr) 480#define minix_set_bit(nr,addr) __set_bit(nr,addr)
481#define minix_test_and_clear_bit(nr,addr) test_and_clear_bit(nr,addr) 481#define minix_test_and_clear_bit(nr,addr) __test_and_clear_bit(nr,addr)
482#define minix_test_bit(nr,addr) test_bit(nr,addr) 482#define minix_test_bit(nr,addr) test_bit(nr,addr)
483#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size) 483#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
484 484
diff --git a/include/asm-mips/bitops.h b/include/asm-mips/bitops.h
index 8e802059fe67..0e83abc829d4 100644
--- a/include/asm-mips/bitops.h
+++ b/include/asm-mips/bitops.h
@@ -962,9 +962,9 @@ found_middle:
962 * FIXME: These assume that Minix uses the native byte/bitorder. 962 * FIXME: These assume that Minix uses the native byte/bitorder.
963 * This limits the Minix filesystem's value for data exchange very much. 963 * This limits the Minix filesystem's value for data exchange very much.
964 */ 964 */
965#define minix_test_and_set_bit(nr,addr) test_and_set_bit(nr,addr) 965#define minix_test_and_set_bit(nr,addr) __test_and_set_bit(nr,addr)
966#define minix_set_bit(nr,addr) set_bit(nr,addr) 966#define minix_set_bit(nr,addr) __set_bit(nr,addr)
967#define minix_test_and_clear_bit(nr,addr) test_and_clear_bit(nr,addr) 967#define minix_test_and_clear_bit(nr,addr) __test_and_clear_bit(nr,addr)
968#define minix_test_bit(nr,addr) test_bit(nr,addr) 968#define minix_test_bit(nr,addr) test_bit(nr,addr)
969#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size) 969#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
970 970
diff --git a/include/asm-s390/bitops.h b/include/asm-s390/bitops.h
index 3628899f48bb..6b6a01dfc8dc 100644
--- a/include/asm-s390/bitops.h
+++ b/include/asm-s390/bitops.h
@@ -871,11 +871,11 @@ static inline int sched_find_first_bit(unsigned long *b)
871 */ 871 */
872 872
873#define ext2_set_bit(nr, addr) \ 873#define ext2_set_bit(nr, addr) \
874 test_and_set_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr) 874 __test_and_set_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)
875#define ext2_set_bit_atomic(lock, nr, addr) \ 875#define ext2_set_bit_atomic(lock, nr, addr) \
876 test_and_set_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr) 876 test_and_set_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)
877#define ext2_clear_bit(nr, addr) \ 877#define ext2_clear_bit(nr, addr) \
878 test_and_clear_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr) 878 __test_and_clear_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)
879#define ext2_clear_bit_atomic(lock, nr, addr) \ 879#define ext2_clear_bit_atomic(lock, nr, addr) \
880 test_and_clear_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr) 880 test_and_clear_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)
881#define ext2_test_bit(nr, addr) \ 881#define ext2_test_bit(nr, addr) \
@@ -1014,11 +1014,11 @@ ext2_find_next_zero_bit(void *vaddr, unsigned long size, unsigned long offset)
1014/* Bitmap functions for the minix filesystem. */ 1014/* Bitmap functions for the minix filesystem. */
1015/* FIXME !!! */ 1015/* FIXME !!! */
1016#define minix_test_and_set_bit(nr,addr) \ 1016#define minix_test_and_set_bit(nr,addr) \
1017 test_and_set_bit(nr,(unsigned long *)addr) 1017 __test_and_set_bit(nr,(unsigned long *)addr)
1018#define minix_set_bit(nr,addr) \ 1018#define minix_set_bit(nr,addr) \
1019 set_bit(nr,(unsigned long *)addr) 1019 __set_bit(nr,(unsigned long *)addr)
1020#define minix_test_and_clear_bit(nr,addr) \ 1020#define minix_test_and_clear_bit(nr,addr) \
1021 test_and_clear_bit(nr,(unsigned long *)addr) 1021 __test_and_clear_bit(nr,(unsigned long *)addr)
1022#define minix_test_bit(nr,addr) \ 1022#define minix_test_bit(nr,addr) \
1023 test_bit(nr,(unsigned long *)addr) 1023 test_bit(nr,(unsigned long *)addr)
1024#define minix_find_first_zero_bit(addr,size) \ 1024#define minix_find_first_zero_bit(addr,size) \
diff --git a/include/asm-sh/bitops.h b/include/asm-sh/bitops.h
index 1c5260860045..f8d504e7d9d6 100644
--- a/include/asm-sh/bitops.h
+++ b/include/asm-sh/bitops.h
@@ -339,8 +339,8 @@ static inline int sched_find_first_bit(const unsigned long *b)
339} 339}
340 340
341#ifdef __LITTLE_ENDIAN__ 341#ifdef __LITTLE_ENDIAN__
342#define ext2_set_bit(nr, addr) test_and_set_bit((nr), (addr)) 342#define ext2_set_bit(nr, addr) __test_and_set_bit((nr), (addr))
343#define ext2_clear_bit(nr, addr) test_and_clear_bit((nr), (addr)) 343#define ext2_clear_bit(nr, addr) __test_and_clear_bit((nr), (addr))
344#define ext2_test_bit(nr, addr) test_bit((nr), (addr)) 344#define ext2_test_bit(nr, addr) test_bit((nr), (addr))
345#define ext2_find_first_zero_bit(addr, size) find_first_zero_bit((addr), (size)) 345#define ext2_find_first_zero_bit(addr, size) find_first_zero_bit((addr), (size))
346#define ext2_find_next_zero_bit(addr, size, offset) \ 346#define ext2_find_next_zero_bit(addr, size, offset) \
@@ -349,30 +349,24 @@ static inline int sched_find_first_bit(const unsigned long *b)
349static __inline__ int ext2_set_bit(int nr, volatile void * addr) 349static __inline__ int ext2_set_bit(int nr, volatile void * addr)
350{ 350{
351 int mask, retval; 351 int mask, retval;
352 unsigned long flags;
353 volatile unsigned char *ADDR = (unsigned char *) addr; 352 volatile unsigned char *ADDR = (unsigned char *) addr;
354 353
355 ADDR += nr >> 3; 354 ADDR += nr >> 3;
356 mask = 1 << (nr & 0x07); 355 mask = 1 << (nr & 0x07);
357 local_irq_save(flags);
358 retval = (mask & *ADDR) != 0; 356 retval = (mask & *ADDR) != 0;
359 *ADDR |= mask; 357 *ADDR |= mask;
360 local_irq_restore(flags);
361 return retval; 358 return retval;
362} 359}
363 360
364static __inline__ int ext2_clear_bit(int nr, volatile void * addr) 361static __inline__ int ext2_clear_bit(int nr, volatile void * addr)
365{ 362{
366 int mask, retval; 363 int mask, retval;
367 unsigned long flags;
368 volatile unsigned char *ADDR = (unsigned char *) addr; 364 volatile unsigned char *ADDR = (unsigned char *) addr;
369 365
370 ADDR += nr >> 3; 366 ADDR += nr >> 3;
371 mask = 1 << (nr & 0x07); 367 mask = 1 << (nr & 0x07);
372 local_irq_save(flags);
373 retval = (mask & *ADDR) != 0; 368 retval = (mask & *ADDR) != 0;
374 *ADDR &= ~mask; 369 *ADDR &= ~mask;
375 local_irq_restore(flags);
376 return retval; 370 return retval;
377} 371}
378 372
@@ -459,9 +453,9 @@ found_middle:
459 }) 453 })
460 454
461/* Bitmap functions for the minix filesystem. */ 455/* Bitmap functions for the minix filesystem. */
462#define minix_test_and_set_bit(nr,addr) test_and_set_bit(nr,addr) 456#define minix_test_and_set_bit(nr,addr) __test_and_set_bit(nr,addr)
463#define minix_set_bit(nr,addr) set_bit(nr,addr) 457#define minix_set_bit(nr,addr) __set_bit(nr,addr)
464#define minix_test_and_clear_bit(nr,addr) test_and_clear_bit(nr,addr) 458#define minix_test_and_clear_bit(nr,addr) __test_and_clear_bit(nr,addr)
465#define minix_test_bit(nr,addr) test_bit(nr,addr) 459#define minix_test_bit(nr,addr) test_bit(nr,addr)
466#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size) 460#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
467 461
diff --git a/include/asm-sh64/bitops.h b/include/asm-sh64/bitops.h
index ce9c3ad45fe0..5622b1a50cb1 100644
--- a/include/asm-sh64/bitops.h
+++ b/include/asm-sh64/bitops.h
@@ -382,8 +382,8 @@ static inline int sched_find_first_bit(unsigned long *b)
382#define hweight8(x) generic_hweight8(x) 382#define hweight8(x) generic_hweight8(x)
383 383
384#ifdef __LITTLE_ENDIAN__ 384#ifdef __LITTLE_ENDIAN__
385#define ext2_set_bit(nr, addr) test_and_set_bit((nr), (addr)) 385#define ext2_set_bit(nr, addr) __test_and_set_bit((nr), (addr))
386#define ext2_clear_bit(nr, addr) test_and_clear_bit((nr), (addr)) 386#define ext2_clear_bit(nr, addr) __test_and_clear_bit((nr), (addr))
387#define ext2_test_bit(nr, addr) test_bit((nr), (addr)) 387#define ext2_test_bit(nr, addr) test_bit((nr), (addr))
388#define ext2_find_first_zero_bit(addr, size) find_first_zero_bit((addr), (size)) 388#define ext2_find_first_zero_bit(addr, size) find_first_zero_bit((addr), (size))
389#define ext2_find_next_zero_bit(addr, size, offset) \ 389#define ext2_find_next_zero_bit(addr, size, offset) \
@@ -392,30 +392,24 @@ static inline int sched_find_first_bit(unsigned long *b)
392static __inline__ int ext2_set_bit(int nr, volatile void * addr) 392static __inline__ int ext2_set_bit(int nr, volatile void * addr)
393{ 393{
394 int mask, retval; 394 int mask, retval;
395 unsigned long flags;
396 volatile unsigned char *ADDR = (unsigned char *) addr; 395 volatile unsigned char *ADDR = (unsigned char *) addr;
397 396
398 ADDR += nr >> 3; 397 ADDR += nr >> 3;
399 mask = 1 << (nr & 0x07); 398 mask = 1 << (nr & 0x07);
400 local_irq_save(flags);
401 retval = (mask & *ADDR) != 0; 399 retval = (mask & *ADDR) != 0;
402 *ADDR |= mask; 400 *ADDR |= mask;
403 local_irq_restore(flags);
404 return retval; 401 return retval;
405} 402}
406 403
407static __inline__ int ext2_clear_bit(int nr, volatile void * addr) 404static __inline__ int ext2_clear_bit(int nr, volatile void * addr)
408{ 405{
409 int mask, retval; 406 int mask, retval;
410 unsigned long flags;
411 volatile unsigned char *ADDR = (unsigned char *) addr; 407 volatile unsigned char *ADDR = (unsigned char *) addr;
412 408
413 ADDR += nr >> 3; 409 ADDR += nr >> 3;
414 mask = 1 << (nr & 0x07); 410 mask = 1 << (nr & 0x07);
415 local_irq_save(flags);
416 retval = (mask & *ADDR) != 0; 411 retval = (mask & *ADDR) != 0;
417 *ADDR &= ~mask; 412 *ADDR &= ~mask;
418 local_irq_restore(flags);
419 return retval; 413 return retval;
420} 414}
421 415
@@ -502,9 +496,9 @@ found_middle:
502 }) 496 })
503 497
504/* Bitmap functions for the minix filesystem. */ 498/* Bitmap functions for the minix filesystem. */
505#define minix_test_and_set_bit(nr,addr) test_and_set_bit(nr,addr) 499#define minix_test_and_set_bit(nr,addr) __test_and_set_bit(nr,addr)
506#define minix_set_bit(nr,addr) set_bit(nr,addr) 500#define minix_set_bit(nr,addr) __set_bit(nr,addr)
507#define minix_test_and_clear_bit(nr,addr) test_and_clear_bit(nr,addr) 501#define minix_test_and_clear_bit(nr,addr) __test_and_clear_bit(nr,addr)
508#define minix_test_bit(nr,addr) test_bit(nr,addr) 502#define minix_test_bit(nr,addr) test_bit(nr,addr)
509#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size) 503#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
510 504
diff --git a/include/asm-sparc/bitops.h b/include/asm-sparc/bitops.h
index 41722b5e45ef..f25109d62032 100644
--- a/include/asm-sparc/bitops.h
+++ b/include/asm-sparc/bitops.h
@@ -523,11 +523,11 @@ found_middle:
523 523
524/* Bitmap functions for the minix filesystem. */ 524/* Bitmap functions for the minix filesystem. */
525#define minix_test_and_set_bit(nr,addr) \ 525#define minix_test_and_set_bit(nr,addr) \
526 test_and_set_bit((nr),(unsigned long *)(addr)) 526 __test_and_set_bit((nr),(unsigned long *)(addr))
527#define minix_set_bit(nr,addr) \ 527#define minix_set_bit(nr,addr) \
528 set_bit((nr),(unsigned long *)(addr)) 528 __set_bit((nr),(unsigned long *)(addr))
529#define minix_test_and_clear_bit(nr,addr) \ 529#define minix_test_and_clear_bit(nr,addr) \
530 test_and_clear_bit((nr),(unsigned long *)(addr)) 530 __test_and_clear_bit((nr),(unsigned long *)(addr))
531#define minix_test_bit(nr,addr) \ 531#define minix_test_bit(nr,addr) \
532 test_bit((nr),(unsigned long *)(addr)) 532 test_bit((nr),(unsigned long *)(addr))
533#define minix_find_first_zero_bit(addr,size) \ 533#define minix_find_first_zero_bit(addr,size) \
diff --git a/include/asm-sparc64/bitops.h b/include/asm-sparc64/bitops.h
index 6efc0162fb09..2361f8736498 100644
--- a/include/asm-sparc64/bitops.h
+++ b/include/asm-sparc64/bitops.h
@@ -280,11 +280,11 @@ extern unsigned long find_next_zero_le_bit(unsigned long *, unsigned long, unsig
280 280
281/* Bitmap functions for the minix filesystem. */ 281/* Bitmap functions for the minix filesystem. */
282#define minix_test_and_set_bit(nr,addr) \ 282#define minix_test_and_set_bit(nr,addr) \
283 test_and_set_bit((nr),(unsigned long *)(addr)) 283 __test_and_set_bit((nr),(unsigned long *)(addr))
284#define minix_set_bit(nr,addr) \ 284#define minix_set_bit(nr,addr) \
285 set_bit((nr),(unsigned long *)(addr)) 285 __set_bit((nr),(unsigned long *)(addr))
286#define minix_test_and_clear_bit(nr,addr) \ 286#define minix_test_and_clear_bit(nr,addr) \
287 test_and_clear_bit((nr),(unsigned long *)(addr)) 287 __test_and_clear_bit((nr),(unsigned long *)(addr))
288#define minix_test_bit(nr,addr) \ 288#define minix_test_bit(nr,addr) \
289 test_bit((nr),(unsigned long *)(addr)) 289 test_bit((nr),(unsigned long *)(addr))
290#define minix_find_first_zero_bit(addr,size) \ 290#define minix_find_first_zero_bit(addr,size) \
diff --git a/include/asm-v850/bitops.h b/include/asm-v850/bitops.h
index 609b9e87222a..44d596e792e7 100644
--- a/include/asm-v850/bitops.h
+++ b/include/asm-v850/bitops.h
@@ -336,18 +336,18 @@ static inline int sched_find_first_bit(unsigned long *b)
336#define hweight16(x) generic_hweight16 (x) 336#define hweight16(x) generic_hweight16 (x)
337#define hweight8(x) generic_hweight8 (x) 337#define hweight8(x) generic_hweight8 (x)
338 338
339#define ext2_set_bit test_and_set_bit 339#define ext2_set_bit __test_and_set_bit
340#define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a) 340#define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a)
341#define ext2_clear_bit test_and_clear_bit 341#define ext2_clear_bit __test_and_clear_bit
342#define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a) 342#define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a)
343#define ext2_test_bit test_bit 343#define ext2_test_bit test_bit
344#define ext2_find_first_zero_bit find_first_zero_bit 344#define ext2_find_first_zero_bit find_first_zero_bit
345#define ext2_find_next_zero_bit find_next_zero_bit 345#define ext2_find_next_zero_bit find_next_zero_bit
346 346
347/* Bitmap functions for the minix filesystem. */ 347/* Bitmap functions for the minix filesystem. */
348#define minix_test_and_set_bit test_and_set_bit 348#define minix_test_and_set_bit __test_and_set_bit
349#define minix_set_bit set_bit 349#define minix_set_bit __set_bit
350#define minix_test_and_clear_bit test_and_clear_bit 350#define minix_test_and_clear_bit __test_and_clear_bit
351#define minix_test_bit test_bit 351#define minix_test_bit test_bit
352#define minix_find_first_zero_bit find_first_zero_bit 352#define minix_find_first_zero_bit find_first_zero_bit
353 353
diff --git a/include/asm-xtensa/bitops.h b/include/asm-xtensa/bitops.h
index 0a2065f1a372..50b83726a497 100644
--- a/include/asm-xtensa/bitops.h
+++ b/include/asm-xtensa/bitops.h
@@ -436,9 +436,9 @@ static inline int sched_find_first_bit(const unsigned long *b)
436 436
437/* Bitmap functions for the minix filesystem. */ 437/* Bitmap functions for the minix filesystem. */
438 438
439#define minix_test_and_set_bit(nr,addr) test_and_set_bit(nr,addr) 439#define minix_test_and_set_bit(nr,addr) __test_and_set_bit(nr,addr)
440#define minix_set_bit(nr,addr) set_bit(nr,addr) 440#define minix_set_bit(nr,addr) __set_bit(nr,addr)
441#define minix_test_and_clear_bit(nr,addr) test_and_clear_bit(nr,addr) 441#define minix_test_and_clear_bit(nr,addr) __test_and_clear_bit(nr,addr)
442#define minix_test_bit(nr,addr) test_bit(nr,addr) 442#define minix_test_bit(nr,addr) test_bit(nr,addr)
443#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size) 443#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
444 444