]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
f2fs: avoid buggy functions
authorJaegeuk Kim <jaegeuk@kernel.org>
Mon, 18 May 2015 18:45:15 +0000 (11:45 -0700)
committerJaegeuk Kim <jaegeuk@kernel.org>
Mon, 1 Jun 2015 23:20:52 +0000 (16:20 -0700)
This patch avoids to use a buggy function for now.
It needs to fix them later.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/segment.c

index 342e0f761d8f717bec40fbb332e0013363a2a94d..fecf69900f94a23ebdba8fa6807aa18ed61045ae 100644 (file)
@@ -75,6 +75,14 @@ static inline unsigned long __reverse_ffs(unsigned long word)
 static unsigned long __find_rev_next_bit(const unsigned long *addr,
                        unsigned long size, unsigned long offset)
 {
+       while (!f2fs_test_bit(offset, (unsigned char *)addr))
+               offset++;
+
+       if (offset > size)
+               offset = size;
+
+       return offset;
+#if 0
        const unsigned long *p = addr + BIT_WORD(offset);
        unsigned long result = offset & ~(BITS_PER_LONG - 1);
        unsigned long tmp;
@@ -121,11 +129,20 @@ found_first:
                return result + size;   /* Nope. */
 found_middle:
        return result + __reverse_ffs(tmp);
+#endif
 }
 
 static unsigned long __find_rev_next_zero_bit(const unsigned long *addr,
                        unsigned long size, unsigned long offset)
 {
+       while (f2fs_test_bit(offset, (unsigned char *)addr))
+               offset++;
+
+       if (offset > size)
+               offset = size;
+
+       return offset;
+#if 0
        const unsigned long *p = addr + BIT_WORD(offset);
        unsigned long result = offset & ~(BITS_PER_LONG - 1);
        unsigned long tmp;
@@ -173,6 +190,7 @@ found_first:
                return result + size;   /* Nope. */
 found_middle:
        return result + __reverse_ffz(tmp);
+#endif
 }
 
 void register_inmem_page(struct inode *inode, struct page *page)