Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 347877
b: refs/heads/master
c: 5daa669
h: refs/heads/master
i:
  347875: 8acf75d
v: v3
  • Loading branch information
Alan Cox authored and Linus Torvalds committed Dec 21, 2012
1 parent 2616e89 commit eca449a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 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: 44fd07e989a9a27476d8963296688127a4fd4df4
refs/heads/master: 5daa669c80c121ab75ecdf1c8e2df52f072fd25e
13 changes: 12 additions & 1 deletion trunk/fs/hfsplus/bitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,14 @@ 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) > sbi->total_blocks)
return -2;
return -ENOENT;

mutex_lock(&sbi->alloc_mutex);
mapping = sbi->alloc_file->i_mapping;
pnr = offset / PAGE_CACHE_BITS;
page = read_mapping_page(mapping, pnr, NULL);
if (IS_ERR(page))
goto kaboom;
pptr = kmap(page);
curr = pptr + (offset & (PAGE_CACHE_BITS - 1)) / 32;
end = pptr + PAGE_CACHE_BITS / 32;
Expand Down Expand Up @@ -214,6 +216,8 @@ int hfsplus_block_free(struct super_block *sb, u32 offset, u32 count)
set_page_dirty(page);
kunmap(page);
page = read_mapping_page(mapping, ++pnr, NULL);
if (IS_ERR(page))
goto kaboom;
pptr = kmap(page);
curr = pptr;
end = pptr + PAGE_CACHE_BITS / 32;
Expand All @@ -232,4 +236,11 @@ int hfsplus_block_free(struct super_block *sb, u32 offset, u32 count)
mutex_unlock(&sbi->alloc_mutex);

return 0;

kaboom:
printk(KERN_CRIT "hfsplus: unable to mark blocks free: error %ld\n",
PTR_ERR(page));
mutex_unlock(&sbi->alloc_mutex);

return -EIO;
}

0 comments on commit eca449a

Please sign in to comment.