aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-sh
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 /include/asm-sh
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>
Diffstat (limited to 'include/asm-sh')
-rw-r--r--include/asm-sh/bitops.h16
1 files changed, 5 insertions, 11 deletions
diff --git a/include/asm-sh/bitops.h b/include/asm-sh/bitops.h
index 1c526086004..f8d504e7d9d 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