History log of /haiku/src/add-ons/kernel/file_systems/ext2/BitmapBlock.cpp
Revision Date Author Comments
# 3319ef3f 29-Oct-2023 Jérôme Duval <jerome.duval@gmail.com>

ext2: BitmapBlock::FindPreviousMarked(): index shouldn't go negative

fix #14404

Change-Id: I831c7d5cabbb804ab74d582caafb1d6cd281ca34
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7076
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>


# ce4e12ca 10-Oct-2018 Jérôme Duval <jerome.duval@gmail.com>

ext2: implements metadata_csum and 64bit features.

* Some PVS-Studio warnings are removed.
* fixes hardlink count in source and destination folders on rename.
* tested with fstorture and fsx (one job).
* add new definitions.
* import crc32c code from BSD.
* add some consistency checks at mount.
* DirectoryIterator::_AllocateBestEntryInBlock(), the direntry is checked for
consistency before using it, which should avoid crashing on bad data.
* DirectoryIterator::_SplitIndexedBlock(): the dotdot entry length should
include the dot and dotdot entries length.

Change-Id: I0f80d73b65b1ae6ddb2e746a6f85ef806f23dbb0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1735
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# a130bab3 08-May-2013 Jérôme Duval <jerome.duval@gmail.com>

ext2: fixes 64 bit warnings


# fd4998dc 12-Jan-2011 Jérôme Duval <korli@users.berlios.de>

Factorized _Update() and _Check() out of Mark(), Unmark(), CheckMarked() and CheckUnmarked().
Inline some methods.


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


# 09af5be2 09-Jan-2011 Jérôme Duval <korli@users.berlios.de>

Factorized _FindNext() out of FindNextMarked() and FindNextUnmarked().


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


# 4359b745 09-Jan-2011 Jérôme Duval <korli@users.berlios.de>

* finding marked or unmarked bit in the last double word didn't work, we need to take start pos into account. Should fix #7079.


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


# 847a2179 09-Jan-2011 Jérôme Duval <korli@users.berlios.de>

data[maxIndex] can only be accessed safely when maxBit is non zero. I missed this in r40143.
This bug only happens for bitmaps with unusual lengths (often the last blockgroup block bitmap) and which happen to be full.
Should fix #7074.


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


# 79de91c1 07-Jan-2011 Jérôme Duval <korli@users.berlios.de>

* manages blockgroups unused_inodes when the feature is available.
* BitmapBlock::FindMarked/FindUnmarked() tried to find a free bit
at the end of a full bitmap. This fixes #7069.


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


# eb7aa0da 04-Nov-2010 Jérôme Duval <korli@users.berlios.de>

Volume: don't use a block allocator when mounting readonly.
BitmapBlock: also use file system blocks, current type is off_t. Also added more trace.
BlockAllocator: added an assert and more trace


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


# 25a55b41 31-Oct-2010 Jérôme Duval <korli@users.berlios.de>

* more cleanup
* more fixes in BitmapBlock::FindNextMarked() and BitmapBlock::FindPreviousMarked()


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


# 583f39e9 31-Oct-2010 Jérôme Duval <korli@users.berlios.de>

* switched more uint32 to off_t for 64bit support
* added error messages in InodeAllocator, Inode
* if BlockAllocator can't initialize, don't fail completely but switch to readonly
* fixed a bug in FindNextMarked() for bitmaps with a length non multiple of 32
* Inode::FindBlock() now returns an optional block_run length, useful for get_file_map()
* added flag for Inode for extents


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


# d8772e0c 30-Oct-2010 Jérôme Duval <korli@users.berlios.de>

* added some support for 64bit feature: extended struct ext2_block_group, block number types changed from uint32 to off_t
* added error traces, asserts
* BitmapBlock::CheckUnmarked() and CheckMarked() computed a wrong remainingBits and mask


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


# de66992b 11-Oct-2010 Jérôme Duval <korli@users.berlios.de>

* added support for huge_file feature, untested (need a >2TB file)
* actually checks for readonly features if mounting read-write
* don't use a journal when mounting readonly
* DataStream::_BlocksNeeded(): in case of double or triple indirects,
compute the additional blocks needed using the difference between the
old and new indirects blocks. This was resulting in a bad NumBlocks on an inode
* BitmapBlock: mark methods missed an iteration when the startingBit was zero.
Some blocks were then allocated two times (at most 32 for each allocation run).


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


# a1b0ec30 07-Sep-2010 Jérôme Duval <korli@users.berlios.de>

Patch from Janito Ferreira Filho (aka jjvf): this is the result of his GSoC assignment "Implement ext2/3 Read and Write Support for Haiku".
* Tested and checked most features and fs operations, while passing successfully the Linux fsck. Though the implementation still needs more testing and is to be used with
caution, it's better in my mind to have the code committed now given the size of the patch.
* Code style isn't extensively checked but is mostly OK. Code review is welcome.
Some notes from Janito:
* Sparse files aren't supported and hard links aren't supported. Write attributes methods aren't activated nor tested.
* Journaling needs more testing to make sure it behaves in a compatible way to Ext3, and support for the different modes hasn't been implemented (due to the block
and file cache incompatibility). Correct revoke management is also lacking, as is proper management of the superblock state and copies and block group copies.
* The code is partly based and inspired by the BFS implementation. Author information might need to be fixed.

