1
0
Fork 0
mirror of https://gitlab.com/sortix/sortix.git synced 2023-02-13 20:55:38 -05:00

Fix extfs unmaintained invariant on bitmap free.

This commit is contained in:
Jonas 'Sortie' Termansen 2015-07-08 22:42:04 +02:00
parent 5deb51eeae
commit dd8b4198ec

View file

@ -48,7 +48,7 @@ BlockGroup::BlockGroup(Filesystem* filesystem, uint32_t group_id)
this->block_alloc_chunk = 0; this->block_alloc_chunk = 0;
this->inode_alloc_chunk = 0; this->inode_alloc_chunk = 0;
this->block_bitmap_chunk_i = 0; this->block_bitmap_chunk_i = 0;
// TODO: inode_bitmap_chunk_i this->inode_bitmap_chunk_i = 0;
this->first_block_id = filesystem->sb->s_first_data_block + this->first_block_id = filesystem->sb->s_first_data_block +
filesystem->sb->s_blocks_per_group * group_id; filesystem->sb->s_blocks_per_group * group_id;
this->first_inode_id = 1 + this->first_inode_id = 1 +
@ -187,6 +187,8 @@ void BlockGroup::FreeBlock(uint32_t block_id)
uint8_t* chunk_bits = block_bitmap_chunk->block_data; uint8_t* chunk_bits = block_bitmap_chunk->block_data;
clearbit(chunk_bits, chunk_bit); clearbit(chunk_bits, chunk_bit);
block_bitmap_chunk->FinishWrite(); block_bitmap_chunk->FinishWrite();
if ( chunk_bit < inode_bitmap_chunk_i )
block_bitmap_chunk_i = chunk_bit;
BeginWrite(); BeginWrite();
data->bg_free_blocks_count++; data->bg_free_blocks_count++;
FinishWrite(); FinishWrite();
@ -215,6 +217,8 @@ void BlockGroup::FreeInode(uint32_t inode_id)
uint8_t* chunk_bits = inode_bitmap_chunk->block_data; uint8_t* chunk_bits = inode_bitmap_chunk->block_data;
clearbit(chunk_bits, chunk_bit); clearbit(chunk_bits, chunk_bit);
inode_bitmap_chunk->FinishWrite(); inode_bitmap_chunk->FinishWrite();
if ( chunk_bit < inode_bitmap_chunk_i )
inode_bitmap_chunk_i = chunk_bit;
BeginWrite(); BeginWrite();
data->bg_free_inodes_count++; data->bg_free_inodes_count++;
FinishWrite(); FinishWrite();