lkml.org 
[lkml]   [2011]   [Jan]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
SubjectRe: [PATCH v4 00/24] Introduce little endian bitops
From
2011/1/17 Russell King <rmk@arm.linux.org.uk>:
> 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.

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?
diff -Nurp linux-v4/arch/arm/include/asm/bitops.h linux-v4-fix/arch/arm/include/asm/bitops.h
--- linux-v4/arch/arm/include/asm/bitops.h 2011-01-17 19:53:07.000000000 +0900
+++ linux-v4-fix/arch/arm/include/asm/bitops.h 2011-01-18 15:40:15.000000000 +0900
@@ -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__ */

diff -Nurp linux-v4/arch/m68k/include/asm/bitops_mm.h linux-v4-fix/arch/m68k/include/asm/bitops_mm.h
--- linux-v4/arch/m68k/include/asm/bitops_mm.h 2011-01-17 19:53:07.000000000 +0900
+++ linux-v4-fix/arch/m68k/include/asm/bitops_mm.h 2011-01-18 15:40:15.000000000 +0900
@@ -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_le
return (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(cons
return (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__ */

diff -Nurp linux-v4/arch/m68k/include/asm/bitops_no.h linux-v4-fix/arch/m68k/include/asm/bitops_no.h
--- linux-v4/arch/m68k/include/asm/bitops_no.h 2011-01-17 19:53:07.000000000 +0900
+++ linux-v4-fix/arch/m68k/include/asm/bitops_no.h 2011-01-18 15:40:15.000000000 +0900
@@ -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)
{
diff -Nurp linux-v4/arch/powerpc/include/asm/bitops.h linux-v4-fix/arch/powerpc/include/asm/bitops.h
--- linux-v4/arch/powerpc/include/asm/bitops.h 2011-01-17 19:53:07.000000000 +0900
+++ linux-v4-fix/arch/powerpc/include/asm/bitops.h 2011-01-18 15:40:15.000000000 +0900
@@ -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 */

diff -Nurp linux-v4/arch/s390/include/asm/bitops.h linux-v4-fix/arch/s390/include/asm/bitops.h
--- linux-v4/arch/s390/include/asm/bitops.h 2011-01-17 19:53:07.000000000 +0900
+++ linux-v4-fix/arch/s390/include/asm/bitops.h 2011-01-18 15:40:15.000000000 +0900
@@ -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__ */
diff -Nurp linux-v4/fs/ext2/ext2.h linux-v4-fix/fs/ext2/ext2.h
--- linux-v4/fs/ext2/ext2.h 2011-01-17 19:53:07.000000000 +0900
+++ linux-v4-fix/fs/ext2/ext2.h 2011-01-18 15:40:15.000000000 +0900
@@ -175,13 +175,8 @@ ext2_group_first_block_no(struct super_b
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))
+#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
diff -Nurp linux-v4/fs/ext4/ext4.h linux-v4-fix/fs/ext4/ext4.h
--- linux-v4/fs/ext4/ext4.h 2011-01-17 19:53:07.000000000 +0900
+++ linux-v4-fix/fs/ext4/ext4.h 2011-01-18 15:40:15.000000000 +0900
@@ -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
diff -Nurp linux-v4/fs/minix/minix.h linux-v4-fix/fs/minix/minix.h
--- linux-v4/fs/minix/minix.h 2011-01-17 19:53:07.000000000 +0900
+++ linux-v4-fix/fs/minix/minix.h 2011-01-18 15:40:15.000000000 +0900
@@ -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

diff -Nurp linux-v4/fs/nilfs2/alloc.h linux-v4-fix/fs/nilfs2/alloc.h
--- linux-v4/fs/nilfs2/alloc.h 2011-01-17 19:53:07.000000000 +0900
+++ linux-v4-fix/fs/nilfs2/alloc.h 2011-01-18 15:40:15.000000000 +0900
@@ -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
diff -Nurp linux-v4/fs/ocfs2/ocfs2.h linux-v4-fix/fs/ocfs2/ocfs2.h
--- linux-v4/fs/ocfs2/ocfs2.h 2011-01-17 19:53:07.000000000 +0900
+++ linux-v4-fix/fs/ocfs2/ocfs2.h 2011-01-18 15:40:15.000000000 +0900
@@ -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 */

diff -Nurp linux-v4/fs/udf/balloc.c linux-v4-fix/fs/udf/balloc.c
--- linux-v4/fs/udf/balloc.c 2011-01-17 19:53:07.000000000 +0900
+++ linux-v4-fix/fs/udf/balloc.c 2011-01-18 15:40:15.000000000 +0900
@@ -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,
diff -Nurp linux-v4/fs/ufs/util.h linux-v4-fix/fs/ufs/util.h
--- linux-v4/fs/ufs/util.h 2011-01-17 19:53:07.000000000 +0900
+++ linux-v4-fix/fs/ufs/util.h 2011-01-18 15:40:15.000000000 +0900
@@ -408,7 +408,7 @@ static inline unsigned _ubh_find_next_ze
for (;;) {
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++;
diff -Nurp linux-v4/include/asm-generic/bitops/ext2-atomic.h linux-v4-fix/include/asm-generic/bitops/ext2-atomic.h
--- linux-v4/include/asm-generic/bitops/ext2-atomic.h 2011-01-17 19:53:07.000000000 +0900
+++ linux-v4-fix/include/asm-generic/bitops/ext2-atomic.h 2011-01-18 15:40:15.000000000 +0900
@@ -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; \
})
diff -Nurp linux-v4/include/asm-generic/bitops/le.h linux-v4-fix/include/asm-generic/bitops/le.h
--- linux-v4/include/asm-generic/bitops/le.h 2011-01-17 19:53:07.000000000 +0900
+++ linux-v4-fix/include/asm-generic/bitops/le.h 2011-01-18 15:40:15.000000000 +0900
@@ -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_ */
diff -Nurp linux-v4/include/linux/ext3_fs.h linux-v4-fix/include/linux/ext3_fs.h
--- linux-v4/include/linux/ext3_fs.h 2011-01-17 19:53:07.000000000 +0900
+++ linux-v4-fix/include/linux/ext3_fs.h 2011-01-18 15:40:15.000000000 +0900
@@ -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
diff -Nurp linux-v4/include/linux/reiserfs_fs.h linux-v4-fix/include/linux/reiserfs_fs.h
--- linux-v4/include/linux/reiserfs_fs.h 2011-01-17 19:53:07.000000000 +0900
+++ linux-v4-fix/include/linux/reiserfs_fs.h 2011-01-18 15:40:15.000000000 +0900
@@ -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
diff -Nurp linux-v4/lib/find_next_bit.c linux-v4-fix/lib/find_next_bit.c
--- linux-v4/lib/find_next_bit.c 2011-01-17 19:53:07.000000000 +0900
+++ linux-v4-fix/lib/find_next_bit.c 2011-01-18 15:40:15.000000000 +0900
@@ -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) {
diff -Nurp linux-v4/net/rds/cong.c linux-v4-fix/net/rds/cong.c
--- linux-v4/net/rds/cong.c 2011-01-17 19:53:07.000000000 +0900
+++ linux-v4-fix/net/rds/cong.c 2011-01-18 15:40:15.000000000 +0900
@@ -33,6 +33,7 @@
#include <linux/slab.h>
#include <linux/types.h>
#include <linux/rbtree.h>
+#include <linux/bitops.h>

#include "rds.h"
\
 
 \ /
  Last update: 2011-01-18 10:51    [from the cache]
©2003-2011 Jasper Spaans