Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=67fe9251bba510572feb6c3357636148bbd17e30
Commit:     67fe9251bba510572feb6c3357636148bbd17e30
Parent:     0abbf05cdd69d74f92628bf444cd210ba046f6eb
Author:     Heiko Carstens <[EMAIL PROTECTED]>
AuthorDate: Tue Feb 5 16:50:44 2008 +0100
Committer:  Martin Schwidefsky <[EMAIL PROTECTED]>
CommitDate: Tue Feb 5 16:50:58 2008 +0100

    [S390] Implement ext2_find_next_bit.
    
    Fixes this compile error:
    
    fs/ext4/mballoc.c:
        In function 'ext4_mb_generate_buddy':
    fs/ext4/mballoc.c:954:
        error: implicit declaration of function 'generic_find_next_le_bit'
    
    Signed-off-by: Heiko Carstens <[EMAIL PROTECTED]>
    Signed-off-by: Martin Schwidefsky <[EMAIL PROTECTED]>
---
 include/asm-s390/bitops.h |   43 +++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/include/asm-s390/bitops.h b/include/asm-s390/bitops.h
index 95d9395..882db05 100644
--- a/include/asm-s390/bitops.h
+++ b/include/asm-s390/bitops.h
@@ -790,8 +790,6 @@ static inline int sched_find_first_bit(unsigned long *b)
        test_and_clear_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)
 #define ext2_test_bit(nr, addr)      \
        test_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)
-#define ext2_find_next_bit(addr, size, off) \
-       generic_find_next_le_bit((unsigned long *)(addr), (size), (off))
 
 static inline int ext2_find_first_zero_bit(void *vaddr, unsigned int size)
 {
@@ -833,6 +831,47 @@ static inline int ext2_find_next_zero_bit(void *vaddr, 
unsigned long size,
        return offset + ext2_find_first_zero_bit(p, size);
 }
 
+static inline unsigned long ext2_find_first_bit(void *vaddr,
+                                               unsigned long size)
+{
+       unsigned long bytes, bits;
+
+       if (!size)
+               return 0;
+       bytes = __ffs_word_loop(vaddr, size);
+       bits = __ffs_word(bytes*8, __load_ulong_le(vaddr, bytes));
+       return (bits < size) ? bits : size;
+}
+
+static inline int ext2_find_next_bit(void *vaddr, unsigned long size,
+                                    unsigned long offset)
+{
+       unsigned long *addr = vaddr, *p;
+       unsigned long bit, set;
+
+       if (offset >= size)
+               return size;
+       bit = offset & (__BITOPS_WORDSIZE - 1);
+       offset -= bit;
+       size -= offset;
+       p = addr + offset / __BITOPS_WORDSIZE;
+       if (bit) {
+               /*
+                * 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;
+               if (set >= size)
+                       return size + offset;
+               if (set < __BITOPS_WORDSIZE)
+                       return set + offset;
+               offset += __BITOPS_WORDSIZE;
+               size -= __BITOPS_WORDSIZE;
+               p++;
+       }
+       return offset + ext2_find_first_bit(p, size);
+}
+
 #include <asm-generic/bitops/minix.h>
 
 #endif /* __KERNEL__ */
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to