Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 187805
b: refs/heads/master
c: 3a065fc
h: refs/heads/master
i:
  187803: a0e94d8
v: v3
  • Loading branch information
Akinobu Mita authored and Jan Kara committed Mar 9, 2010
1 parent cce996c commit 0534c9f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 49 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5833ded9b6d783b8446349bada08f0f5e4227895
refs/heads/master: 3a065fcf9efed42ba736da7be528f2d3dec4965a
49 changes: 1 addition & 48 deletions trunk/fs/udf/balloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,55 +31,8 @@
#define udf_clear_bit(nr, addr) ext2_clear_bit(nr, addr)
#define udf_set_bit(nr, addr) ext2_set_bit(nr, addr)
#define udf_test_bit(nr, addr) ext2_test_bit(nr, addr)
#define udf_find_first_one_bit(addr, size) find_first_one_bit(addr, size)
#define udf_find_next_one_bit(addr, size, offset) \
find_next_one_bit(addr, size, offset)

#define leBPL_to_cpup(x) leNUM_to_cpup(BITS_PER_LONG, x)
#define leNUM_to_cpup(x, y) xleNUM_to_cpup(x, y)
#define xleNUM_to_cpup(x, y) (le ## x ## _to_cpup(y))
#define uintBPL_t uint(BITS_PER_LONG)
#define uint(x) xuint(x)
#define xuint(x) __le ## x

static inline int find_next_one_bit(void *addr, int size, int offset)
{
uintBPL_t *p = ((uintBPL_t *) addr) + (offset / BITS_PER_LONG);
int result = offset & ~(BITS_PER_LONG - 1);
unsigned long tmp;

if (offset >= size)
return size;
size -= result;
offset &= (BITS_PER_LONG - 1);
if (offset) {
tmp = leBPL_to_cpup(p++);
tmp &= ~0UL << offset;
if (size < BITS_PER_LONG)
goto found_first;
if (tmp)
goto found_middle;
size -= BITS_PER_LONG;
result += BITS_PER_LONG;
}
while (size & ~(BITS_PER_LONG - 1)) {
tmp = leBPL_to_cpup(p++);
if (tmp)
goto found_middle;
result += BITS_PER_LONG;
size -= BITS_PER_LONG;
}
if (!size)
return result;
tmp = leBPL_to_cpup(p);
found_first:
tmp &= ~0UL >> (BITS_PER_LONG - size);
found_middle:
return result + ffz(~tmp);
}

#define find_first_one_bit(addr, size)\
find_next_one_bit((addr), (size), 0)
ext2_find_next_bit(addr, size, offset)

static int read_block_bitmap(struct super_block *sb,
struct udf_bitmap *bitmap, unsigned int block,
Expand Down

0 comments on commit 0534c9f

Please sign in to comment.