History log of /haiku/src/add-ons/kernel/file_systems/bfs/BlockAllocator.h
Revision Date Author Comments
# bd02d81c 30-Jun-2021 David Sebek <dasebek@gmail.com>

Fix trim-related issues

Fixes:
* Use uint64 instead of off_t when handling offset and size
of the trimmed range in the fs_trim_data structure
* BlockAllocator::Trim: Correct the size of a buffer
* ram_disk, mmc: Do not trim past device capacity

Improvements:
* BlockAllocator::Trim: Because the received offset and size
are ignored by BFS (the functionality is not implemented yet),
return B_UNSUPPORTED if the range does not cover the whole
partition
* ram_disk, mmc: More accurate calculation of the number
of trimmed bytes
* devfs: Add a uint64 version of translate_partition_access()

Change-Id: I24f4c08674f123ad33a5fef6e28996a4ada6ff0d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4155
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# 3d43a905 30-Aug-2020 John Scipione <jscipione@gmail.com>

bfs: Enable logging on DEBUG build

Fix DEBUG build errors by using B_PRI macros in BlockAllocator.cpp,
CheckVisitor.cpp, Inode.cpp, Journal.cpp, and kernel_interface.cpp

Add optional type parameter from BlockAllocator::IsValidBlockRun()
and actually PRINT it, type parameter is already optional on
BlockAllocator::CheckBlockRun().

Remove a couple of casts as we are printing the expected type, int32.

Cast mode_t to (unsigned int) and use %u because 32-bit Haiku didn't
like B_PRIu32.

Verified to compile on both regular and DEBUG builds on both 32-bit
and 64-bit.

Change-Id: I8bb39afd400768b7f69d36384974f0b91b3ef48c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3184
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: John Scipione <jscipione@gmail.com>


# aa775038 05-Jul-2012 ahenriksson <sausageboy@gmail.com>

bfs: split checkfs code into FileSystemVisitor and CheckVisitor

Another FileSystemVisitor implementation will be used for resizing

Change-Id: I2d5f47dcbefb4c76834487b194a99c6f5ae7de50
Reviewed-on: https://review.haiku-os.org/c/923
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>


# 99086aa3 14-Aug-2013 Axel Dörfler <axeld@pinc-software.de>

trim: Target SCSI UNMAP command instead of WRITE SAME.

* The UNMAP command is theoretically much faster, as it can get many block
ranges instead of just a single range.
* Furthermore, the ATA TRIM command resembles it much better.
* Therefore, fs_trim_data now gets an array of ranges, and we use SCSI UNMAP
to trim.
* Updated BFS code to collect array ranges to fully support the new
fs_trim_data possibilities.


# 0a0ba4b5 04-Aug-2013 Axel Dörfler <axeld@pinc-software.de>

Added B_TRIM_DEVICE support to BFS.

* It currently ignores the offset/size, though, and always trims everything.
* Now only SCSI support is missing.


# ce17af69 31-Mar-2012 Axel Dörfler <axeld@pinc-software.de>

Implemented repairing index b+trees.

* There are now two passes in case a corrupted index tree has been found.
* The second pass will clear the affected indices at first, and will then walk
over all inodes again to fill them.
* As a side effect, this will also defragment the indices; ie. the same
mechanism could be used for this some day.


# b81ce430 30-Mar-2012 Axel Dörfler <axeld@pinc-software.de>

Made fLock a recursive lock instead of a mutex.

* This should fix bug #8069.


# 5edde94c 06-Mar-2010 Axel Dörfler <axeld@pinc-software.de>

* checkfs is now working again; I couldn't test my earlier changes because I had
no time left, but I didn't want to lose them either.
* This fixes bug #5536, sorry for the inconvenience.


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


# d501707d 03-Mar-2010 Axel Dörfler <axeld@pinc-software.de>

* Removed the cookie field of the check_control structure; that really was
a stupid idea. Instead, the already existing fCheckCookie member is used.
* bfs_ioctl() now accesses all userland buffers safely, this should help with
#3264, and move the crash where it belongs.
* Changes not yet tested; they only affect checkfs.


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


