History log of /haiku/src/add-ons/kernel/file_systems/bfs/Journal.h
Revision Date Author Comments
# 14b62ae4 27-Jul-2019 Augustin Cavalier <waddlesplash@gmail.com>

BFS: Make the log-flusher thread persistent.

Previously, a new log-flush thread was created every time there was
an idle transaction. Now we just release a semaphore for an
already-existing thread.

Change-Id: If788dbe17ef8e069ce12aa7b778626d051cce2d0


# 267b6463 12-Sep-2012 Axel Dörfler <axeld@pinc-software.de>

Run the transaction flusher in another thread.

* This fixes bug #8977.


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

Fixed misuse of Transaction::Split().

* This would cause "transaction too large" messages, and repairing the index
would actually be thrown away.
* We now properly finish/restart transactions instead which is actually
working.
* Removed the misleading Split() method altogether, as it's not even used
anywhere (not very surprising given that it doesn't do what its name
suggests).


# fd91cf4d 16-Feb-2010 Axel Dörfler <axeld@pinc-software.de>

* Replaced the specialized inode in transaction mechanism with a generic one.
That costs 12 more bytes per inode on 32 bit platforms, though.


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


# 73a19dfe 04-Nov-2009 Axel Dörfler <axeld@pinc-software.de>

* Nested transactions didn't really work in combination with the separate
transaction mechanism. Now we keep track of the parent transactions, and
restore fOwner on Journal::Unlock().
* This closes bug #4155 again.


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


# 65e04b05 29-Jul-2009 Axel Dörfler <axeld@pinc-software.de>

* When a reentered fs function reuses a transaction of its caller, the
Transaction::UnlockInodes() method was never called, leading to bug #4155.
* In order to make sure that inodes are still going to be reverted, we actually
need to move them into the parent transaction which we now do. This should
fix #4155.


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


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

* The inode list link was supposed to be secured by the journal log - so it was
definitely not a good idea to move _UnlockInodes() after the Journal::Unlock()
call (which was done to achieve a revertable inode).
* Instead, Journal::Unlock() is now responsible for calling the now public
Transaction::UnlockInodes(), and always does this at the right time while
holding the journal log.
* While I don't understand how #4155 can happen, this bug should be the one that
caused it.


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


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

* Don't unlock the inodes before knowing that writing back the transaction
succeeded.


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


# 4e643107 28-Jul-2009 Axel Dörfler <axeld@pinc-software.de>

* Some preparations to be able to split transactions if they become too large
for the log.


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


# 0bad8397 28-Jul-2009 Axel Dörfler <axeld@pinc-software.de>

* When aborting a transaction, we also need to revert any changes made to the
cached bfs_inode of all changes inodes.


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


# 2a3a8bfa 28-Jul-2009 Axel Dörfler <axeld@pinc-software.de>

* Journal::_WriteTransactionToLog()'s return value was ignored previously,
leading BFS to report success on actually failed transactions. Those
transactions were even kept open, leading to a panic when starting the next
transaction.
* Transaction::Done() now returns a status - currently, this is only handled
correctly where this is likely to happen without a disk fault, ie. if the
transaction was too large to be written back safely.
* Improved "bfs_journal" command output.


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


# 992fba36 16-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* There is now a list of removed vnodes in Volume - while asking the VFS for
this seemed to be a good idea, there is one race condition that cannot be
solved otherwise (the vnode must be added/removed to that list while holding
the transaction lock, and we cannot guarantee that in the VFS).
* We are using an unused area of the in-memory bfs_inode to store the list
links (bfs_inode::pad - this will also work on 64 bit platforms).
* Inode no longer adds a singly linked list link - the transaction list now
shares the doubly linked list with the removed vnodes list.
* Added an in-memory flag INODE_IN_TRANSACTION to avoid searching an inode
to be added in the list.
* Removing an attribute directory did not hold its write lock.
* If removing an attribute failed for some reason, the INODE_DELETED flag
was not removed (the transaction would not have failed because of that).


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


# 41a6cf82 12-Mar-2009 Axel Dörfler <axeld@pinc-software.de>

