提交 e19ef527 编写于 作者: J Jaegeuk Kim

f2fs: avoid buggy functions

This patch avoids to use a buggy function for now.
It needs to fix them later.
Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
上级 08b95126
...@@ -75,6 +75,14 @@ static inline unsigned long __reverse_ffs(unsigned long word) ...@@ -75,6 +75,14 @@ static inline unsigned long __reverse_ffs(unsigned long word)
static unsigned long __find_rev_next_bit(const unsigned long *addr, static unsigned long __find_rev_next_bit(const unsigned long *addr,
unsigned long size, unsigned long offset) 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); const unsigned long *p = addr + BIT_WORD(offset);
unsigned long result = offset & ~(BITS_PER_LONG - 1); unsigned long result = offset & ~(BITS_PER_LONG - 1);
unsigned long tmp; unsigned long tmp;
...@@ -121,11 +129,20 @@ static unsigned long __find_rev_next_bit(const unsigned long *addr, ...@@ -121,11 +129,20 @@ static unsigned long __find_rev_next_bit(const unsigned long *addr,
return result + size; /* Nope. */ return result + size; /* Nope. */
found_middle: found_middle:
return result + __reverse_ffs(tmp); return result + __reverse_ffs(tmp);
#endif
} }
static unsigned long __find_rev_next_zero_bit(const unsigned long *addr, static unsigned long __find_rev_next_zero_bit(const unsigned long *addr,
unsigned long size, unsigned long offset) 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); const unsigned long *p = addr + BIT_WORD(offset);
unsigned long result = offset & ~(BITS_PER_LONG - 1); unsigned long result = offset & ~(BITS_PER_LONG - 1);
unsigned long tmp; unsigned long tmp;
...@@ -173,6 +190,7 @@ static unsigned long __find_rev_next_zero_bit(const unsigned long *addr, ...@@ -173,6 +190,7 @@ static unsigned long __find_rev_next_zero_bit(const unsigned long *addr,
return result + size; /* Nope. */ return result + size; /* Nope. */
found_middle: found_middle:
return result + __reverse_ffz(tmp); return result + __reverse_ffz(tmp);
#endif
} }
void register_inmem_page(struct inode *inode, struct page *page) void register_inmem_page(struct inode *inode, struct page *page)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册