# aeb099b3 19-Oct-2009 Axel Dörfler <axeld@pinc-software.de>

* Added a very simple way to fragment your disk.


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


# b5a51254 26-Jul-2009 Axel Dörfler <axeld@pinc-software.de>

* Don't use Inode::Remove() when the inode could not be opened, because it
actually relies on that.
* Instead, _RemoveInvalidNode() now manipulates the parent tree manually.


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


# 84ce48c2 26-Jul-2009 Axel Dörfler <axeld@pinc-software.de>

* checkfs should now also remove unaccessible files. Not yet tested.


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


# 3e69a3c2 26-Jun-2009 Axel Dörfler <axeld@pinc-software.de>

* BFS allocated always full allocation groups in the bitmap, even if the last
group was a partial one. This caused bug #3963 (Be's BFS didn't do that).
* Added new BlockAllocator::CheckBlocks() that does not depend on allocation
group limits - this fixes the problematic check in
BlockAllocator::_Initialize() to see if the super block, the block bitmap,
and the log area are all allocated - this only worked if they all fit into
the first allocation group (which happens only with partitions with more
than 1 billion blocks, ie. 2 TB would already be problematic with a 2K block
size).


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


# a0a1bf7f 16-Oct-2008 Axel Dörfler <axeld@pinc-software.de>

* Disabled the allocation group check again.
* Fixed warnings.


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


# a8744b0e 14-Oct-2008 Axel Dörfler <axeld@pinc-software.de>

* Each allocation group now lazily maintains the largest free block separately,
so that allocations can be directly fulfilled from that block without having
to search for it.
* This should further improve the allocator's performance, but it could need
more tuning (ie. when to rebuild the free block).
* Added debugging code to check if the largest block is maintained correctly;
it's currently turned on (DEBUG_ALLOCATION_GROUPS) which makes allocations
actually pretty slow - I'll disable it again after it has been tested a bit
more.
* Added a "bfs_allocator_blocks" KDL command that allows you to show all
tracing entries that affect a specific block (only available if BFS has
been compiled with tracing support).


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


# 02c8f6c8 02-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Coding style cleanups, no functional changes.


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


# d06cc6e3 29-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

* Unmounting a volume didn't wait for the block allocator's initializer thread.
* This fixed bug #2541.


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


# 03fa417b 07-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

* Removed the home-brewn locking classes in BFS besides the read/write lock
(for now).
* Inode::fSmallDataLock is now a recursive_lock, Journal::fLock is now
a recursive_lock, too, Journal::fEntriesLock is now a mutex, as is
BPlusTree::fIteratorLock.


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


# 797a92d8 07-Apr-2008 Axel Dörfler <axeld@pinc-software.de>

* Made super block log handling endian-safe.
* Made all debugging functions endian-safe.
* Added tracing for log entries.
* Added new KDL command "bfs_journal" to dump all pending log entries.
* When BFS_DEBUGGER_COMMANDS is defined, the LogEntry class will also track
the transaction ID it belonged to.
* The "bfs" KDL command now sets some useful debugger variables.
* The "bfs_allocator" KDL command now accepts the group index as 3rd argument.
* Renamed Journal::_TransactionListener() to _TransactionIdle(), as that's
all it is for.
* Removed TODO comment in Volume::WriteSuperBlock(), as it's actually not true.


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


# 09c46ea8 15-Jan-2008 Axel Dörfler <axeld@pinc-software.de>

* Fixed bug in the BlockAllocator::Allocate() function which did not
compute the bit offsets correctly if the last block of the whole
bitmap was only a partial block.
* Added new bfs_allocator KDL command.
* Renamed the KDL command bfsinode to bfs_inode.
* Added "--help" argument to bfs_inode and bfs KDL commands.
* Added more tracing in the block allocator.
* Turned on the ASSERT() macro in non-debug builds.
* Minor cleanup.


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


# f41837b4 26-Feb-2006 Axel Dörfler <axeld@pinc-software.de>