* The InodeAllocator must remove the inode from the transaction before deleting
it, otherwise the transaction would access already freed memory when trying
to release its write lock of the inode.


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


# 31cb93ad 12-Mar-2009 Axel Dörfler <axeld@pinc-software.de>

* Minor cleanup.


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


# 6c3348f1 01-Nov-2008 Axel Dörfler <axeld@pinc-software.de>

* The check mechanism in the block allocator now locks the journal as well to
fix a potential deadlock.
* Journal::Lock() now accepts another parameter that specified whether child
transactions should be split - this is nothing you would want in normal
operation unless the parent transaction is only there to prevent others from
writing (such as with the block allocator check stuff).


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


# d6b39cd1 18-Aug-2008 Salvatore Benedetto <salvatore.benedetto@gmail.com>

* Fix potential deadlock in file system

see http://www.freelists.org/archives/haiku-gsoc/08-2008/msg00024.html
for more details.



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


# 2accd07b 01-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Replaced Chain with the new SinglyLinkedList.
* Renamed openModeToAccess() to open_mode_to_access().
* Cleanup.


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


# 2e3477e3 31-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

* Changed the inode write locking to be held as long as the transaction is
running - this fixes several cases where someone could see outdated data
when a transaction had to be reverted (the time between unlocking the inode
and actually reverting the blocks). For that, Inodes can now be put into a
singly linked list.
* Added a TODO in Inode::WriteAt() which explains why it cannot use the above
method: seems that our VFS/VM locking model isn't really that good.
* Fixed a possible deadlock in Attribute::_Truncate() where the inode write
lock was held before starting the transaction.
* Added an InodeReadLocker convenience class, that should be used instead
of ReadLocker - Inode::Lock() only still exists because of the needs of
bfs_io().
* Moved the bfs_io() callback hooks out of the exported module API region,
and removed their bfs_ prefix.
* Added a Volume::IsInitializing() method that should be used rather than
checking if Volume::ID() is >= 0.
* Removed the MultiInodeLocker again, as it's pretty much superfluous now.
* Moved openModeToAccess() to the Utility.h header.
* Minor cleanup.


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


# 1bde8b03 08-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

* Replaced BFS's ReadWriteLock implementation with the kernel's rw_lock.
* The BlockAllocator now uses the new mutex_transfer_lock() function instead
of clobbering the mutex directly.
* Removed Lock.h - it's no longer needed.
* Minor white space cleanup.


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


# 12952edd 02-Apr-2008 Axel Dörfler <axeld@pinc-software.de>

* Quick fix for a possible deadlock I introduced with the block_cache
idle notification. We should rework the cache notifications to work
asynchronously.


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


# 3c78c045 02-Apr-2008 Axel Dörfler <axeld@pinc-software.de>

Resolved a TODO in Journal::Lock() that Urias reminded me about:
* BFS now uses a transaction listener that flushes the current transaction
in case it is idle; before, transactions would always be kept open when
they weren't large, so that the block writer could not write back the blocks
(they were busy from its POV).
* This solves the described problem of the screen resolution not being written
back even after minutes of inactivity.
* Renamed _TransactionNotify() to _TransactionWritten() to differentiate it
a bit more from the new _TransactionListener().


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


# 98e10fd4 25-Mar-2008 Axel Dörfler <axeld@pinc-software.de>

* _TransactionSize() did not take the block array into account.
* Therefore, the log was not flushed often enough:
_WriteTransactionToLog() did not check again, and would eventually
overwrite incomplete transactions (leading to a corrupted log on
reboot)!
* _TransactionDone() now only flushes the log if the new transaction
will be joined; _WriteTransactionToLog() now checks itself if there
is enough space left to actually write the log entry.
* Added a TODO about the logging code not being endian-aware.
* Renamed _BlockNotify() to _TransactionNotify() as only complete
transactions are notified, it's not working on block level anymore.


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


# 5d0afa4e 18-Jan-2008 Axel Dörfler <axeld@pinc-software.de>

