History log of /haiku/src/tests/system/kernel/cache/block_cache_test.cpp
Revision Date Author Comments
# 425ac1b6 20-Jun-2023 Alexander von Gluck IV <kallisti5@unixzen.com>

refactor: Swap %Ld for %lld in all format usages

* %Ld is an undocumented alias for %lld in glibc.
* muslc doesn't implement it for this reason.
* While we will likely never drop %Ld support,
lets clean house and set a better example.

Change-Id: Id46dad3104abae483e80cc5c05d1464d3ecd8030
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6636
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>


# 8c3a938f 19-Sep-2012 Axel Dörfler <axeld@pinc-software.de>

cache_abort_sub_transaction() did not maintain num_blocks.

* When a block was only used in a sub-transaction, it was thrown away,
but the transaction::num_blocks field was not decremented.
* This caused transactions never considered finished which eventually
led to bug #8942. This does not explain the disk corruption occurring
in #8969, though.


# 098967ce 03-Sep-2012 Axel Dörfler <axeld@pinc-software.de>

Fixed the new issue in #8910 from r44585.

* The ASSERT() I introduced in r44585 was incorrect: when the sub transaction
used block_cache_get_empty() to get the block, there is no original_data for
a reason.
* Added a test case that reproduces this situation.
* The block must be moved to the unused list in this situation, though, or else
it might contain invalid data. Since the block can only be allocated in the
current transaction, this should not be a problem, though, AFAICT.


# 713945ce 27-Aug-2012 Axel Dörfler <axeld@pinc-software.de>

The original_data could be freed late.

* In cache_abort_sub_transaction(), the original_data can already be freed
when the block is being removed from the transaction.
* block_cache::_GetUnusedBlock() no longer frees original/parent data - it
now requires them to be freed already (it makes no sense to have them still
around at this point).
* AFAICT the previous version did not have any negative consequences besides
freeing the original data late.


# a26045b7 05-Nov-2008 Axel Dörfler <axeld@pinc-software.de>

* cache_detach_sub_transaction(), and cache_abort_sub_transaction() now support
discarded blocks correctly as well.
* cache_detach_sub_transaction() left cached_block::original_data unchanged even
if the parent data was to become current (in case the sub transaction didn't
change the block yet). This could cause outdated blocks to be written back.
* cache_detach_sub_transaction() also set cached_block::previous_transaction
for all blocks, not just the ones with a previous transaction. This could
cause blocks to be written twice for no reason.
* cache_start_sub_transaction() did not change the num_blocks count for
discarded blocks.
* block_cache_discard() now panics if the block was already changed in the
current transaction.
* Improved test application, added more tests, revealing the above bugs in
cache_detach_sub_transaction().
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28514 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 96e19c19 04-Nov-2008 Axel Dörfler <axeld@pinc-software.de>

* The first functions now handle the "discard" flag correctly (namely
cache_end_transaction(), and cache_start_sub_transaction()).
* Further work on the test application, it's now actually usable, first test
passes.
* dump_block() did erroneously print 'B' for the dirty flag; now both dirty and
discard have the 'D' (3rd and 5th column).
* block_cache::LowMemoryHandler() is now private (and got an underscore prefix).
* Minor cleanup, shuffled some methods around.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28508 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5b812019 04-Nov-2008 Axel Dörfler <axeld@pinc-software.de>

* Added function block_cache_discard() that flushes blocks from the block cache,
discarding their changes. This functionality currently only works correctly
when no transactions are used.
* Started test application for the block cache, doesn't do anything yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28496 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8c3a938fc386a9733145ce251d538a29ecdf2987 19-Sep-2012 Axel Dörfler <axeld@pinc-software.de>

cache_abort_sub_transaction() did not maintain num_blocks.

* When a block was only used in a sub-transaction, it was thrown away,
but the transaction::num_blocks field was not decremented.
* This caused transactions never considered finished which eventually
led to bug #8942. This does not explain the disk corruption occurring
in #8969, though.


# 098967cee129b9116b468224257234c8ef1c9707 03-Sep-2012 Axel Dörfler <axeld@pinc-software.de>

Fixed the new issue in #8910 from r44585.

* The ASSERT() I introduced in r44585 was incorrect: when the sub transaction
used block_cache_get_empty() to get the block, there is no original_data for
a reason.
* Added a test case that reproduces this situation.
* The block must be moved to the unused list in this situation, though, or else
it might contain invalid data. Since the block can only be allocated in the
current transaction, this should not be a problem, though, AFAICT.


# 713945cecb4e18a400b5dc92797a6defe3f8a4bd 27-Aug-2012 Axel Dörfler <axeld@pinc-software.de>

The original_data could be freed late.

* In cache_abort_sub_transaction(), the original_data can already be freed
when the block is being removed from the transaction.
* block_cache::_GetUnusedBlock() no longer frees original/parent data - it
now requires them to be freed already (it makes no sense to have them still
around at this point).
* AFAICT the previous version did not have any negative consequences besides
freeing the original data late.


# a26045b7a60b033e8d39a8fdaba0204dd91d9363 05-Nov-2008 Axel Dörfler <axeld@pinc-software.de>

* cache_detach_sub_transaction(), and cache_abort_sub_transaction() now support
discarded blocks correctly as well.
* cache_detach_sub_transaction() left cached_block::original_data unchanged even
if the parent data was to become current (in case the sub transaction didn't
change the block yet). This could cause outdated blocks to be written back.
* cache_detach_sub_transaction() also set cached_block::previous_transaction
for all blocks, not just the ones with a previous transaction. This could
cause blocks to be written twice for no reason.
* cache_start_sub_transaction() did not change the num_blocks count for
discarded blocks.
* block_cache_discard() now panics if the block was already changed in the
current transaction.
* Improved test application, added more tests, revealing the above bugs in
cache_detach_sub_transaction().
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28514 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 96e19c19fc7bb2abd80384657151b1d53f73fb44 04-Nov-2008 Axel Dörfler <axeld@pinc-software.de>

* The first functions now handle the "discard" flag correctly (namely
cache_end_transaction(), and cache_start_sub_transaction()).
* Further work on the test application, it's now actually usable, first test
passes.
* dump_block() did erroneously print 'B' for the dirty flag; now both dirty and
discard have the 'D' (3rd and 5th column).
* block_cache::LowMemoryHandler() is now private (and got an underscore prefix).
* Minor cleanup, shuffled some methods around.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28508 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5b812019b48c620b3cdc4e15f59fe3f34b431a43 04-Nov-2008 Axel Dörfler <axeld@pinc-software.de>

* Added function block_cache_discard() that flushes blocks from the block cache,
discarding their changes. This functionality currently only works correctly
when no transactions are used.
* Started test application for the block cache, doesn't do anything yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28496 a95241bf-73f2-0310-859d-f6bbb57e9c96