* The AllocationGroup now has a field for its number of blocks, as well as public
getter methods.
* Fixed allocation problem of an incomplete last allocation group, as reported by
Robert Szeleney.
* Minor cleanup, slightly improved comments, renamed private methods to have a
leading '_'.


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


# fb02804a 19-Nov-2004 Axel Dörfler <axeld@pinc-software.de>

Big update while moving over completely to the Haiku kernel:
- Ported over BFS to the new cache API
- Inode no longer inherits from CachedBlock, and therefore, no longer
keeps the whole inode block in memory. It now has a copy of the bfs_inode
structure in memory instead. This has a number of advantages but also some
disadvantages, so it might be reverted later, even if it's unlikely.
- Added a NodeGetter class that can be used whenever the real block needs
to be accessed (ie. for attributes)
- Changed *transaction to &transaction where possible
- Removed support for KEEP_WRONG_DIRENT_RECLEN
- Removed support for uncached file access since that's no longer needed
- Fixed some endian issues in bfs_write_stat()
- Removed the install BFS rules, since they don't make any sense anymore
(unless you are running Haiku ;-))

Note, logged streams are not supported anymore right now. Also, the
transaction code is pretty simple and slow - it will be improved later
on. Attribute code is pretty much untested in the new environment.


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


# 34cf473d 03-May-2004 Axel Dörfler <axeld@pinc-software.de>

BlockAllocator::CheckBlockRun() can now also check for non-allocated ranges.
Fixed a possible endian problem in CheckBlockRun(), too.


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


# 81566b93 25-Jan-2004 Axel Dörfler <axeld@pinc-software.de>

Implemented initalizing the bitmap of a fresh volume in the new call
BlockAllocator::InitializeAndClearBitmap().
Added BlockAllocator::BitmapSize() which returns the size of the block
bitmap in bytes - used it where appropriate.


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


# c3f10b46 28-May-2003 Axel Dörfler <axeld@pinc-software.de>

Added a simple magic field mechanism to make chkbfs calls a little more safe.


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


# bc8d3bda 24-Feb-2003 Axel Dörfler <axeld@pinc-software.de>

Fixed many warnings.


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


# b5a0c65c 21-Nov-2002 Axel Dörfler <axeld@pinc-software.de>