* cache_detach_sub_transaction() didn't really work: it did not put all needed
blocks into the new transaction, but it would set that transaction on all
blocks of the old transaction, too. Also, it did not correctly update the
num_blocks/sub_num_blocks fields of the old transaction. Even worse, it did
return B_OK instead of the ID of the new transaction...
* get_writable_cached_block() did not correctly maintain the number of blocks
in the sub transaction.
* write_cached_block() did not free the original_data of a block when it wrote
it back as part of a previous transaction.
* Changed "cookie" for cache_next_block_in_transaction() to "long", so it will
be 64 bits when needed.
* Improved the API for detaching sub transactions: you can now get the blocks
of only the main (parent) transaction as well, added new
cache_block_in_main_transaction() function.
* BFS now flushes the log when there is no space left for the current
transaction.
* _WriteTransactionToLog() allocated a "vecs" array, but never freed it.
* _WriteTransactionToLog() now also supports detaching the current sub
transaction if the whole thing is getting too large (it will now also panic
if that doesn't work out).
* Removed a useless optimization: making the blocks available in the cache
isn't really needed, as all blocks in a transaction are locked into the
cache, anyway.
* Implemented Transaction::WriteBlocks().
* Minor cleanup, removed some dead code, fixed warnings in the fs_shell's
block_cache when compiled with debug output on.


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


# 4fc4f2c8 13-Jan-2008 Axel Dörfler <axeld@pinc-software.de>

* Added a transaction listener mechanism to be notified when a
transaction ends or has been aborted.
* BFS now listens for transactions when it created an inode to see if
the transaction will be aborted without freeing the inode (in which
case it will panic for now).
* Started implementing tracing support, but it's not working yet.
* Minor cleanup.


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


# 6edf637b 11-Nov-2007 Axel Dörfler <axeld@pinc-software.de>

Minor cleanup.


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


# e04bcee9 28-Mar-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

Made sources UserlandFS friendly. Can't be used with the fs_shell ATM,
anyway.


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


# 923e3aaf 21-Jan-2006 Axel Dörfler <axeld@pinc-software.de>

Fixed two crucial bugs:
* When aborting the first sub-transaction, BFS didn't recognize this
correctly, and aborted it via cache_abort_transaction() instead of
cache_abort_sub_transaction() - that not only reversed the whole
transaction, but also let subsequent cache_start_sub_transaction()
fail (as there was no transaction to continue anymore). Reported
in a reproducible way by Jerome Duval.
* Haiku didn't want to replay logs anymore - the off-by-one fix I did
in r14428 was not complete, it only let Be's BFS replay our logs,
but our's rejected them afterwards.


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


# 9a99234b 19-Oct-2005 Axel Dörfler <axeld@pinc-software.de>

Implemented basic sub transaction support - seems to work so far, but I haven't
tested it heavily yet.


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


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

Now takes the off-by-one error in Be's BFS implemenation into account, too.


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


# a59b9aff 18-Oct-2005 Axel Dörfler <axeld@pinc-software.de>

Rewrote the log entry writing so that it should be BFS compatible - not yet tested for
compatibility, though!
Writing is now combined into a few writev_pos() function calls to speed up log writing.


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


# c0614f32 30-Jun-2005 Axel Dörfler <axeld@pinc-software.de>

Ported r13366 back from the R5 BFS to the Haiku BFS: fixed bad bug in the journaling
code, the super block log data could have been wrong. Moved the doubly linked list
code to the kernel's util/DoublyLinkedList.h.
Also removed Journal::fCurrent, as it's not really used.


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


# 2dbdc141 30-May-2005 Axel Dörfler <axeld@pinc-software.de>

Transactions can now be nested (bfs_release_vnode() actually did that before,
but that was not working correctly):
only the owning transaction (the one that came first) can now end a transaction.
To do: if the owning transaction fails, it should actually not abort the
transaction in case there were sub transactions, but does so right now
(should do no harm, eventually file data is not freed as it should).


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


# f7eefd82 02-Mar-2005 Axel Dörfler <axeld@pinc-software.de>

Fixed warnings: possibly uninitialized variable, missing friend classifier (struct/class).


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


# 1c1b60af 08-Jun-2004 Axel Dörfler <axeld@pinc-software.de>

lock.h and cache.h are C++ safe now.


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


# 5b25332a 01-Feb-2004 Axel Dörfler <axeld@pinc-software.de>

This should fix the recently introduced locking problems:
- locking policy is now: 1) the volume lock, 2) the inode lock, 3) start
the transaction (the journal lock) - you don't need all locks, but you
have to follow this order when you need more than one of them.
- in many cases, this makes our inode read/write lock useless. I am really
looking forward to the OpenBeOS VFS layer where we can remove many of
these locks again.


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


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

