diff -rup -X dontdiff linux/fs/reiserfs/bitmap.c linux.patched/fs/reiserfs/bitmap.c
--- linux/fs/reiserfs/bitmap.c Mon Nov 19 15:14:15 2001
+++ linux.patched/fs/reiserfs/bitmap.c Mon Nov 19 15:09:04 2001
@@ -84,7 +84,7 @@ static inline void get_bit_address (stru
to free a list of blocks at once. -Hans */
/* I wonder if it would be less modest
now that we use journaling. -Hans */
-void reiserfs_free_block (struct reiserfs_transaction_handle *th, unsigned long block)
+static void _reiserfs_free_block (struct reiserfs_transaction_handle *th, unsigned long block)
{
struct super_block * s = th->t_super;
struct reiserfs_super_block * rs;
@@ -92,9 +92,6 @@ void reiserfs_free_block (struct reiserf
struct buffer_head ** apbh;
int nr, offset;
- RFALSE(!s, "vs-4060: trying to free block on nonexistent device");
- RFALSE(is_reusable (s, block, 1) == 0, "vs-4070: can not free such block");
-
PROC_INFO_INC( s, free_block );
- /* mark it before we clear it, just in case */
- journal_mark_freed(th, s, block) ;
-
reiserfs_prepare_for_journal(s, apbh[nr], 1 ) ;
/* clear bit for the given block in bit map */
@@ -131,7 +125,26 @@ void reiserfs_free_block (struct reiserf
s->s_dirt = 1;
}
+void reiserfs_free_block (struct reiserfs_transaction_handle *th,
+ unsigned long block) {
+ struct super_block * s = th->t_super;
+
+ 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");
+ /* mark it before we clear it, just in case */
+ journal_mark_freed(th, s, block) ;
+ _reiserfs_free_block(th, block) ;
+}
+
+/* preallocated blocks don't need to be run through journal_mark_freed */
+void reiserfs_free_prealloc_block (struct reiserfs_transaction_handle *th,
+ unsigned long block) {
+ struct super_block * s = th->t_super;
+ RFALSE(!s, "vs-4060: trying to free block on nonexistent device");
+ RFALSE(is_reusable (s, block, 1) == 0, "vs-4070: can not free such block");
+ _reiserfs_free_block(th, block) ;
+}
/* beginning from offset-th bit in bmap_nr-th bitmap block,
find_forward finds the closest zero bit. It returns 1 and zero
@@ -660,11 +673,13 @@ int reiserfs_new_unf_blocknrs2 (struct r
static void __discard_prealloc (struct reiserfs_transaction_handle * th,
struct inode * inode)
{
+ unsigned long save = inode->u.reiserfs_i.i_prealloc_block ;
while (inode->u.reiserfs_i.i_prealloc_count > 0) {
- reiserfs_free_block(th,inode->u.reiserfs_i.i_prealloc_block);
+ reiserfs_free_prealloc_block(th,inode->u.reiserfs_i.i_prealloc_block);
inode->u.reiserfs_i.i_prealloc_block++;
inode->u.reiserfs_i.i_prealloc_count --;
}
+ inode->u.reiserfs_i.i_prealloc_block = save ;
list_del (&(inode->u.reiserfs_i.i_prealloc_list));
}