Added support for aborted "chkbfs" runs (so that they won't do any harm).


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


# 3f870da9 17-Nov-2002 Axel Dörfler <axeld@pinc-software.de>

Almost complete and working "chkbfs" functionality for BFS. It can be used
via the private ioctls defined in bfs_control.h.
Detects all kinds of errors, and can correct most of them. It doesn't fix
any errors in the b+trees (like the ones created by an earlier version
of the BPlusTree class ;-), and it also can't fix the "blocks are already set"
error, which occurs if more than one file claims a particular block (or
range of blocks) for itself.
The double indirect data range is not yet supported, so use with care, or
run the original chkbfs afterwards to fix any errors because of that.
Might not yet analyze 100% correct (shows way to many errors for my tastes...).
A "chkbfs" command will be made available shortly.


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


# dab62fa3 08-Nov-2002 Axel Dörfler <axeld@pinc-software.de>

Fixed a big stupid bug that can cause lots of trouble: all locks created
weren't moved to the kernel (as owner), so they would be deleted after
the team which almost randomly created them died.
Benaphores are now only used if USE_BENAPHORES is defined - I have renamed
the Benaphore class to Semaphore to take the changed behaviour into account.
Added a Status() method to the Locker class.


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


# 820dca19 22-Oct-2002 Axel Dörfler <axeld@pinc-software.de>

Rearranged some code in the BlockAllocator; AllocationGroup now has Allocate()
and Free() methods which operate on the AllocationBlocks.
BlockAllocator::AllocateBlocks() couldn't correctly reserve space for allocation
groups with more than 2 blocks - AllocationGroup::Allocate() now can, which
is now used by AllocateBlocks() (but it's slightly less fast).
Began implementing functionality for a chkbfs-like command.
Some style changes.


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


# bc62229f 21-Aug-2002 Axel Dörfler <axeld@pinc-software.de>

Volume::Free(), and BlockAllocator::Free() now pass the block_run by value
rather than by reference.


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


# c42ee134 07-Aug-2002 Axel Dörfler <axeld@pinc-software.de>

Initial revision


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


# 99086aa32333be5792b0f059ccbbe3c90be05ea6 14-Aug-2013 Axel Dörfler <axeld@pinc-software.de>

trim: Target SCSI UNMAP command instead of WRITE SAME.

* The UNMAP command is theoretically much faster, as it can get many block
ranges instead of just a single range.
* Furthermore, the ATA TRIM command resembles it much better.
* Therefore, fs_trim_data now gets an array of ranges, and we use SCSI UNMAP
to trim.
* Updated BFS code to collect array ranges to fully support the new
fs_trim_data possibilities.


# 0a0ba4b5f09da93410943578b6c5aa1f3aa60cb0 04-Aug-2013 Axel Dörfler <axeld@pinc-software.de>

Added B_TRIM_DEVICE support to BFS.

* It currently ignores the offset/size, though, and always trims everything.
* Now only SCSI support is missing.


# ce17af69dc33c82dfec3a956c384725ef0b2a656 31-Mar-2012 Axel Dörfler <axeld@pinc-software.de>

Implemented repairing index b+trees.

* There are now two passes in case a corrupted index tree has been found.
* The second pass will clear the affected indices at first, and will then walk
over all inodes again to fill them.
* As a side effect, this will also defragment the indices; ie. the same
mechanism could be used for this some day.


# b81ce43017cf63b0de3ff056200a323c56ebdf86 30-Mar-2012 Axel Dörfler <axeld@pinc-software.de>

Made fLock a recursive lock instead of a mutex.

* This should fix bug #8069.


# 5edde94cab42af0a1194c04466bc6731ff0b708b 06-Mar-2010 Axel Dörfler <axeld@pinc-software.de>

* checkfs is now working again; I couldn't test my earlier changes because I had
no time left, but I didn't want to lose them either.
* This fixes bug #5536, sorry for the inconvenience.


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


# d501707d8abd1f3648bed3a4f975e3a984a5e6f1 03-Mar-2010 Axel Dörfler <axeld@pinc-software.de>

* Removed the cookie field of the check_control structure; that really was
a stupid idea. Instead, the already existing fCheckCookie member is used.
* bfs_ioctl() now accesses all userland buffers safely, this should help with
#3264, and move the crash where it belongs.
* Changes not yet tested; they only affect checkfs.


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


# aeb099b317eda4eb3c4b3318222e0a7d3ed2867f 19-Oct-2009 Axel Dörfler <axeld@pinc-software.de>

* Added a very simple way to fragment your disk.


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


# b5a51254dc88420043623914ada12e2ab778611b 26-Jul-2009 Axel Dörfler <axeld@pinc-software.de>

* Don't use Inode::Remove() when the inode could not be opened, because it
actually relies on that.
* Instead, _RemoveInvalidNode() now manipulates the parent tree manually.


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


# 84ce48c248d78df09ca356e082b14980b31a2cd6 26-Jul-2009 Axel Dörfler <axeld@pinc-software.de>

* checkfs should now also remove unaccessible files. Not yet tested.


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


# 3e69a3c24a9ed31bf574a834cd720fca67846f60 26-Jun-2009 Axel Dörfler <axeld@pinc-software.de>

* BFS allocated always full allocation groups in the bitmap, even if the last
group was a partial one. This caused bug #3963 (Be's BFS didn't do that).
* Added new BlockAllocator::CheckBlocks() that does not depend on allocation
group limits - this fixes the problematic check in
BlockAllocator::_Initialize() to see if the super block, the block bitmap,
and the log area are all allocated - this only worked if they all fit into
the first allocation group (which happens only with partitions with more
than 1 billion blocks, ie. 2 TB would already be problematic with a 2K block
size).


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


# a0a1bf7fb0617843d4ef133b2a80bb07ea9276c7 16-Oct-2008 Axel Dörfler <axeld@pinc-software.de>

* Disabled the allocation group check again.
* Fixed warnings.


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


# a8744b0ee99cd1972d6dd72ca705c24c326869bf 14-Oct-2008 Axel Dörfler <axeld@pinc-software.de>

* Each allocation group now lazily maintains the largest free block separately,
so that allocations can be directly fulfilled from that block without having
to search for it.
* This should further improve the allocator's performance, but it could need
more tuning (ie. when to rebuild the free block).
* Added debugging code to check if the largest block is maintained correctly;
it's currently turned on (DEBUG_ALLOCATION_GROUPS) which makes allocations
actually pretty slow - I'll disable it again after it has been tested a bit
more.
* Added a "bfs_allocator_blocks" KDL command that allows you to show all
tracing entries that affect a specific block (only available if BFS has
been compiled with tracing support).


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


# 02c8f6c89d13b94c5507012eaadddc79982c976f 02-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Coding style cleanups, no functional changes.


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


# d06cc6e3861157b83893010b42d7c47a65197dec 29-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

* Unmounting a volume didn't wait for the block allocator's initializer thread.
* This fixed bug #2541.


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


# 03fa417b706f63305263982a61eb1002e6ff9d96 07-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

* Removed the home-brewn locking classes in BFS besides the read/write lock
(for now).
* Inode::fSmallDataLock is now a recursive_lock, Journal::fLock is now
a recursive_lock, too, Journal::fEntriesLock is now a mutex, as is
BPlusTree::fIteratorLock.


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


# 797a92d84d79bf10ac426c11fcee064b5bcc4609 07-Apr-2008 Axel Dörfler <axeld@pinc-software.de>

* Made super block log handling endian-safe.
* Made all debugging functions endian-safe.
* Added tracing for log entries.
* Added new KDL command "bfs_journal" to dump all pending log entries.
* When BFS_DEBUGGER_COMMANDS is defined, the LogEntry class will also track
the transaction ID it belonged to.
* The "bfs" KDL command now sets some useful debugger variables.
* The "bfs_allocator" KDL command now accepts the group index as 3rd argument.
* Renamed Journal::_TransactionListener() to _TransactionIdle(), as that's
all it is for.
* Removed TODO comment in Volume::WriteSuperBlock(), as it's actually not true.


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


# 09c46ea8bd43d9b8ccb6eeaf24f9fd5be4e8291b 15-Jan-2008 Axel Dörfler <axeld@pinc-software.de>

* Fixed bug in the BlockAllocator::Allocate() function which did not
compute the bit offsets correctly if the last block of the whole
bitmap was only a partial block.
* Added new bfs_allocator KDL command.
* Renamed the KDL command bfsinode to bfs_inode.
* Added "--help" argument to bfs_inode and bfs KDL commands.
* Added more tracing in the block allocator.
* Turned on the ASSERT() macro in non-debug builds.
* Minor cleanup.


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


# f41837b49fbc9210e6f43bdbd473a63c51f297d3 26-Feb-2006 Axel Dörfler <axeld@pinc-software.de>

* The AllocationGroup now has a field for its number of blocks, as well as public
getter methods.
* Fixed allocation problem of an incomplete last allocation group, as reported by
Robert Szeleney.
* Minor cleanup, slightly improved comments, renamed private methods to have a
leading '_'.


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


# fb02804a89b1100c0f20c3e3c28be28215103c44 19-Nov-2004 Axel Dörfler <axeld@pinc-software.de>

Big update while moving over completely to the Haiku kernel:
- Ported over BFS to the new cache API
- Inode no longer inherits from CachedBlock, and therefore, no longer
keeps the whole inode block in memory. It now has a copy of the bfs_inode
structure in memory instead. This has a number of advantages but also some
disadvantages, so it might be reverted later, even if it's unlikely.
- Added a NodeGetter class that can be used whenever the real block needs
to be accessed (ie. for attributes)
- Changed *transaction to &transaction where possible
- Removed support for KEEP_WRONG_DIRENT_RECLEN
- Removed support for uncached file access since that's no longer needed
- Fixed some endian issues in bfs_write_stat()
- Removed the install BFS rules, since they don't make any sense anymore
(unless you are running Haiku ;-))

Note, logged streams are not supported anymore right now. Also, the
transaction code is pretty simple and slow - it will be improved later
on. Attribute code is pretty much untested in the new environment.


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


# 34cf473d12a62ca20b0c62cd7c4dc35ca148d075 03-May-2004 Axel Dörfler <axeld@pinc-software.de>

BlockAllocator::CheckBlockRun() can now also check for non-allocated ranges.
Fixed a possible endian problem in CheckBlockRun(), too.


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


# 81566b9389cbd2fcbfbf69201d528b7a0a3421e9 25-Jan-2004 Axel Dörfler <axeld@pinc-software.de>

Implemented initalizing the bitmap of a fresh volume in the new call
BlockAllocator::InitializeAndClearBitmap().
Added BlockAllocator::BitmapSize() which returns the size of the block
bitmap in bytes - used it where appropriate.


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


# c3f10b4674ea41e67f9f97190c36265af6879f7c 28-May-2003 Axel Dörfler <axeld@pinc-software.de>

Added a simple magic field mechanism to make chkbfs calls a little more safe.


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


# bc8d3bda190ac93f1fca0e0be6e0eb13e37804d6 24-Feb-2003 Axel Dörfler <axeld@pinc-software.de>

Fixed many warnings.


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


# b5a0c65c197f9e94d7a7ce94889ac096525f4468 21-Nov-2002 Axel Dörfler <axeld@pinc-software.de>

Added support for aborted "chkbfs" runs (so that they won't do any harm).


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


# 3f870da9c385281c6c4ec2b7e8af5e1510687153 17-Nov-2002 Axel Dörfler <axeld@pinc-software.de>

Almost complete and working "chkbfs" functionality for BFS. It can be used
via the private ioctls defined in bfs_control.h.
Detects all kinds of errors, and can correct most of them. It doesn't fix
any errors in the b+trees (like the ones created by an earlier version
of the BPlusTree class ;-), and it also can't fix the "blocks are already set"
error, which occurs if more than one file claims a particular block (or
range of blocks) for itself.
The double indirect data range is not yet supported, so use with care, or
run the original chkbfs afterwards to fix any errors because of that.
Might not yet analyze 100% correct (shows way to many errors for my tastes...).
A "chkbfs" command will be made available shortly.


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


# dab62fa391ea4aca5e0aded1f390a8e7553e1c34 08-Nov-2002 Axel Dörfler <axeld@pinc-software.de>

Fixed a big stupid bug that can cause lots of trouble: all locks created
weren't moved to the kernel (as owner), so they would be deleted after
the team which almost randomly created them died.
Benaphores are now only used if USE_BENAPHORES is defined - I have renamed
the Benaphore class to Semaphore to take the changed behaviour into account.
Added a Status() method to the Locker class.


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


# 820dca1912dd3100233342d916c2136334a20180 22-Oct-2002 Axel Dörfler <axeld@pinc-software.de>

Rearranged some code in the BlockAllocator; AllocationGroup now has Allocate()
and Free() methods which operate on the AllocationBlocks.
BlockAllocator::AllocateBlocks() couldn't correctly reserve space for allocation
groups with more than 2 blocks - AllocationGroup::Allocate() now can, which
is now used by AllocateBlocks() (but it's slightly less fast).
Began implementing functionality for a chkbfs-like command.
Some style changes.


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


# bc62229fcefaadafad1820c6409c24668e620f4f 21-Aug-2002 Axel Dörfler <axeld@pinc-software.de>

Volume::Free(), and BlockAllocator::Free() now pass the block_run by value
rather than by reference.


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


# c42ee13401be80c431846910959d587949a1ad10 07-Aug-2002 Axel Dörfler <axeld@pinc-software.de>

Initial revision


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