I'd like to congratulate and thank Janito for his hard work to bring the implementation to the current state. I hope he'll keep on maintaining it and become a regular
contributor/committer.



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


# a130bab351822fb76ee1750cd4af6ba11ad70bbe 08-May-2013 Jérôme Duval <jerome.duval@gmail.com>

ext2: fixes 64 bit warnings


# fd4998dce706f06fa4f62b492a7fa7ce8fac3d26 12-Jan-2011 Jérôme Duval <korli@users.berlios.de>

Factorized _Update() and _Check() out of Mark(), Unmark(), CheckMarked() and CheckUnmarked().
Inline some methods.


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


# 09af5be25d1fdc03638674e6db79803cf109a843 09-Jan-2011 Jérôme Duval <korli@users.berlios.de>

Factorized _FindNext() out of FindNextMarked() and FindNextUnmarked().


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


# 4359b745017b663fa0e1e28be2212ccbd90f2c89 09-Jan-2011 Jérôme Duval <korli@users.berlios.de>

* finding marked or unmarked bit in the last double word didn't work, we need to take start pos into account. Should fix #7079.


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


# 847a2179d07c2779c9c13ed2dad0dc490f95da88 09-Jan-2011 Jérôme Duval <korli@users.berlios.de>

data[maxIndex] can only be accessed safely when maxBit is non zero. I missed this in r40143.
This bug only happens for bitmaps with unusual lengths (often the last blockgroup block bitmap) and which happen to be full.
Should fix #7074.


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


# 79de91c19b619ef149482aee4ef30e7f301abd09 07-Jan-2011 Jérôme Duval <korli@users.berlios.de>

* manages blockgroups unused_inodes when the feature is available.
* BitmapBlock::FindMarked/FindUnmarked() tried to find a free bit
at the end of a full bitmap. This fixes #7069.


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


# eb7aa0dafb0bba235428b5360e8e83a4f1203f4b 04-Nov-2010 Jérôme Duval <korli@users.berlios.de>

Volume: don't use a block allocator when mounting readonly.
BitmapBlock: also use file system blocks, current type is off_t. Also added more trace.
BlockAllocator: added an assert and more trace


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


# 25a55b41c7945b9d6e0c6b70b051fa10ec81ec03 31-Oct-2010 Jérôme Duval <korli@users.berlios.de>

* more cleanup
* more fixes in BitmapBlock::FindNextMarked() and BitmapBlock::FindPreviousMarked()


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


# 583f39e94d4065be3e621924661b98d231f29b10 31-Oct-2010 Jérôme Duval <korli@users.berlios.de>

* switched more uint32 to off_t for 64bit support
* added error messages in InodeAllocator, Inode
* if BlockAllocator can't initialize, don't fail completely but switch to readonly
* fixed a bug in FindNextMarked() for bitmaps with a length non multiple of 32
* Inode::FindBlock() now returns an optional block_run length, useful for get_file_map()
* added flag for Inode for extents


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


# d8772e0c207a59d026580f29e2390d4030d1bec6 30-Oct-2010 Jérôme Duval <korli@users.berlios.de>

* added some support for 64bit feature: extended struct ext2_block_group, block number types changed from uint32 to off_t
* added error traces, asserts
* BitmapBlock::CheckUnmarked() and CheckMarked() computed a wrong remainingBits and mask


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


# de66992b72e683607689b6057760367bd9c78282 11-Oct-2010 Jérôme Duval <korli@users.berlios.de>

* added support for huge_file feature, untested (need a >2TB file)
* actually checks for readonly features if mounting read-write
* don't use a journal when mounting readonly
* DataStream::_BlocksNeeded(): in case of double or triple indirects,
compute the additional blocks needed using the difference between the
old and new indirects blocks. This was resulting in a bad NumBlocks on an inode
* BitmapBlock: mark methods missed an iteration when the startingBit was zero.
Some blocks were then allocated two times (at most 32 for each allocation run).


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


# a1b0ec30977df3c4f608eaac97ddc03bf9d3b255 07-Sep-2010 Jérôme Duval <korli@users.berlios.de>

Patch from Janito Ferreira Filho (aka jjvf): this is the result of his GSoC assignment "Implement ext2/3 Read and Write Support for Haiku".
* Tested and checked most features and fs operations, while passing successfully the Linux fsck. Though the implementation still needs more testing and is to be used with
caution, it's better in my mind to have the code committed now given the size of the patch.
* Code style isn't extensively checked but is mostly OK. Code review is welcome.
Some notes from Janito:
* Sparse files aren't supported and hard links aren't supported. Write attributes methods aren't activated nor tested.
* Journaling needs more testing to make sure it behaves in a compatible way to Ext3, and support for the different modes hasn't been implemented (due to the block
and file cache incompatibility). Correct revoke management is also lacking, as is proper management of the superblock state and copies and block group copies.
* The code is partly based and inspired by the BFS implementation. Author information might need to be fixed.

I'd like to congratulate and thank Janito for his hard work to bring the implementation to the current state. I hope he'll keep on maintaining it and become a regular
contributor/committer.



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