History log of /haiku/src/system/kernel/device_manager/IOScheduler.cpp
Revision Date Author Comments
# 03768a40 31-May-2010 Axel Dörfler <axeld@pinc-software.de>

* Introduced IOScheduler::MediaChanged() - this is now called by scsi_cd instead
of having the logic be triggered by IOScheduler::SetDeviceCapacity(), as that
one might actually be called more often (for each call to update_capacity(),
ie. each B_GET_GEOMETRY/B_GET_DEVICE_SIZE will trigger it), and there is no
reason to throw away the cache every time (will make a difference during
partition/file system detection).
* In cd_init_device() just call update_capacity() instead of duplicating its
code.


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


# 2eab5420 26-Apr-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Added SetDeviceCapacity() method.


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


# 0715529b 26-Apr-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Renamed IOScheduler to IOSchedulerSimple and pulled an interface IOScheduler
out of it.


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


# 7aba4e40 26-Apr-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Moved IOSchedulerRoster into its own header/source files.


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


# 04b174ca 21-Apr-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Moved IOCallback class into separate source file.
* Moved IOScheduler::_IOCallbackWrapper() to IOCallback::WrapperFunction().


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


# ade3a199 25-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Already assigned the IOScheduler's ID in the constructor and use it in the
names of its threads.


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


# 1c12dcb5 21-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

IOSchedulerRoster:
* Lock the notification service and check HasListeners(), so we don't prepare
an event message needlessly.
* The on-stack buffer for the event message was too small for I/O operation
related events. Now a larger buffer belonging to the roster object is used.


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


# ca77afe7 19-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Implemented missing cleanup when an IOScheduler is destroyed. The threads
weren't terminated orderly.
* IOScheduler now stores its name and gets a unique ID.
* Added IOSchedulerRoster singleton which registers all IOSchedulers. It also
provides a notification service. We generate interesting events for
IOSchedulers, IORequests, and IOOperations.


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


# 89e87505 13-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Improved panic() message.


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


# a0439d88 09-Nov-2009 Axel Dörfler <axeld@pinc-software.de>

* Adjusted thread priorities of several system services based on a mail from
Mikhail Panasyuk: since worker threads often end up with B_NORMAL_PRIORITY,
it might be a good idea to give system threads a higher priority.
* Minor cleanup (mostly automatic whitespace).


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


# 5bfffb9d 31-Aug-2009 Michael Lotz <mmlr@mlotz.ch>

The block size wasn't initialized, causing usages of an IOScheduler without
a DMAResource not to work.


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


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

bonefish + axeld:
* Reverted r31809 as it introduced a race condition; if the I/O request had been
notified, it could already been deleted at that point.
* Instead, we need to notify the request in each file system/driver that uses
it. Added new notify_io_request() function that does that exactly.
* Added a TODO comment to the userlandfs where the request notification needs
a bit more thought.


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


# 5147963d 26-Jul-2009 Stephan Aßmus <superstippi@gmx.de>

headers/private/kernel/util/OpenHashTable.h, Hugo's version, is a bit nicer than
Tracker's OpenHashTable.h which it should eventually replace. We've renamed the
class to BOpenHashTable and changed the interface slightly so that HashTableLink
became superfluous.
Adapted all the code that used it. Since the OpenHashTables no longer clash,
this should fix the GCC4 build.


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


# 591bc3f2 28-May-2009 Jérôme Duval <korli@users.berlios.de>

* various fixes identified by gcc4, provided by Joe Prostko


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


# c33667d4 01-Feb-2009 Michael Lotz <mmlr@mlotz.ch>

Fixing warnings under GCC4 in preparation to enable -Werror there as well:
* Replaced the use of offsetof() for structs that aren't PODs. Add a
offset_of_member() macro to util/khash.h because that's what it's used for
in our cases.
* Change the signature of add_debugger_command()/remove_debugger_command() on
GCC > 2 to avoid the depricated conversion from string constants to char *.
* Adding some "suggested" parenthesis. I know that not everyone likes that, but
it pointed out at least one bug that is fixed here as well.


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


# b50e6202 02-Oct-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Fixed various warnings.


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


# 841b6cd7 30-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Also add the creating thread to an IORequest and let child requests
inherit it.
* IOScheduler::ScheduleRequest() uses the request's thread and team now
instead of the current one. Otherwise for requests processed
iteratively this would always be the I/O scheduler's notifier thread.
* Also get the thread's I/O priority now. It's still ignored later,
though.


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


