History log of /haiku/src/add-ons/kernel/file_systems/bfs/Debug.h
Revision Date Author Comments
# 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>


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

bfs: Silence errors on non-DEBUG build

Don't print to syslog on regular builds e.g.
KERN: bfs: bfs_open:1360: Read-only file system

Change-Id: Ib458cd88bf6df63f707e09dca0db6a146b7975d1
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3177
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# 1be4b7c0 04-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Build fix when built with DEBUG defined.
* Forgot to remove the "bfs_block_runs" debugger command on module unload.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26800 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


# d7477802 12-Jan-2008 Axel Dörfler <axeld@pinc-software.de>

* Made the additions of the KDL debugger commands independant from the
DEBUG macro; they are now added only if BFS_DEBUGGER_COMMANDS is
defined (which is now done by default in the Jamfile).
* Added "bfs" KDL command which dumps volume information and the super
block.
* Made use of the new tracing API to trace block and inode actions
(and the new AbstractTraceEntry class I forgot to mention in the last
commit). Is compiled in only when BFS_TRACING is enabled (defaults to
off in the standard builds).


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


# 3d268eda 10-Nov-2007 Axel Dörfler <axeld@pinc-software.de>

* Extracted file_map API out of the file cache - it's now an optional service
that can be used by file systems.
* Changed the way the file cache works: instead of reading/writing to the
underlying device directly, it can now be used for any data source, ie.
also network file systems.
* As a result, the former pages_io() moved to the VFS layer, and can now be
called by a file system via {read|write}_file_io_vec_pages() (naming
suggestions are always welcomed :-)). It now gets an FD, and uses that to
communicate with the device (via its fs_{read|write}_pages() hooks).
* The file_cache_{read|write}() functions must now be called without holding
an I/O relevant file system lock. That allows the file cache to prepare the
pages without colliding with the page writer, IOW the "mayBlock" flag can
go into the attic again (yay!).
* This also results in a much better performance when the system does I/O and
is low on memory, as the page writer can now finally write back some pages,
and that even without maxing out the CPU :)
* The API changes put slightly more burden on the fs_{read|write}_pages()
hooks, but in combination with the file_map it's still pretty straight
forward. It just will have to dispatch the call to the underlying device
directly, usually it will just call its fs_{read|write}_pages() hooks
via the above mentioned calls.
* Ported BFS and FAT to the new API, the latter has not been tested, though.
* Also ported the API changes to the fs_shell. I also completely removed its
file cache level page handling - the downside is that device access is no
longer cached (ie. depends on the host OS now), the upside is that the code
is greatly simplified.


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


# 3e9513aa 03-Oct-2007 Axel Dörfler <axeld@pinc-software.de>

* fs_{write|read}_pages() now has an additional argument "mayBlock".
* the page writer don't allow to block, while all other writers do. This fixes
bug #1509. The reason the page writer needs this is because it marks several
pages from different caches as busy.
* Fixed a warning about ASSERT being defined already in BFS, since
util/DoublyLinkedList.h now includes debug.h.


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


# c391f84b 26-Apr-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

* Prepared the BFS sources to be used with the new FS shell:
- Moved all inclusions of system headers into a new
system_dependencies.h header, which conditionally either includes
these or the FS shell headers.
- Fixed compiler warnings related to printf-like functions (int32 is
int, not long on non-BeOS platforms).
* Build a new bfs_shell. Compiles and links, but does nothing ATM.


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


# 074ebdda 05-May-2006 Axel Dörfler <axeld@pinc-software.de>

* When mounting an image, BFS no longer tries to set the file into uncached mode - this
will waste some memory (as the data will be cached twice), but unlike BeOS, it cannot
deadlock the cache, so it's safe to be used. In other words, mounting images is now
working as expected.
* a BFS FATAL() condition no longer results in a KDL; this seemed to confuse anybody :)


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


# 6106f57e 26-Feb-2006 Stephan Aßmus <superstippi@gmx.de>