Removed the fOwningThread functionality from the Journal class; it now
just uses a RecursiveLock instead.
Changed Journal::CurrentTransaction() so that it returns the current
transaction only if it's valid for the thread asking for it.
That doesn't fix the bug, but changed its timing a bit.


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


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

Fixed a possibly crashing bug (missing strerror() with %s format).
Fixed many warnings (due to -Wall). Some style cleanups.


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


# 2b5451f1 16-Sep-2002 Axel Dörfler <axeld@pinc-software.de>

Added private non-implemented copy constructor and assignment operators
for many classes for the sake of completeness.
Added a Transaction::IsStarted() method to not let it look like as if the
transaction is started more than once.
Changes made after suggestions from Mike Nordell, again :-)


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


# 850b731e 16-Sep-2002 Axel Dörfler <axeld@pinc-software.de>

Some small cleanups.


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


# 267b64639698c8aaca919137b8d65803abc1b026 12-Sep-2012 Axel Dörfler <axeld@pinc-software.de>

Run the transaction flusher in another thread.

* This fixes bug #8977.


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

Fixed misuse of Transaction::Split().

* This would cause "transaction too large" messages, and repairing the index
would actually be thrown away.
* We now properly finish/restart transactions instead which is actually
working.
* Removed the misleading Split() method altogether, as it's not even used
anywhere (not very surprising given that it doesn't do what its name
suggests).


# fd91cf4d189f91ecca91e6704796beeeee692cb5 16-Feb-2010 Axel Dörfler <axeld@pinc-software.de>

* Replaced the specialized inode in transaction mechanism with a generic one.
That costs 12 more bytes per inode on 32 bit platforms, though.


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


# 73a19dfe5d66e0cc860d4ab24868284571b0bf5b 04-Nov-2009 Axel Dörfler <axeld@pinc-software.de>

* Nested transactions didn't really work in combination with the separate
transaction mechanism. Now we keep track of the parent transactions, and
restore fOwner on Journal::Unlock().
* This closes bug #4155 again.


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


# 65e04b057d095e47f9f132d726c9a5d3bac19bad 29-Jul-2009 Axel Dörfler <axeld@pinc-software.de>

* When a reentered fs function reuses a transaction of its caller, the
Transaction::UnlockInodes() method was never called, leading to bug #4155.
* In order to make sure that inodes are still going to be reverted, we actually
need to move them into the parent transaction which we now do. This should
fix #4155.


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


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

* The inode list link was supposed to be secured by the journal log - so it was
definitely not a good idea to move _UnlockInodes() after the Journal::Unlock()
call (which was done to achieve a revertable inode).
* Instead, Journal::Unlock() is now responsible for calling the now public
Transaction::UnlockInodes(), and always does this at the right time while
holding the journal log.
* While I don't understand how #4155 can happen, this bug should be the one that
caused it.


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


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

* Don't unlock the inodes before knowing that writing back the transaction
succeeded.


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


# 4e6431078812df05c84361aee80e27d458589cc5 28-Jul-2009 Axel Dörfler <axeld@pinc-software.de>

* Some preparations to be able to split transactions if they become too large
for the log.


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


# 0bad8397020c9c2e5b7b4be04497a7b8b34d87f9 28-Jul-2009 Axel Dörfler <axeld@pinc-software.de>

* When aborting a transaction, we also need to revert any changes made to the
cached bfs_inode of all changes inodes.


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


# 2a3a8bfa9a0be87bead347e50959f9a67534bc55 28-Jul-2009 Axel Dörfler <axeld@pinc-software.de>