# 0316483f 27-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* DMAResource::TranslateNext(): Added parameter to limit the maximum
operation length.
* IORequest: Added owner (IORequestOwner). Also added a SetUnfinished()
method, which is invoked by the I/O scheduler after all operations of
the request have been finished, but the request isn't done yet.
* Added debugger commands "io_request_owner" and "io_scheduler" printing
information for a IORequestOwner and IOScheduler object respectively.
* Implemented an actual I/O scheduling algorithm. It's a simple round
robin strategy (a queue per thread) with a unidirectional elevator
serializing the operations. ATM priorities are ignored, the bandwidth
isn't adjusted to the device, and there are TODOs all over the place.


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


# de5fcb8a 24-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* The IOScheduler does not create as many operations as it can before
executing them. Doesn't really make any difference ATM.
* Handle B_BUSY returned by DMAResource::TranslateNext() correctly.


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


# 5c8d420b 19-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added "bool wait" parameter to _GetOperation(). If false and no unused
operation is available ATM, it will return NULL.
* _Finisher() does now re-schedule a request, if all of its operations
finished successfully, but there are still remaining bytes.
* _Scheduler() does now operate in two passes. First it creates as many
operations for a given request as possible, then it executes the
operations. This fixes bug #2644. The problem was that by creating and
executing the operations in a single loop, an operation could be
finished before the next one was added. The request would thus be
considered finished and the request owner be notified. This would
usually lead to the destruction of the request while it was still in
use.
* _Scheduler(): In case we don't have a DMA resource also advance the
request.


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


# 39b5c374 05-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Added a DMAResource::Init() method that gets a device node - for now, it will
reuse the block_io attributes in the node to build the dma_restrictions.
* DMAResource::Init() now dumps the dma_resources (should be done with the
TRACE() macro later).
* Turned off IOScheduler debug output.


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


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

* Renamed thread_spinlock and team_spinlock to gThreadSpinlock and
gTeamSpinlock.
* Renamed the static global variables in smp.c to match our style guide.
* Minor other cleanup.
* Removed superfluous white space.


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


# 7f12cc54 30-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* It is now supported that I/O operations and requests are only handled
partially (e.g. due to hitting the end of file). The respective
classes have grown new methods and attributes to deal with that. The
"finished" callbacks have got additional parameters to indicate
whether the transfer was only partial and how much has been
transferred. Other callbacks and functions have a size_t* in/out
parameter instead of a simple size_t, now.
* vfs_{read,write}_pages() do now use the I/O request framework instead
of the underlying FS's {read,write}_pages() hooks (those should be
unused now). Furthermore they've got an additional "flags" parameter,
which is passed to IORequest::Init(), i.e. it allows to specify that
the given vecs refer to physical addresses.
* The file cache's read_into_cache() reads directly into physical
pages, now.
* Fixed bug in DoIO::IO(): The offset was not adjusted, so that all
pages were incorrectly transferred from/to the same location.
* Fixed broken subrequest scheduling loop head in
do_iterative_fd_io_iterate().
* Adjusted the test driver and implemented its io() hook. Using this
driver I/O requests are passed all the way from the VFS/VM to the
driver and through the I/O scheduler. It even seems to work. :-)
* Added missing const to the iovec* parameter of the IORequest::Init()
methods.
* Disabled some debug output by default. Added new optional debug
output.


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


# 8c980485 25-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added support for an iteration callback in IORequest.
* Split IORequest::ChunkFinished() into OperationFinished() and
and SubrequestFinished(). Moved the notification part into a new
method NotifyFinished().
* Added new IOScheduler thread for notifying finished requests.
IOScheduler::_Finisher() hands over finished request to it, unless the
requests don't have callbacks. We need the separate thread, since the
callbacks can potentially reenter the scheduler and thus cause
deadlocks.


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


# 0d4d5abe 23-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

An IORequest's memory needs to be unlocked when it is done. Since this
happens in the I/O scheduler thread, we need to use unlock_memory_etc().
Changed the IOBuffer::{Lock,Unlock}Memory() methods accordingly.

The test driver seems to be working stable, now.


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


# bfbae5e5 23-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

The I/O callback will eventually move the operation back to the
completed operations queue. That doesn't need to happen synchronously
either. So we have to restart the loop.


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


# 902559ce 23-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added a mutex to IORequest. It doesn't look like we can get around
using a lock and I'm not very much in favor of a global one.
* Added "finished" callback to IORequest.
* IOOperation::Finish() no longer invokes its parent request's
ChunkFinished(). The finisher does this instead. ChunkFinished()
can optionally remove the chunk from the parent.
* Added IORequest::Wait() which waits for the completion of the request.
* Introduced IORequestChunk::ResetStatus() to make setting the status to
"pending" somewhat more explicit.
* Implemented the missing IOScheduler::SetCallback() methods.
* The NotifyAll() calls on the IOScheduler's condition variables were
missing, so it just waited forever.
* Added some more debug output.


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


