git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git]
/
fs
/
hfsplus
/
bitmap.c
diff --git
a/fs/hfsplus/bitmap.c
b/fs/hfsplus/bitmap.c
index
644dcb5
..
d128a25
100644
(file)
--- a/
fs/hfsplus/bitmap.c
+++ b/
fs/hfsplus/bitmap.c
@@
-19,8
+19,9
@@
int hfsplus_block_allocate(struct super_block *sb, u32 size, u32 offset, u32 *ma
{
struct page *page;
struct address_space *mapping;
{
struct page *page;
struct address_space *mapping;
- u32 *pptr, *curr, *end;
- u32 val, mask, start, len;
+ __be32 *pptr, *curr, *end;
+ u32 mask, start, len, n;
+ __be32 val;
int i;
len = *max;
int i;
len = *max;
@@
-28,10
+29,9
@@
int hfsplus_block_allocate(struct super_block *sb, u32 size, u32 offset, u32 *ma
return size;
dprint(DBG_BITMAP, "block_allocate: %u,%u,%u\n", size, offset, len);
return size;
dprint(DBG_BITMAP, "block_allocate: %u,%u,%u\n", size, offset, len);
-
down(&HFSPLUS_SB(sb).alloc_file->i_sem
);
+
mutex_lock(&HFSPLUS_SB(sb).alloc_file->i_mutex
);
mapping = HFSPLUS_SB(sb).alloc_file->i_mapping;
mapping = HFSPLUS_SB(sb).alloc_file->i_mapping;
- page = read_cache_page(mapping, offset / PAGE_CACHE_BITS,
- (filler_t *)mapping->a_ops->readpage, NULL);
+ page = read_mapping_page(mapping, offset / PAGE_CACHE_BITS, NULL);
pptr = kmap(page);
curr = pptr + (offset & (PAGE_CACHE_BITS - 1)) / 32;
i = offset % 32;
pptr = kmap(page);
curr = pptr + (offset & (PAGE_CACHE_BITS - 1)) / 32;
i = offset % 32;
@@
-44,10
+44,10
@@
int hfsplus_block_allocate(struct super_block *sb, u32 size, u32 offset, u32 *ma
/* scan the first partial u32 for zero bits */
val = *curr;
if (~val) {
/* scan the first partial u32 for zero bits */
val = *curr;
if (~val) {
-
val
= be32_to_cpu(val);
+
n
= be32_to_cpu(val);
mask = (1U << 31) >> i;
for (; i < 32; mask >>= 1, i++) {
mask = (1U << 31) >> i;
for (; i < 32; mask >>= 1, i++) {
- if (!(
val
& mask))
+ if (!(
n
& mask))
goto found;
}
}
goto found;
}
}
@@
-58,10
+58,10
@@
int hfsplus_block_allocate(struct super_block *sb, u32 size, u32 offset, u32 *ma
while (curr < end) {
val = *curr;
if (~val) {
while (curr < end) {
val = *curr;
if (~val) {
-
val
= be32_to_cpu(val);
+
n
= be32_to_cpu(val);
mask = 1 << 31;
for (i = 0; i < 32; mask >>= 1, i++) {
mask = 1 << 31;
for (i = 0; i < 32; mask >>= 1, i++) {
- if (!(
val
& mask))
+ if (!(
n
& mask))
goto found;
}
}
goto found;
}
}
@@
-71,8
+71,8
@@
int hfsplus_block_allocate(struct super_block *sb, u32 size, u32 offset, u32 *ma
offset += PAGE_CACHE_BITS;
if (offset >= size)
break;
offset += PAGE_CACHE_BITS;
if (offset >= size)
break;
- page = read_
cache
_page(mapping, offset / PAGE_CACHE_BITS,
-
(filler_t *)mapping->a_ops->readpage,
NULL);
+ page = read_
mapping
_page(mapping, offset / PAGE_CACHE_BITS,
+
NULL);
curr = pptr = kmap(page);
if ((size ^ offset) / PAGE_CACHE_BITS)
end = pptr + PAGE_CACHE_BITS / 32;
curr = pptr = kmap(page);
if ((size ^ offset) / PAGE_CACHE_BITS)
end = pptr + PAGE_CACHE_BITS / 32;
@@
-92,34
+92,34
@@
found:
/* do any partial u32 at the start */
len = min(size - start, len);
while (1) {
/* do any partial u32 at the start */
len = min(size - start, len);
while (1) {
-
val
|= mask;
+
n
|= mask;
if (++i >= 32)
break;
mask >>= 1;
if (++i >= 32)
break;
mask >>= 1;
- if (!--len ||
val
& mask)
+ if (!--len ||
n
& mask)
goto done;
}
if (!--len)
goto done;
goto done;
}
if (!--len)
goto done;
- *curr++ = cpu_to_be32(
val
);
+ *curr++ = cpu_to_be32(
n
);
/* do full u32s */
while (1) {
while (curr < end) {
/* do full u32s */
while (1) {
while (curr < end) {
-
val
= be32_to_cpu(*curr);
+
n
= be32_to_cpu(*curr);
if (len < 32)
goto last;
if (len < 32)
goto last;
- if (
val
) {
+ if (
n
) {
len = 32;
goto last;
}
len = 32;
goto last;
}
- *curr++ =
0xffffffffU
;
+ *curr++ =
cpu_to_be32(0xffffffff)
;
len -= 32;
}
set_page_dirty(page);
kunmap(page);
offset += PAGE_CACHE_BITS;
len -= 32;
}
set_page_dirty(page);
kunmap(page);
offset += PAGE_CACHE_BITS;
- page = read_
cache
_page(mapping, offset / PAGE_CACHE_BITS,
-
(filler_t *)mapping->a_ops->readpage,
NULL);
+ page = read_
mapping
_page(mapping, offset / PAGE_CACHE_BITS,
+
NULL);
pptr = kmap(page);
curr = pptr;
end = pptr + PAGE_CACHE_BITS / 32;
pptr = kmap(page);
curr = pptr;
end = pptr + PAGE_CACHE_BITS / 32;
@@
-128,13
+128,13
@@
last:
/* do any partial u32 at end */
mask = 1U << 31;
for (i = 0; i < len; i++) {
/* do any partial u32 at end */
mask = 1U << 31;
for (i = 0; i < len; i++) {
- if (
val
& mask)
+ if (
n
& mask)
break;
break;
-
val
|= mask;
+
n
|= mask;
mask >>= 1;
}
done:
mask >>= 1;
}
done:
- *curr = cpu_to_be32(
val
);
+ *curr = cpu_to_be32(
n
);
set_page_dirty(page);
kunmap(page);
*max = offset + (curr - pptr) * 32 + i - start;
set_page_dirty(page);
kunmap(page);
*max = offset + (curr - pptr) * 32 + i - start;
@@
-142,7
+142,7
@@
done:
sb->s_dirt = 1;
dprint(DBG_BITMAP, "-> %u,%u\n", start, *max);
out:
sb->s_dirt = 1;
dprint(DBG_BITMAP, "-> %u,%u\n", start, *max);
out:
-
up(&HFSPLUS_SB(sb).alloc_file->i_sem
);
+
mutex_unlock(&HFSPLUS_SB(sb).alloc_file->i_mutex
);
return start;
}
return start;
}
@@
-150,7
+150,7
@@
int hfsplus_block_free(struct super_block *sb, u32 offset, u32 count)
{
struct page *page;
struct address_space *mapping;
{
struct page *page;
struct address_space *mapping;
-
u
32 *pptr, *curr, *end;
+
__be
32 *pptr, *curr, *end;
u32 mask, len, pnr;
int i;
u32 mask, len, pnr;
int i;
@@
-163,10
+163,10
@@
int hfsplus_block_free(struct super_block *sb, u32 offset, u32 count)
if ((offset + count) > HFSPLUS_SB(sb).total_blocks)
return -2;
if ((offset + count) > HFSPLUS_SB(sb).total_blocks)
return -2;
-
down(&HFSPLUS_SB(sb).alloc_file->i_sem
);
+
mutex_lock(&HFSPLUS_SB(sb).alloc_file->i_mutex
);
mapping = HFSPLUS_SB(sb).alloc_file->i_mapping;
pnr = offset / PAGE_CACHE_BITS;
mapping = HFSPLUS_SB(sb).alloc_file->i_mapping;
pnr = offset / PAGE_CACHE_BITS;
- page = read_
cache_page(mapping, pnr, (filler_t *)mapping->a_ops->readpage
, NULL);
+ page = read_
mapping_page(mapping, pnr
, NULL);
pptr = kmap(page);
curr = pptr + (offset & (PAGE_CACHE_BITS - 1)) / 32;
end = pptr + PAGE_CACHE_BITS / 32;
pptr = kmap(page);
curr = pptr + (offset & (PAGE_CACHE_BITS - 1)) / 32;
end = pptr + PAGE_CACHE_BITS / 32;
@@
-198,7
+198,7
@@
int hfsplus_block_free(struct super_block *sb, u32 offset, u32 count)
break;
set_page_dirty(page);
kunmap(page);
break;
set_page_dirty(page);
kunmap(page);
- page = read_
cache_page(mapping, ++pnr, (filler_t *)mapping->a_ops->readpage
, NULL);
+ page = read_
mapping_page(mapping, ++pnr
, NULL);
pptr = kmap(page);
curr = pptr;
end = pptr + PAGE_CACHE_BITS / 32;
pptr = kmap(page);
curr = pptr;
end = pptr + PAGE_CACHE_BITS / 32;
@@
-214,7
+214,7
@@
out:
kunmap(page);
HFSPLUS_SB(sb).free_blocks += len;
sb->s_dirt = 1;
kunmap(page);
HFSPLUS_SB(sb).free_blocks += len;
sb->s_dirt = 1;
-
up(&HFSPLUS_SB(sb).alloc_file->i_sem
);
+
mutex_unlock(&HFSPLUS_SB(sb).alloc_file->i_mutex
);
return 0;
}
return 0;
}