* Didn't allow to write back attributes outside the inode block (they don't
have a user accessable stream, but they do have a file cache).
* removed superfluous dump_inode() version; the "bfsinfo" debugger
command is now a bit more useful as well.
* Inode::fAttributes was not initialized when it wasn't used.

(coded by axeld)



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


# 1509c796 29-Aug-2005 Axel Dörfler <axeld@pinc-software.de>

The dump_*() functions now expect const parameters, dunno why that was different at all before.


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


# b41629dc 01-Aug-2005 Axel Dörfler <axeld@pinc-software.de>

Enabled the REPORT_ERROR() and RETURN_ERROR() macros also in non-debug mode (for now).


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


# fa7ec9d4 26-May-2005 Axel Dörfler <axeld@pinc-software.de>

FATAL() now does a sync() before it panics, so that the on disk data
is up to date for later inspection.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12824 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


# 01338285 29-Jan-2004 Axel Dörfler <axeld@pinc-software.de>

Some minor style changes.


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


# 4d8c3e52 25-Jan-2004 François Revol <revol@free.fr>

Fixed prototype names


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


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

Cleaned up the debug mess mmu_man has created (thanks anyway!).
Switched to kernel_cpp.h/cpp.


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


# 98b972c9 25-Feb-2003 Axel Dörfler <axeld@pinc-software.de>

Fixed all warnings that appeared with DEBUG=1 set.
Also fixed missing return codes in BufferPool::ReleaseBuffer() and Journal::WriteLogEntry().


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


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

Added two new macros, ASSERT(), and DIE().


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


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

Now includes <string.h> which is needed for the strerror() function used
in the macros.


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


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

Add a new DEBUGGER() macro (doesn't do anything for the release build).
Some style changes.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1601 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


# 1be4b7c0c5aee2c80d83ba5a36eb8945e7de2015 04-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Build fix when built with DEBUG defined.
* Forgot to remove the "bfs_block_runs" debugger command on module unload.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26800 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


# d7477802b8a5451ce525646fd2d4b13ef449c455 12-Jan-2008 Axel Dörfler <axeld@pinc-software.de>

* Made the additions of the KDL debugger commands independant from the
DEBUG macro; they are now added only if BFS_DEBUGGER_COMMANDS is
defined (which is now done by default in the Jamfile).
* Added "bfs" KDL command which dumps volume information and the super
block.
* Made use of the new tracing API to trace block and inode actions
(and the new AbstractTraceEntry class I forgot to mention in the last
commit). Is compiled in only when BFS_TRACING is enabled (defaults to
off in the standard builds).


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


# 3d268eda3d0ca504c865533347decf27b54025b6 10-Nov-2007 Axel Dörfler <axeld@pinc-software.de>

* Extracted file_map API out of the file cache - it's now an optional service
that can be used by file systems.
* Changed the way the file cache works: instead of reading/writing to the
underlying device directly, it can now be used for any data source, ie.
also network file systems.
* As a result, the former pages_io() moved to the VFS layer, and can now be
called by a file system via {read|write}_file_io_vec_pages() (naming
suggestions are always welcomed :-)). It now gets an FD, and uses that to
communicate with the device (via its fs_{read|write}_pages() hooks).
* The file_cache_{read|write}() functions must now be called without holding
an I/O relevant file system lock. That allows the file cache to prepare the
pages without colliding with the page writer, IOW the "mayBlock" flag can
go into the attic again (yay!).
* This also results in a much better performance when the system does I/O and
is low on memory, as the page writer can now finally write back some pages,
and that even without maxing out the CPU :)
* The API changes put slightly more burden on the fs_{read|write}_pages()
hooks, but in combination with the file_map it's still pretty straight
forward. It just will have to dispatch the call to the underlying device
directly, usually it will just call its fs_{read|write}_pages() hooks
via the above mentioned calls.
* Ported BFS and FAT to the new API, the latter has not been tested, though.
* Also ported the API changes to the fs_shell. I also completely removed its
file cache level page handling - the downside is that device access is no
longer cached (ie. depends on the host OS now), the upside is that the code
is greatly simplified.


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