# b71e6319 23-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Fixed race condition between OperationCompleted() and the scheduler
thread. Interrupting a thread only works when it is already waiting.
We do now use a flag to indicate whether the scheduler thread is
waiting (avoids thread_interrupt() calls when the thread is in driver
code). Furthermore before starting to wait, we check whether any
finisher work has to be done -- we do that (and the addition of the
entry to the condition variable) with the finisher lock being held to
avoid the race condition.
* Moved waiting for and getting the next unscheduled request into new
method _GetNextUnscheduledRequest().


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


# 86cea5c5 21-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

* Renamed IOOperation::SetRequest() to Prepare().


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


# 45a206a7 19-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

axeld + bonefish:
More work on the I/O scheduler, more precisely mainly the DMAResource class:
* When splitting requests into operations, we're now able to flexibly mix
bounce buffer segments and the given physical vectors in a single
operation. This reduces the number of operations.
* Squashed several TODO and fleshed out more of the implementation.
* Added a test driver running unit tests. There are only a few tests yet,
but those pass.


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


# 6969690a 18-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

bonefish + axeld:
* Moved the old I/O scheduler code into the device manager, and replaced its
contents completely :-)
* Implemented the DMA and I/O requests/scheduler framework - for now in C++
only. It's a work in progress and not used anywhere yet.


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


# 03768a405289a006f256465ea93a87faed5ea339 31-May-2010 Axel Dörfler <axeld@pinc-software.de>

* Introduced IOScheduler::MediaChanged() - this is now called by scsi_cd instead
of having the logic be triggered by IOScheduler::SetDeviceCapacity(), as that
one might actually be called more often (for each call to update_capacity(),
ie. each B_GET_GEOMETRY/B_GET_DEVICE_SIZE will trigger it), and there is no
reason to throw away the cache every time (will make a difference during
partition/file system detection).
* In cd_init_device() just call update_capacity() instead of duplicating its
code.


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


# 2eab54201c8258d53643a2c2eeb504c8218f3a62 26-Apr-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Added SetDeviceCapacity() method.


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


# 0715529b59a3965beea04288a564458225d6f470 26-Apr-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Renamed IOScheduler to IOSchedulerSimple and pulled an interface IOScheduler
out of it.


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


# 7aba4e400ed69d328320c4fcda1617f759e98707 26-Apr-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Moved IOSchedulerRoster into its own header/source files.


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


# 04b174ca25bb106f620a42500413c3d4a38fe0c5 21-Apr-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Moved IOCallback class into separate source file.
* Moved IOScheduler::_IOCallbackWrapper() to IOCallback::WrapperFunction().


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


# ade3a199a6a941079907def0744f1f4b9ff86a50 25-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Already assigned the IOScheduler's ID in the constructor and use it in the
names of its threads.


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


# 1c12dcb598d5ddbc792b24e6210c6f102ff85a5b 21-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

IOSchedulerRoster:
* Lock the notification service and check HasListeners(), so we don't prepare
an event message needlessly.
* The on-stack buffer for the event message was too small for I/O operation
related events. Now a larger buffer belonging to the roster object is used.


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


# ca77afe75f10f5c4fbc6c328de231c1572980d34 19-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Implemented missing cleanup when an IOScheduler is destroyed. The threads
weren't terminated orderly.
* IOScheduler now stores its name and gets a unique ID.
* Added IOSchedulerRoster singleton which registers all IOSchedulers. It also
provides a notification service. We generate interesting events for
IOSchedulers, IORequests, and IOOperations.


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


# 89e87505cf5151cd06c46ae803b04718098c4abc 13-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Improved panic() message.


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


# a0439d88df9202e0a5aea9fbe587a1eaf88dd348 09-Nov-2009 Axel Dörfler <axeld@pinc-software.de>

* Adjusted thread priorities of several system services based on a mail from
Mikhail Panasyuk: since worker threads often end up with B_NORMAL_PRIORITY,
it might be a good idea to give system threads a higher priority.
* Minor cleanup (mostly automatic whitespace).


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


# 5bfffb9d94d7837b0347a44ccbb4c743d0ff4d80 31-Aug-2009 Michael Lotz <mmlr@mlotz.ch>

The block size wasn't initialized, causing usages of an IOScheduler without
a DMAResource not to work.


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


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