* Journal::_WriteTransactionToLog()'s return value was ignored previously,
leading BFS to report success on actually failed transactions. Those
transactions were even kept open, leading to a panic when starting the next
transaction.
* Transaction::Done() now returns a status - currently, this is only handled
correctly where this is likely to happen without a disk fault, ie. if the
transaction was too large to be written back safely.
* Improved "bfs_journal" command output.


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


# 992fba36eef8b17808a06d483f2fdad90173b01d 16-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* There is now a list of removed vnodes in Volume - while asking the VFS for
this seemed to be a good idea, there is one race condition that cannot be
solved otherwise (the vnode must be added/removed to that list while holding
the transaction lock, and we cannot guarantee that in the VFS).
* We are using an unused area of the in-memory bfs_inode to store the list
links (bfs_inode::pad - this will also work on 64 bit platforms).
* Inode no longer adds a singly linked list link - the transaction list now
shares the doubly linked list with the removed vnodes list.
* Added an in-memory flag INODE_IN_TRANSACTION to avoid searching an inode
to be added in the list.
* Removing an attribute directory did not hold its write lock.
* If removing an attribute failed for some reason, the INODE_DELETED flag
was not removed (the transaction would not have failed because of that).


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


# 41a6cf82b37f3225a11c11c8f74f3e9f8193e954 12-Mar-2009 Axel Dörfler <axeld@pinc-software.de>

* The InodeAllocator must remove the inode from the transaction before deleting
it, otherwise the transaction would access already freed memory when trying
to release its write lock of the inode.


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


# 31cb93ad43ca1e148bcfbccc48d2a32c81985852 12-Mar-2009 Axel Dörfler <axeld@pinc-software.de>

* Minor cleanup.


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


# 6c3348f1cd611725029432cd0cb8c35a7e2e5924 01-Nov-2008 Axel Dörfler <axeld@pinc-software.de>

* The check mechanism in the block allocator now locks the journal as well to
fix a potential deadlock.
* Journal::Lock() now accepts another parameter that specified whether child
transactions should be split - this is nothing you would want in normal
operation unless the parent transaction is only there to prevent others from
writing (such as with the block allocator check stuff).


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


# d6b39cd1a27ed39ef5275cf1a42f01fdb3a3baee 18-Aug-2008 Salvatore Benedetto <salvatore.benedetto@gmail.com>

* Fix potential deadlock in file system

see http://www.freelists.org/archives/haiku-gsoc/08-2008/msg00024.html
for more details.



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


# 2accd07be4d2731332674ebf8d801260b5388130 01-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Replaced Chain with the new SinglyLinkedList.
* Renamed openModeToAccess() to open_mode_to_access().
* Cleanup.


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


# 2e3477e3d851cc46fa682712c3f73dbb82d64fd9 31-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

* Changed the inode write locking to be held as long as the transaction is
running - this fixes several cases where someone could see outdated data
when a transaction had to be reverted (the time between unlocking the inode
and actually reverting the blocks). For that, Inodes can now be put into a
singly linked list.
* Added a TODO in Inode::WriteAt() which explains why it cannot use the above
method: seems that our VFS/VM locking model isn't really that good.
* Fixed a possible deadlock in Attribute::_Truncate() where the inode write
lock was held before starting the transaction.
* Added an InodeReadLocker convenience class, that should be used instead
of ReadLocker - Inode::Lock() only still exists because of the needs of
bfs_io().
* Moved the bfs_io() callback hooks out of the exported module API region,
and removed their bfs_ prefix.
* Added a Volume::IsInitializing() method that should be used rather than
checking if Volume::ID() is >= 0.
* Removed the MultiInodeLocker again, as it's pretty much superfluous now.
* Moved openModeToAccess() to the Utility.h header.
* Minor cleanup.


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


# 1bde8b03e7789d10cdc063a8a4b23ce3cba6f2e1 08-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

* Replaced BFS's ReadWriteLock implementation with the kernel's rw_lock.
* The BlockAllocator now uses the new mutex_transfer_lock() function instead
of clobbering the mutex directly.
* Removed Lock.h - it's no longer needed.
* Minor white space cleanup.


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


