]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[S390] fix ext2_find_next_bit
authorEric Sandeen <sandeen@redhat.com>
Thu, 21 Aug 2008 17:46:37 +0000 (19:46 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Thu, 21 Aug 2008 17:46:41 +0000 (19:46 +0200)
ext4 does not work on s390 because ext2_find_next_bit is broken. Fortunately
this function is only used by ext4. The function uses ffs which does not work
analog to ffz. The result of ffs has an offset of 1 which is not taken into
account. To fix this use the low level __ffs_word function directly instead
of the ill defined ffs.

In addition the patch improves find_next_zero_bit and ext2_find_next_zero_bit
by passing the bit offset into __ffz_word instead of adding it after the
function call returned.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/include/asm/bitops.h

index b4eb24ab5af97811e5a0ca1845607de238210863..8e9243ae0c19d13524a700c3ffea8aa4961665c8 100644 (file)
@@ -709,7 +709,7 @@ static inline int find_next_zero_bit (const unsigned long * addr,
                 * __ffz_word returns __BITOPS_WORDSIZE
                 * if no zero bit is present in the word.
                 */
-               set = __ffz_word(0, *p >> bit) + bit;
+               set = __ffz_word(bit, *p >> bit);
                if (set >= size)
                        return size + offset;
                if (set < __BITOPS_WORDSIZE)
@@ -824,7 +824,7 @@ static inline int ext2_find_next_zero_bit(void *vaddr, unsigned long size,
                 * s390 version of ffz returns __BITOPS_WORDSIZE
                 * if no zero bit is present in the word.
                 */
-               set = ffz(__load_ulong_le(p, 0) >> bit) + bit;
+               set = __ffz_word(bit, __load_ulong_le(p, 0) >> bit);
                if (set >= size)
                        return size + offset;
                if (set < __BITOPS_WORDSIZE)
@@ -865,7 +865,7 @@ static inline int ext2_find_next_bit(void *vaddr, unsigned long size,
                 * s390 version of ffz returns __BITOPS_WORDSIZE
                 * if no zero bit is present in the word.
                 */
-               set = ffs(__load_ulong_le(p, 0) >> bit) + bit;
+               set = __ffs_word(0, __load_ulong_le(p, 0) & (~0UL << bit));
                if (set >= size)
                        return size + offset;
                if (set < __BITOPS_WORDSIZE)