# 3e9513aa4a8bf5f2fb2b86a767ffe46f6e626acc 03-Oct-2007 Axel Dörfler <axeld@pinc-software.de>

* fs_{write|read}_pages() now has an additional argument "mayBlock".
* the page writer don't allow to block, while all other writers do. This fixes
bug #1509. The reason the page writer needs this is because it marks several
pages from different caches as busy.
* Fixed a warning about ASSERT being defined already in BFS, since
util/DoublyLinkedList.h now includes debug.h.


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


# c391f84b2c732398288276bc8354ac4060dc5a4d 26-Apr-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

* Prepared the BFS sources to be used with the new FS shell:
- Moved all inclusions of system headers into a new
system_dependencies.h header, which conditionally either includes
these or the FS shell headers.
- Fixed compiler warnings related to printf-like functions (int32 is
int, not long on non-BeOS platforms).
* Build a new bfs_shell. Compiles and links, but does nothing ATM.


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


# 074ebdda4ae9932b3bd3af85261a63e4db689bb3 05-May-2006 Axel Dörfler <axeld@pinc-software.de>

* When mounting an image, BFS no longer tries to set the file into uncached mode - this
will waste some memory (as the data will be cached twice), but unlike BeOS, it cannot
deadlock the cache, so it's safe to be used. In other words, mounting images is now
working as expected.
* a BFS FATAL() condition no longer results in a KDL; this seemed to confuse anybody :)


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


# 6106f57e218cbdc72d0de30b71ddd9973bbbc9d6 26-Feb-2006 Stephan Aßmus <superstippi@gmx.de>

* Didn't allow to write back attributes outside the inode block (they don't
have a user accessable stream, but they do have a file cache).
* removed superfluous dump_inode() version; the "bfsinfo" debugger
command is now a bit more useful as well.
* Inode::fAttributes was not initialized when it wasn't used.

(coded by axeld)



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


# 1509c79696c629f7a3e2573ce6fcdc8b2573cfb2 29-Aug-2005 Axel Dörfler <axeld@pinc-software.de>

The dump_*() functions now expect const parameters, dunno why that was different at all before.


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


# b41629dc088423eee590533e4cc94b7e6928dfc6 01-Aug-2005 Axel Dörfler <axeld@pinc-software.de>

Enabled the REPORT_ERROR() and RETURN_ERROR() macros also in non-debug mode (for now).


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


# fa7ec9d4e9465e03ecc30466fd7b39675759041c 26-May-2005 Axel Dörfler <axeld@pinc-software.de>

FATAL() now does a sync() before it panics, so that the on disk data
is up to date for later inspection.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12824 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


# 01338285a9dd86dc5d0353598d6615016890cd0d 29-Jan-2004 Axel Dörfler <axeld@pinc-software.de>

Some minor style changes.


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


# 4d8c3e52a90c43c6f335b1b57c81e4e2057ba1a6 25-Jan-2004 François Revol <revol@free.fr>

Fixed prototype names


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


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

Cleaned up the debug mess mmu_man has created (thanks anyway!).
Switched to kernel_cpp.h/cpp.


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


# 98b972c906051113e46d46cfe8c02f5adebdd599 25-Feb-2003 Axel Dörfler <axeld@pinc-software.de>

Fixed all warnings that appeared with DEBUG=1 set.
Also fixed missing return codes in BufferPool::ReleaseBuffer() and Journal::WriteLogEntry().


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


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

Added two new macros, ASSERT(), and DIE().


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


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

Now includes <string.h> which is needed for the strerror() function used
in the macros.


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


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

Add a new DEBUGGER() macro (doesn't do anything for the release build).
Some style changes.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1601 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