From 1a50942b73015e6ac4e268ba46f28e42a9f6e08f Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Tue, 9 May 1995 15:33:07 +0000 Subject: Formerly balloc.c.~20~ --- ext2fs/balloc.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/ext2fs/balloc.c b/ext2fs/balloc.c index c430c7b2..0673cb93 100644 --- a/ext2fs/balloc.c +++ b/ext2fs/balloc.c @@ -289,6 +289,16 @@ got_block: goto repeat; } + /* Since due to bletcherousness block-modified bits are never turned off + when writing disk-pager pages, make sure they are here, in case this + block is being allocated to a file (see pager.c). */ + if (modified_global_blocks) + { + spin_lock (&modified_global_blocks_lock); + clear_bit (tmp, modified_global_blocks); + spin_unlock (&modified_global_blocks_lock); + } + ext2_debug ("found bit %d", j); /* @@ -305,11 +315,18 @@ got_block: if (set_bit (j + k, bh)) break; (*prealloc_count)++; + + /* (See comment before the clear_bit above) */ + if (modified_global_blocks) + { + spin_lock (&modified_global_blocks_lock); + clear_bit (tmp + k, modified_global_blocks); + spin_unlock (&modified_global_blocks_lock); + } } gdp->bg_free_blocks_count -= *prealloc_count; sblock->s_free_blocks_count -= *prealloc_count; - ext2_debug ("Preallocated a further %lu bits", - *prealloc_count); + ext2_debug ("Preallocated a further %lu bits", *prealloc_count); } #endif -- cgit v1.2.3