bonefish + axeld:
* Reverted r31809 as it introduced a race condition; if the I/O request had been
notified, it could already been deleted at that point.
* Instead, we need to notify the request in each file system/driver that uses
it. Added new notify_io_request() function that does that exactly.
* Added a TODO comment to the userlandfs where the request notification needs
a bit more thought.


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


# 5147963dcd57fefa4f63c484eb88e9eaf4002976 26-Jul-2009 Stephan Aßmus <superstippi@gmx.de>

headers/private/kernel/util/OpenHashTable.h, Hugo's version, is a bit nicer than
Tracker's OpenHashTable.h which it should eventually replace. We've renamed the
class to BOpenHashTable and changed the interface slightly so that HashTableLink
became superfluous.
Adapted all the code that used it. Since the OpenHashTables no longer clash,
this should fix the GCC4 build.


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


# 591bc3f2d99168a9b2a9bdcbda20c47e97a4ff80 28-May-2009 Jérôme Duval <korli@users.berlios.de>

* various fixes identified by gcc4, provided by Joe Prostko


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


# c33667d400856680a8e0122300861eda77d1847a 01-Feb-2009 Michael Lotz <mmlr@mlotz.ch>

Fixing warnings under GCC4 in preparation to enable -Werror there as well:
* Replaced the use of offsetof() for structs that aren't PODs. Add a
offset_of_member() macro to util/khash.h because that's what it's used for
in our cases.
* Change the signature of add_debugger_command()/remove_debugger_command() on
GCC > 2 to avoid the depricated conversion from string constants to char *.
* Adding some "suggested" parenthesis. I know that not everyone likes that, but
it pointed out at least one bug that is fixed here as well.


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


# b50e620202c4faf76869721957973c0f72e83155 02-Oct-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Fixed various warnings.


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


# 841b6cd74970c81e93e8c64c1eb31e4b2d36e00b 30-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Also add the creating thread to an IORequest and let child requests
inherit it.
* IOScheduler::ScheduleRequest() uses the request's thread and team now
instead of the current one. Otherwise for requests processed
iteratively this would always be the I/O scheduler's notifier thread.
* Also get the thread's I/O priority now. It's still ignored later,
though.


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


# 0316483f0ade2904583955b57cc396bf060f9027 27-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* DMAResource::TranslateNext(): Added parameter to limit the maximum
operation length.
* IORequest: Added owner (IORequestOwner). Also added a SetUnfinished()
method, which is invoked by the I/O scheduler after all operations of
the request have been finished, but the request isn't done yet.
* Added debugger commands "io_request_owner" and "io_scheduler" printing
information for a IORequestOwner and IOScheduler object respectively.
* Implemented an actual I/O scheduling algorithm. It's a simple round
robin strategy (a queue per thread) with a unidirectional elevator
serializing the operations. ATM priorities are ignored, the bandwidth
isn't adjusted to the device, and there are TODOs all over the place.


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


# de5fcb8ab4051dd733f80ca55e32c72a4cd2fc0c 24-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* The IOScheduler does not create as many operations as it can before
executing them. Doesn't really make any difference ATM.
* Handle B_BUSY returned by DMAResource::TranslateNext() correctly.


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


# 5c8d420b7c2a26b7153114396e6d0c4c1641dd3d 19-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added "bool wait" parameter to _GetOperation(). If false and no unused
operation is available ATM, it will return NULL.
* _Finisher() does now re-schedule a request, if all of its operations
finished successfully, but there are still remaining bytes.
* _Scheduler() does now operate in two passes. First it creates as many
operations for a given request as possible, then it executes the
operations. This fixes bug #2644. The problem was that by creating and
executing the operations in a single loop, an operation could be
finished before the next one was added. The request would thus be
considered finished and the request owner be notified. This would
usually lead to the destruction of the request while it was still in
use.
* _Scheduler(): In case we don't have a DMA resource also advance the
request.


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


# 39b5c374187b8c7d7a13e8159a70eadb0f06ecb0 05-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Added a DMAResource::Init() method that gets a device node - for now, it will
reuse the block_io attributes in the node to build the dma_restrictions.
* DMAResource::Init() now dumps the dma_resources (should be done with the
TRACE() macro later).
* Turned off IOScheduler debug output.


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


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

* Renamed thread_spinlock and team_spinlock to gThreadSpinlock and
gTeamSpinlock.
* Renamed the static global variables in smp.c to match our style guide.
* Minor other cleanup.
* Removed superfluous white space.


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


