Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 71403
b: refs/heads/master
c: d4c3d19
h: refs/heads/master
i:
  71401: fa86f18
  71399: 30d6fea
v: v3
  • Loading branch information
Jeff Mahoney authored and Linus Torvalds committed Oct 19, 2007
1 parent 90395ed commit 069e740
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 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: 8e186e454e871678c01b7eec4da5865111076095
refs/heads/master: d4c3d19d0c10701459f16c022ea23eff5e127747
21 changes: 13 additions & 8 deletions trunk/fs/reiserfs/bitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ static inline void get_bit_address(struct super_block *s,
*offset = block & ((s->s_blocksize << 3) - 1);
}

#ifdef CONFIG_REISERFS_CHECK
int is_reusable(struct super_block *s, b_blocknr_t block, int bit_value)
{
int bmap, offset;
Expand Down Expand Up @@ -106,7 +105,6 @@ int is_reusable(struct super_block *s, b_blocknr_t block, int bit_value)

return 1;
}
#endif /* CONFIG_REISERFS_CHECK */

/* searches in journal structures for a given block number (bmap, off). If block
is found in reiserfs journal it suggests next free block candidate to test. */
Expand Down Expand Up @@ -434,12 +432,19 @@ void reiserfs_free_block(struct reiserfs_transaction_handle *th,
int for_unformatted)
{
struct super_block *s = th->t_super;

BUG_ON(!th->t_trans_id);

RFALSE(!s, "vs-4061: trying to free block on nonexistent device");
RFALSE(is_reusable(s, block, 1) == 0,
"vs-4071: can not free such block");
if (!is_reusable(s, block, 1))
return;

if (block > sb_block_count(REISERFS_SB(s)->s_rs)) {
reiserfs_panic(th->t_super, "bitmap-4072",
"Trying to free block outside file system "
"boundaries (%lu > %lu)",
block, sb_block_count(REISERFS_SB(s)->s_rs));
return;
}
/* mark it before we clear it, just in case */
journal_mark_freed(th, s, block);
_reiserfs_free_block(th, inode, block, for_unformatted);
Expand All @@ -449,11 +454,11 @@ void reiserfs_free_block(struct reiserfs_transaction_handle *th,
static void reiserfs_free_prealloc_block(struct reiserfs_transaction_handle *th,
struct inode *inode, b_blocknr_t block)
{
BUG_ON(!th->t_trans_id);
RFALSE(!th->t_super,
"vs-4060: trying to free block on nonexistent device");
RFALSE(is_reusable(th->t_super, block, 1) == 0,
"vs-4070: can not free such block");
BUG_ON(!th->t_trans_id);
if (!is_reusable(th->t_super, block, 1))
return;
_reiserfs_free_block(th, inode, block, 1);
}

Expand Down

0 comments on commit 069e740

Please sign in to comment.