# 12952eddd738281f3851472fd7ec758def2b7866 02-Apr-2008 Axel Dörfler <axeld@pinc-software.de>

* Quick fix for a possible deadlock I introduced with the block_cache
idle notification. We should rework the cache notifications to work
asynchronously.


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


# 3c78c04589c6c37a6ec71adbf127ad3056b23a44 02-Apr-2008 Axel Dörfler <axeld@pinc-software.de>

Resolved a TODO in Journal::Lock() that Urias reminded me about:
* BFS now uses a transaction listener that flushes the current transaction
in case it is idle; before, transactions would always be kept open when
they weren't large, so that the block writer could not write back the blocks
(they were busy from its POV).
* This solves the described problem of the screen resolution not being written
back even after minutes of inactivity.
* Renamed _TransactionNotify() to _TransactionWritten() to differentiate it
a bit more from the new _TransactionListener().


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


# 98e10fd47f98c697df4c06f765a6df5f0420dcc3 25-Mar-2008 Axel Dörfler <axeld@pinc-software.de>

* _TransactionSize() did not take the block array into account.
* Therefore, the log was not flushed often enough:
_WriteTransactionToLog() did not check again, and would eventually
overwrite incomplete transactions (leading to a corrupted log on
reboot)!
* _TransactionDone() now only flushes the log if the new transaction
will be joined; _WriteTransactionToLog() now checks itself if there
is enough space left to actually write the log entry.
* Added a TODO about the logging code not being endian-aware.
* Renamed _BlockNotify() to _TransactionNotify() as only complete
transactions are notified, it's not working on block level anymore.


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


# 5d0afa4e4e49f1537865d29b620e957fbcf97823 18-Jan-2008 Axel Dörfler <axeld@pinc-software.de>

