hfsplus: fix HFSPLUS_SB calling convention
HFSPLUS_SB doesn't return a pointer to the hfsplus-specific superblock information like all other FOO_SB macros, but dereference the pointer in a way that made it look like a direct struct derefence. This only works as long as the HFSPLUS_SB macro is used directly and prevents us from keepig a local hfsplus_sb_info pointer. Fix the calling convention and introduce a local sbi variable in all functions that use it constantly. Signed-off-by: Christoph Hellwig <hch@tuxera.com>
This commit is contained in:
committed by
Christoph Hellwig
parent
e753a62156
commit
dd73a01a30
@@ -17,6 +17,7 @@
|
||||
|
||||
int hfsplus_block_allocate(struct super_block *sb, u32 size, u32 offset, u32 *max)
|
||||
{
|
||||
struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb);
|
||||
struct page *page;
|
||||
struct address_space *mapping;
|
||||
__be32 *pptr, *curr, *end;
|
||||
@@ -29,8 +30,8 @@ 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);
|
||||
mutex_lock(&HFSPLUS_SB(sb).alloc_mutex);
|
||||
mapping = HFSPLUS_SB(sb).alloc_file->i_mapping;
|
||||
mutex_lock(&sbi->alloc_mutex);
|
||||
mapping = sbi->alloc_file->i_mapping;
|
||||
page = read_mapping_page(mapping, offset / PAGE_CACHE_BITS, NULL);
|
||||
if (IS_ERR(page)) {
|
||||
start = size;
|
||||
@@ -150,16 +151,17 @@ done:
|
||||
set_page_dirty(page);
|
||||
kunmap(page);
|
||||
*max = offset + (curr - pptr) * 32 + i - start;
|
||||
HFSPLUS_SB(sb).free_blocks -= *max;
|
||||
sbi->free_blocks -= *max;
|
||||
sb->s_dirt = 1;
|
||||
dprint(DBG_BITMAP, "-> %u,%u\n", start, *max);
|
||||
out:
|
||||
mutex_unlock(&HFSPLUS_SB(sb).alloc_mutex);
|
||||
mutex_unlock(&sbi->alloc_mutex);
|
||||
return start;
|
||||
}
|
||||
|
||||
int hfsplus_block_free(struct super_block *sb, u32 offset, u32 count)
|
||||
{
|
||||
struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb);
|
||||
struct page *page;
|
||||
struct address_space *mapping;
|
||||
__be32 *pptr, *curr, *end;
|
||||
@@ -172,11 +174,11 @@ int hfsplus_block_free(struct super_block *sb, u32 offset, u32 count)
|
||||
|
||||
dprint(DBG_BITMAP, "block_free: %u,%u\n", offset, count);
|
||||
/* are all of the bits in range? */
|
||||
if ((offset + count) > HFSPLUS_SB(sb).total_blocks)
|
||||
if ((offset + count) > sbi->total_blocks)
|
||||
return -2;
|
||||
|
||||
mutex_lock(&HFSPLUS_SB(sb).alloc_mutex);
|
||||
mapping = HFSPLUS_SB(sb).alloc_file->i_mapping;
|
||||
mutex_lock(&sbi->alloc_mutex);
|
||||
mapping = sbi->alloc_file->i_mapping;
|
||||
pnr = offset / PAGE_CACHE_BITS;
|
||||
page = read_mapping_page(mapping, pnr, NULL);
|
||||
pptr = kmap(page);
|
||||
@@ -224,9 +226,9 @@ done:
|
||||
out:
|
||||
set_page_dirty(page);
|
||||
kunmap(page);
|
||||
HFSPLUS_SB(sb).free_blocks += len;
|
||||
sbi->free_blocks += len;
|
||||
sb->s_dirt = 1;
|
||||
mutex_unlock(&HFSPLUS_SB(sb).alloc_mutex);
|
||||
mutex_unlock(&sbi->alloc_mutex);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user