# 7f12cc54a729622cd04940ee9400958413d99b21 30-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* It is now supported that I/O operations and requests are only handled
partially (e.g. due to hitting the end of file). The respective
classes have grown new methods and attributes to deal with that. The
"finished" callbacks have got additional parameters to indicate
whether the transfer was only partial and how much has been
transferred. Other callbacks and functions have a size_t* in/out
parameter instead of a simple size_t, now.
* vfs_{read,write}_pages() do now use the I/O request framework instead
of the underlying FS's {read,write}_pages() hooks (those should be
unused now). Furthermore they've got an additional "flags" parameter,
which is passed to IORequest::Init(), i.e. it allows to specify that
the given vecs refer to physical addresses.
* The file cache's read_into_cache() reads directly into physical
pages, now.
* Fixed bug in DoIO::IO(): The offset was not adjusted, so that all
pages were incorrectly transferred from/to the same location.
* Fixed broken subrequest scheduling loop head in
do_iterative_fd_io_iterate().
* Adjusted the test driver and implemented its io() hook. Using this
driver I/O requests are passed all the way from the VFS/VM to the
driver and through the I/O scheduler. It even seems to work. :-)
* Added missing const to the iovec* parameter of the IORequest::Init()
methods.
* Disabled some debug output by default. Added new optional debug
output.


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


# 8c9804851b27127f5741c9a667397ab269d4cc53 25-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added support for an iteration callback in IORequest.
* Split IORequest::ChunkFinished() into OperationFinished() and
and SubrequestFinished(). Moved the notification part into a new
method NotifyFinished().
* Added new IOScheduler thread for notifying finished requests.
IOScheduler::_Finisher() hands over finished request to it, unless the
requests don't have callbacks. We need the separate thread, since the
callbacks can potentially reenter the scheduler and thus cause
deadlocks.


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


# 0d4d5abea12f04f907608d8ecbcd588afc360c58 23-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

An IORequest's memory needs to be unlocked when it is done. Since this
happens in the I/O scheduler thread, we need to use unlock_memory_etc().
Changed the IOBuffer::{Lock,Unlock}Memory() methods accordingly.

The test driver seems to be working stable, now.


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


# bfbae5e594e7d6e311bdbface259739838c51133 23-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

The I/O callback will eventually move the operation back to the
completed operations queue. That doesn't need to happen synchronously
either. So we have to restart the loop.


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


# 902559ce32c16724ad24cfa90582097ba8d6fd43 23-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added a mutex to IORequest. It doesn't look like we can get around
using a lock and I'm not very much in favor of a global one.
* Added "finished" callback to IORequest.
* IOOperation::Finish() no longer invokes its parent request's
ChunkFinished(). The finisher does this instead. ChunkFinished()
can optionally remove the chunk from the parent.
* Added IORequest::Wait() which waits for the completion of the request.
* Introduced IORequestChunk::ResetStatus() to make setting the status to
"pending" somewhat more explicit.
* Implemented the missing IOScheduler::SetCallback() methods.
* The NotifyAll() calls on the IOScheduler's condition variables were
missing, so it just waited forever.
* Added some more debug output.


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


# b71e631972d3563641f621a2b0f58def53e334c6 23-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Fixed race condition between OperationCompleted() and the scheduler
thread. Interrupting a thread only works when it is already waiting.
We do now use a flag to indicate whether the scheduler thread is
waiting (avoids thread_interrupt() calls when the thread is in driver
code). Furthermore before starting to wait, we check whether any
finisher work has to be done -- we do that (and the addition of the
entry to the condition variable) with the finisher lock being held to
avoid the race condition.
* Moved waiting for and getting the next unscheduled request into new
method _GetNextUnscheduledRequest().


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


# 86cea5c5f192ce43ce1965d47aadd1f1f55c6e86 21-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

* Renamed IOOperation::SetRequest() to Prepare().


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


# 45a206a7420034118693e3bbc8976083e1045e51 19-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

axeld + bonefish:
More work on the I/O scheduler, more precisely mainly the DMAResource class:
* When splitting requests into operations, we're now able to flexibly mix
bounce buffer segments and the given physical vectors in a single
operation. This reduces the number of operations.
* Squashed several TODO and fleshed out more of the implementation.
* Added a test driver running unit tests. There are only a few tests yet,
but those pass.


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


# 6969690afee7ab446c14e04011cf5cadedb09c1b 18-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

bonefish + axeld:
* Moved the old I/O scheduler code into the device manager, and replaced its
contents completely :-)
* Implemented the DMA and I/O requests/scheduler framework - for now in C++
only. It's a work in progress and not used anywhere yet.


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