* cache_detach_sub_transaction() didn't really work: it did not put all needed
blocks into the new transaction, but it would set that transaction on all
blocks of the old transaction, too. Also, it did not correctly update the
num_blocks/sub_num_blocks fields of the old transaction. Even worse, it did
return B_OK instead of the ID of the new transaction...
* get_writable_cached_block() did not correctly maintain the number of blocks
in the sub transaction.
* write_cached_block() did not free the original_data of a block when it wrote
it back as part of a previous transaction.
* Changed "cookie" for cache_next_block_in_transaction() to "long", so it will
be 64 bits when needed.
* Improved the API for detaching sub transactions: you can now get the blocks
of only the main (parent) transaction as well, added new
cache_block_in_main_transaction() function.
* BFS now flushes the log when there is no space left for the current
transaction.
* _WriteTransactionToLog() allocated a "vecs" array, but never freed it.
* _WriteTransactionToLog() now also supports detaching the current sub
transaction if the whole thing is getting too large (it will now also panic
if that doesn't work out).
* Removed a useless optimization: making the blocks available in the cache
isn't really needed, as all blocks in a transaction are locked into the
cache, anyway.
* Implemented Transaction::WriteBlocks().
* Minor cleanup, removed some dead code, fixed warnings in the fs_shell's
block_cache when compiled with debug output on.


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


# 4fc4f2c8aeefd8548dc95f51af64beabc07a4ec5 13-Jan-2008 Axel Dörfler <axeld@pinc-software.de>

* Added a transaction listener mechanism to be notified when a
transaction ends or has been aborted.
* BFS now listens for transactions when it created an inode to see if
the transaction will be aborted without freeing the inode (in which
case it will panic for now).
* Started implementing tracing support, but it's not working yet.
* Minor cleanup.


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


# 6edf637ba6b7bc63919639c19085dd0ebc97ea73 11-Nov-2007 Axel Dörfler <axeld@pinc-software.de>

Minor cleanup.


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


# e04bcee997abc8906297d5d3c42bf38a9cca77aa 28-Mar-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

Made sources UserlandFS friendly. Can't be used with the fs_shell ATM,
anyway.


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


# 923e3aaf6f7474dac6ccc017302a6b20136f5d3f 21-Jan-2006 Axel Dörfler <axeld@pinc-software.de>

Fixed two crucial bugs:
* When aborting the first sub-transaction, BFS didn't recognize this
correctly, and aborted it via cache_abort_transaction() instead of
cache_abort_sub_transaction() - that not only reversed the whole
transaction, but also let subsequent cache_start_sub_transaction()
fail (as there was no transaction to continue anymore). Reported
in a reproducible way by Jerome Duval.
* Haiku didn't want to replay logs anymore - the off-by-one fix I did
in r14428 was not complete, it only let Be's BFS replay our logs,
but our's rejected them afterwards.


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


# 9a99234b1a158bf29f17d409c37ae8f4c51e3398 19-Oct-2005 Axel Dörfler <axeld@pinc-software.de>

Implemented basic sub transaction support - seems to work so far, but I haven't
tested it heavily yet.


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


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

Now takes the off-by-one error in Be's BFS implemenation into account, too.


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


# a59b9afff01a17005d3e9245c4789ff5788075e8 18-Oct-2005 Axel Dörfler <axeld@pinc-software.de>

Rewrote the log entry writing so that it should be BFS compatible - not yet tested for
compatibility, though!
Writing is now combined into a few writev_pos() function calls to speed up log writing.


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


# c0614f3291ad73663b85a1837fecbf24915bfa06 30-Jun-2005 Axel Dörfler <axeld@pinc-software.de>

Ported r13366 back from the R5 BFS to the Haiku BFS: fixed bad bug in the journaling
code, the super block log data could have been wrong. Moved the doubly linked list
code to the kernel's util/DoublyLinkedList.h.
Also removed Journal::fCurrent, as it's not really used.


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


# 2dbdc141cf0ea22fa3fb8425a4d74b74b1736b11 30-May-2005 Axel Dörfler <axeld@pinc-software.de>

Transactions can now be nested (bfs_release_vnode() actually did that before,
but that was not working correctly):
only the owning transaction (the one that came first) can now end a transaction.
To do: if the owning transaction fails, it should actually not abort the
transaction in case there were sub transactions, but does so right now
(should do no harm, eventually file data is not freed as it should).


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


# f7eefd8207342f7216f4822773fe9d4a5c0a0eef 02-Mar-2005 Axel Dörfler <axeld@pinc-software.de>

Fixed warnings: possibly uninitialized variable, missing friend classifier (struct/class).


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


# 1c1b60af69224711bdfcad79d7eb674cf607f500 08-Jun-2004 Axel Dörfler <axeld@pinc-software.de>

lock.h and cache.h are C++ safe now.


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


# 5b25332a790992e509503f09c206a0c38d3c17ef 01-Feb-2004 Axel Dörfler <axeld@pinc-software.de>

This should fix the recently introduced locking problems:
- locking policy is now: 1) the volume lock, 2) the inode lock, 3) start
the transaction (the journal lock) - you don't need all locks, but you
have to follow this order when you need more than one of them.
- in many cases, this makes our inode read/write lock useless. I am really
looking forward to the OpenBeOS VFS layer where we can remove many of
these locks again.


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


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

Removed the fOwningThread functionality from the Journal class; it now
just uses a RecursiveLock instead.
Changed Journal::CurrentTransaction() so that it returns the current
transaction only if it's valid for the thread asking for it.
That doesn't fix the bug, but changed its timing a bit.


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


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

Fixed a possibly crashing bug (missing strerror() with %s format).
Fixed many warnings (due to -Wall). Some style cleanups.


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


# 2b5451f1642e72a8bd34ccabac5c0b670f09f664 16-Sep-2002 Axel Dörfler <axeld@pinc-software.de>

Added private non-implemented copy constructor and assignment operators
for many classes for the sake of completeness.
Added a Transaction::IsStarted() method to not let it look like as if the
transaction is started more than once.
Changes made after suggestions from Mike Nordell, again :-)


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


# 850b731e4db2aafc9a6015205689da558785617d 16-Sep-2002 Axel Dörfler <axeld@pinc-software.de>

Some small cleanups.


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