summaryrefslogtreecommitdiff
path: root/Kernel/FileSystem/Ext2FileSystem.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-04-25 22:05:32 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-04-25 22:05:32 +0200
commite0cdc5db0df929e202b69ff8df9029a564ff7a3c (patch)
treecf216c9ae767b00de29d6df1dd73e6e8bdb76188 /Kernel/FileSystem/Ext2FileSystem.cpp
parentde4b77ef271d8cbc22046ba5f518c47d4e4d6cf8 (diff)
downloadserenity-e0cdc5db0df929e202b69ff8df9029a564ff7a3c.zip
Ext2FS: Reduce debug spam in block allocation.
Diffstat (limited to 'Kernel/FileSystem/Ext2FileSystem.cpp')
-rw-r--r--Kernel/FileSystem/Ext2FileSystem.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/Kernel/FileSystem/Ext2FileSystem.cpp b/Kernel/FileSystem/Ext2FileSystem.cpp
index 6459977690..f8d161472c 100644
--- a/Kernel/FileSystem/Ext2FileSystem.cpp
+++ b/Kernel/FileSystem/Ext2FileSystem.cpp
@@ -982,20 +982,24 @@ bool Ext2FS::set_inode_allocation_state(unsigned index, bool newState)
bool Ext2FS::set_block_allocation_state(BlockIndex block_index, bool new_state)
{
LOCKER(m_lock);
+#ifdef EXT2_DEBUG
dbgprintf("Ext2FS: set_block_allocation_state(block=%u, state=%u)\n", block_index, new_state);
+#endif
unsigned group_index = group_index_from_block_index(block_index);
auto& bgd = group_descriptor(group_index);
BlockIndex index_in_group = block_index - ((group_index - 1) * blocks_per_group());
unsigned bit_index = index_in_group % blocks_per_group();
+#ifdef EXT2_DEBUG
dbgprintf(" index_in_group: %u\n", index_in_group);
dbgprintf(" blocks_per_group: %u\n", blocks_per_group());
dbgprintf(" bit_index: %u\n", bit_index);
dbgprintf(" read_block(%u)\n", bgd.bg_block_bitmap);
+#endif
auto block = read_block(bgd.bg_block_bitmap);
ASSERT(block);
auto bitmap = Bitmap::wrap(block.pointer(), blocks_per_group());
bool current_state = bitmap.get(bit_index);
- dbgprintf("Ext2FS: block %u state: %u -> %u\n", block_index, current_state, new_state);
+ dbgprintf("Ext2FS: block %u state: %u -> %u\n", block_index, current_state, new_state);
if (current_state == new_state) {
ASSERT_NOT_REACHED();
@@ -1021,7 +1025,7 @@ bool Ext2FS::set_block_allocation_state(BlockIndex block_index, bool new_state)
--mutable_bgd.bg_free_blocks_count;
else
++mutable_bgd.bg_free_blocks_count;
- dbgprintf("Ext2FS: group free block count %u -> %u\n", bgd.bg_free_blocks_count, bgd.bg_free_blocks_count - 1);
+ dbgprintf("Ext2FS: group %u free block count %u -> %u\n", group_index, bgd.bg_free_blocks_count, bgd.bg_free_blocks_count - 1);
flush_block_group_descriptor_table();
return true;