History log of /haiku/src/system/kernel/fs/vfs_request_io.cpp
Revision Date Author Comments
# fa766875 08-Jan-2024 Augustin Cavalier <waddlesplash@gmail.com>

kernel: Rename DescriptorPutter to FileDescriptorPutter.

For consistency. No functional change.


# cdccd323 09-Dec-2020 X512 <danger_mail@list.ru>

use common AutoDeleter types

Change-Id: I115e14b76f3ff049c5f7d9471efd3619a0038fcf
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3483
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>


# 36aafa56 04-Dec-2020 X512 <danger_mail@list.ru>

fix build after CObjectDeleter interface change

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


# e36ad522 08-Dec-2013 François Revol <revol@free.fr>

Fix 24d0e21f51e88ab35cc3f1c1750741dfeb40933d correctly

CreateSubRequest() could still return an error and break out of the
while loop without exiting the outer for loop.

Instead we reset the error code before entering the for loop.


# 664e3fba 07-Dec-2013 François Revol <revol@free.fr>

Partially revert 24d0e21f51e88ab35cc3f1c1750741dfeb40933d

This reverts the extra for loop condition from
"do_iterative_fd_io_iterate(): Support sparse files".

When reading a file with more than 8 block_runs, get_vecs() would
return B_BUFFER_OVERFLOW which would never create any subrequest due
to the test on error == B_OK on the loop, but instead just fail.

Except for the get_vecs() return code, where it is not wanted,
the test made no sense as all other assignments are tested directly
or passed around with break.

Works for me but I don't guarantee it's completely correct.


# 24d0e21f 11-Nov-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

do_iterative_fd_io_iterate(): Support sparse files

* Check whether the vectors we get are sparse file vectors and satisfy
them immediately instead of creating a subrequest. Untested, since the
API isn't used by ext2 as it should be.
* Add error == B_OK to the condition of the outer loop.


# 5163e1c6 27-Jul-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Revert "Introduce vnode op supports_operation(), fix devfs_io()"

This reverts commit 98a5231fe5497c526849f2d84b1a9bbcbdfd2dbc.


# 98a5231f 27-Jul-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Introduce vnode op supports_operation(), fix devfs_io()

devfs_io() can't fall back to calling vfs_synchronous_io(), if the
device driver doesn't support handling requests asynchronously. The
presence of the io() hook leads the VFS (do_iterative_fd_io()) to
believe that asynchronous handling is supported and set a
finished-callback on the request which calls the io() hook to start the
next chunk. Thus, instead of iterating through the request in a loop
the iteration happens recursively. For sufficiently fragmented requests
the stack may overflow (ticket #9900).

* Introduce a new vnode operation supports_operation(). It can be called
by the VFS to determine whether a present hook is actually currently
supported for a given vnode.
* devfs: implement the new hook and remove the fallback handling in
devfs_io().
* vfs_request_io.cpp: use the new hook to determine whether the io()
hook is really supported.


# 311e1487 29-Apr-2013 Jérôme Duval <jerome.duval@gmail.com>

vfs: fixed two warnings.

* warnings about comparison between signed and unsigned integer expressions.


# 4be4fc6b 15-Jun-2012 Alex Smith <alex@alex-smith.me.uk>

More 64-bit compilation/safety fixes.


# 935c5e82 18-Jul-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Fixed build with TRACE_VFS_REQUEST_IO enabled.


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


# 1d578e15 02-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Fixed more address types related issues. Mostly printf() or comparison
warnings, but also some oversights from earlier changes.


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


# 435c43f5 02-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Introduced type generic_io_vec, which is similar to iovec, but uses types
that are wide enough for both virtual and physical addresses.
* DMABuffer, IORequest, IOScheduler,... and code using them: Use
generic_io_vec and generic_{addr,size}_t where necessary.


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


# deee8524 26-Jan-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Introduced {malloc,memalign,free}_etc() which take an additional "flags"
argument. They replace the previous special-purpose allocation functions
(malloc_nogrow(), vip_io_request_malloc()).
* Moved the I/O VIP heap to heap.cpp accordingly.
* Added quite a bit of passing around of allocation flags in the VM,
particularly in the VM*AddressSpace classes.
* Fixed IOBuffer::GetNextVirtualVec(): It was ignoring the VIP flag and always
allocated on the normal heap.


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


# 891a50b2 11-Oct-2009 Bruno G. Albuquerque <bga@bug-br.org.br>

- Fix typo that broke the GCC4 build but not the GCC2 build.



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


# 30372751 11-Oct-2009 Michael Lotz <mmlr@mlotz.ch>

Virtualize the buffers using IOBuffer::GetNextVirtualVec(). This removes the
need for the IO -> InternalIO indirection as it is always fed virtual buffers,
which simplifies things a bit.


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


# f3bd145c 10-Oct-2009 Michael Lotz <mmlr@mlotz.ch>

When the need for physical to virtual mapping arises because of emulating IO
reads or writes for old style drivers, map the physical memory at once. Since
USB is pretty much the only one affected and there small reads/writes are
exponentially slower, the performance gain of the burst transfer far outweighs
the additional overhead of the mapping. Still this could be further optimized
and will eventually be superseeded by also providing a physical memory API in
USB. For now it should bring back USB reads to an acceptable level. Writes are
still page wise though because of how writing back memory works in general.


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


# 230153f1 02-Sep-2009 Michael Lotz <mmlr@mlotz.ch>

Reset the error variable to B_OK in case we want to continue after allocating
only some sub requests worked. Previously we would have simply canceled all
of the subrequests in the loop because we cancel after the first error.


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


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

* If the fs_io() hook failed, we need to check if the request has been notified
about it (there is also no public API to do that in the FS yet).
* This could have caused bug #2719, although the specific reason why the FS hook
failed remains unknown. At least it won't hang in this case anymore.


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


# eb2bd0e8 27-Apr-2009 Stephan Aßmus <superstippi@gmx.de>

axeld:
* Implemented a way to do asynchronous pre-fetching when mapping files.
* There are slight code duplications in some places that could benefit
from cleaning up, but nothing too bad.
* Implementing smarter ways to trigger prefetching and more analysis of
the situations in the kernel would be nice. Currently up to 10 MB
of every mapped file are pre-fetched without further analysis.
* The speed improvement is nice for certain operations. On our test
system (real hardware), Firefox took 9 seconds from being launched
to display a window. Now it takes 5 seconds. Both measurements
right after booting. The same system took 35 seconds from launching
Haiku in the GRUB menu to displaying the Tracker desktop background
image. Now it takes 27 seconds.
* We didn't have the chance to check out the effects of this on the
CD boot, but potentially, they could speed it up a lot.


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


# 00405f22 09-Feb-2009 Michael Lotz <mmlr@mlotz.ch>

* Add an additional argument to get_vnode() that gets the fs_vnode_ops of the
node. That is needed for a layered filesystem to be able to construct a full
fs_vnode out of a volume/inode pair.
* Adapt places where get_vnode is used. Sadly this is a C API and we can't just
use a default NULL for that argument.
* Introduce a flag B_VNODE_WANTS_OVERLAY_SUB_NODE that can be returned in the
flags field of a fs get_vnode call. A filesystem can use this flag to indicate
that it doesn't support the full set of fs features (attributes, write support)
and it'd like to have unsupported calls emulated by an overlay sub node.
* Add a perliminary overlay filesystem that emulates file attributes using files
on a filesystem where attributes aren't supported. It does currently only
support reading attributes/attribute directories though. All other calls are
just passed through to the super filesystem.
* Adjust places where a HAS_FS_CALL() is taken as a guarantee that the operation
is supported. For the overlay filesystem we may later return a B_UNSUPPORTED,
so make sure that in that case proper fallback options are taken.
* Make the iso9660 filesystem request overlay sub nodes. This can be fine tuned
later to only trigger where there are features on a CD that need emulation
at all.

If you happened to know the attribute file format and location you could build
an iso with read-only attribute support now. Note that this won't be enough to
get a bootable iso-only image as the query and index support is yet missing.


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


# 47c40a10 19-Oct-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Prefixed memset_physical() and memcpy_to_physical() with "vm_",
added vm_memcpy_from_physical() and vm_memcpy_physical_page(), and
added respective functions to the vm_translation_map operations. The
architecture specific implementation can now decide how to implement
them most efficiently. Added generic implementations that can be used,
though.
* Changed vm_{get,put}_physical_page(). The former no longer accepts
flags (the only flag PHYSICAL_PAGE_DONT_WAIT wasn't needed anymore).
Instead it returns an implementation-specific handle that has to be
passed to the latter. Added vm_{get,put}_physical_page_current_cpu()
and *_debug() variants, that work only for the current CPU,
respectively when in the kernel debugger. Also adjusted the
vm_translation_map operations accordingly.
* Made consequent use of the physical memory operations in the source
tree.
* Also adjusted the m68k and ppc implementations with respect to the
vm_translation_map operation changes, but they are probably broken,
nevertheless.
* For x86 the generic physical page mapper isn't used anymore. It is
suboptimal in any case. For systems with small memory it is too much
overhead, since one can just map the complete physical memory (that's
not done yet, though). For systems with large memory it counteracts
the VM strategy to reuse the least recently used pages. Since those
pages will most likely not be mapped by the page mapper anymore, it
will keep remapping chunks. This was also the reason why building
Haiku in Haiku was significantly faster with only 256 MB RAM (since
that much could be kept mapped all the time).
Now we're using a different strategy: We have small pools of virtual
page slots per CPU that are used for the physical page operations
(memset_physical(), memcpy_*_physical()) with CPU-pinned thread.
Furthermore we have four slots per translation map, which are used to
map page tables.

These changes speed up the Haiku image build in Haiku significantly. On
my Core2 Duo 2.2 GHz 2 GB machine about 40% to 20 min 40 s (KDEBUG
disabled, block cache debug disabled). Still more than factor 3 slower
than FreeBSD and Linux, though.


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


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

* do_iterative_fd_io_iterate() must check for B_BUFFER_OVERFLOW to handle the
case it has to call the file map translation hook again to fulfill the whole
request; it already handled the partial case correctly.
* This fixes an occasional "Value too large" error when accesssing fragmented
files.


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


# 7a253cf5 20-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Since the file cache can access any kind of data (and not just file data),
we must use {read|write}_pages() instead of {read|write}().
* This should fix accessing other file systems than BFS (ie. those that doesn't
have an io() function) like ext3 and FAT.


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


# 66394896 18-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added method vfs_asynchronous_write_pages(), which, unsurprisingly,
writes the given page iovecs asynchronously. The new class
AsyncIOCallback is used to inform the caller when the request has been
finished.


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


# 41417412 13-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added new(vip_io_alloc) operators allocating memory from the VIP I/O
heap.
* Allocate IOBuffers, IORequests, and cookies on the VIP I/O heap, if
necessary.


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


# be87a493 03-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

do_iterative_fd_io():
* When do_iterative_fd_io_iterate() fails, we must not invoke the
supplied finished hook explicitly, since it is invoked indirectly by
request->SetStatusAndNotify() anyway. Should fix #2557.
* We must detach the descriptor putter as soon as we have adjusted the
request's finished callback, since that will put the descriptor.


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


# 5054db18 02-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Use vfs_vnode_io() to schedule subrequests instead of calling the FS's
io() hook directly (it might not even have one).
* Fixed incorrect check in synchronous_io() which would cause requests
with more than one vec to finish early. Fixes bug #2558.


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


# cfae07b6 28-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added kernel private vfs_vnode_io() which performs an io_request on a
vnode (falling back to synchronous I/O if the io() is not supported).


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


# ec598fe4 27-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added FS interface hooks io() and cancel_io(). The former is supposed
to provide asynchrounous (or only synchronous, if asynchronous is not
supported) I/O request support. It will eventually replace
{read,write}_pages(). None of the FS implementations implement them
yet.
* Implemented some support functions for request-based I/O. File system
implementations can use do_fd_io() which passes an I/O request to the
layer responsible for a given FD, and do_iterative_fd_io(), which
translates a request for a file to subrequests for the underlying
device and passes them on. Both fall back to synchrounous processing
when the io() hook is not supported.
Furthermore added vfs_synchronous_io() which should be handy for the
devfs to perform io_requests synchronously for devices that don't
support the io() hook.


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


# e36ad522d60cd032a1ab15229b1a56bd7288c348 08-Dec-2013 François Revol <revol@free.fr>

Fix 24d0e21f51e88ab35cc3f1c1750741dfeb40933d correctly

CreateSubRequest() could still return an error and break out of the
while loop without exiting the outer for loop.

Instead we reset the error code before entering the for loop.


# 664e3fba9b2888c414e7bf9feca22bf71c716194 07-Dec-2013 François Revol <revol@free.fr>

Partially revert 24d0e21f51e88ab35cc3f1c1750741dfeb40933d

This reverts the extra for loop condition from
"do_iterative_fd_io_iterate(): Support sparse files".

When reading a file with more than 8 block_runs, get_vecs() would
return B_BUFFER_OVERFLOW which would never create any subrequest due
to the test on error == B_OK on the loop, but instead just fail.

Except for the get_vecs() return code, where it is not wanted,
the test made no sense as all other assignments are tested directly
or passed around with break.

Works for me but I don't guarantee it's completely correct.


# 24d0e21f51e88ab35cc3f1c1750741dfeb40933d 11-Nov-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

do_iterative_fd_io_iterate(): Support sparse files

* Check whether the vectors we get are sparse file vectors and satisfy
them immediately instead of creating a subrequest. Untested, since the
API isn't used by ext2 as it should be.
* Add error == B_OK to the condition of the outer loop.


# 5163e1c62dc454d84d5cfbd4558b84b8195a44fa 27-Jul-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Revert "Introduce vnode op supports_operation(), fix devfs_io()"

This reverts commit 98a5231fe5497c526849f2d84b1a9bbcbdfd2dbc.


# 98a5231fe5497c526849f2d84b1a9bbcbdfd2dbc 27-Jul-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Introduce vnode op supports_operation(), fix devfs_io()

devfs_io() can't fall back to calling vfs_synchronous_io(), if the
device driver doesn't support handling requests asynchronously. The
presence of the io() hook leads the VFS (do_iterative_fd_io()) to
believe that asynchronous handling is supported and set a
finished-callback on the request which calls the io() hook to start the
next chunk. Thus, instead of iterating through the request in a loop
the iteration happens recursively. For sufficiently fragmented requests
the stack may overflow (ticket #9900).

* Introduce a new vnode operation supports_operation(). It can be called
by the VFS to determine whether a present hook is actually currently
supported for a given vnode.
* devfs: implement the new hook and remove the fallback handling in
devfs_io().
* vfs_request_io.cpp: use the new hook to determine whether the io()
hook is really supported.


# 311e148798ae4738157c39ab7783b63e70203192 29-Apr-2013 Jérôme Duval <jerome.duval@gmail.com>

vfs: fixed two warnings.

* warnings about comparison between signed and unsigned integer expressions.


# 4be4fc6b1faddbd037146214a0011d320842b4f3 15-Jun-2012 Alex Smith <alex@alex-smith.me.uk>

More 64-bit compilation/safety fixes.


# 935c5e82789f8daaf6622fdeb818fd608a36b098 18-Jul-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Fixed build with TRACE_VFS_REQUEST_IO enabled.


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


# 1d578e15fe5b5c3ff62866ae81aef529d00d7762 02-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Fixed more address types related issues. Mostly printf() or comparison
warnings, but also some oversights from earlier changes.


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


# 435c43f5912b109e7d5cf682865d2061e62fad8c 02-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Introduced type generic_io_vec, which is similar to iovec, but uses types
that are wide enough for both virtual and physical addresses.
* DMABuffer, IORequest, IOScheduler,... and code using them: Use
generic_io_vec and generic_{addr,size}_t where necessary.


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


# deee8524b7534d9b586cbcbf366d0660c9769a8e 26-Jan-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Introduced {malloc,memalign,free}_etc() which take an additional "flags"
argument. They replace the previous special-purpose allocation functions
(malloc_nogrow(), vip_io_request_malloc()).
* Moved the I/O VIP heap to heap.cpp accordingly.
* Added quite a bit of passing around of allocation flags in the VM,
particularly in the VM*AddressSpace classes.
* Fixed IOBuffer::GetNextVirtualVec(): It was ignoring the VIP flag and always
allocated on the normal heap.


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


# 891a50b2aed60e266dfe307945f3908312c1a61b 11-Oct-2009 Bruno G. Albuquerque <bga@bug-br.org.br>

- Fix typo that broke the GCC4 build but not the GCC2 build.



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


# 303727515e42bc166ac201aa89e62232232b2b8c 11-Oct-2009 Michael Lotz <mmlr@mlotz.ch>

Virtualize the buffers using IOBuffer::GetNextVirtualVec(). This removes the
need for the IO -> InternalIO indirection as it is always fed virtual buffers,
which simplifies things a bit.


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


# f3bd145c0942c6971e5fd89bb17a75541366f62a 10-Oct-2009 Michael Lotz <mmlr@mlotz.ch>

When the need for physical to virtual mapping arises because of emulating IO
reads or writes for old style drivers, map the physical memory at once. Since
USB is pretty much the only one affected and there small reads/writes are
exponentially slower, the performance gain of the burst transfer far outweighs
the additional overhead of the mapping. Still this could be further optimized
and will eventually be superseeded by also providing a physical memory API in
USB. For now it should bring back USB reads to an acceptable level. Writes are
still page wise though because of how writing back memory works in general.


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


# 230153f13391076fd23d5dd1ffa4a8e1ae2558df 02-Sep-2009 Michael Lotz <mmlr@mlotz.ch>

Reset the error variable to B_OK in case we want to continue after allocating
only some sub requests worked. Previously we would have simply canceled all
of the subrequests in the loop because we cancel after the first error.


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


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

* If the fs_io() hook failed, we need to check if the request has been notified
about it (there is also no public API to do that in the FS yet).
* This could have caused bug #2719, although the specific reason why the FS hook
failed remains unknown. At least it won't hang in this case anymore.


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


# eb2bd0e8e3689998717f91d8b9023296e3f32e78 27-Apr-2009 Stephan Aßmus <superstippi@gmx.de>

axeld:
* Implemented a way to do asynchronous pre-fetching when mapping files.
* There are slight code duplications in some places that could benefit
from cleaning up, but nothing too bad.
* Implementing smarter ways to trigger prefetching and more analysis of
the situations in the kernel would be nice. Currently up to 10 MB
of every mapped file are pre-fetched without further analysis.
* The speed improvement is nice for certain operations. On our test
system (real hardware), Firefox took 9 seconds from being launched
to display a window. Now it takes 5 seconds. Both measurements
right after booting. The same system took 35 seconds from launching
Haiku in the GRUB menu to displaying the Tracker desktop background
image. Now it takes 27 seconds.
* We didn't have the chance to check out the effects of this on the
CD boot, but potentially, they could speed it up a lot.


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


# 00405f2286fd370a0bd264d0bbac0cfa120e7646 09-Feb-2009 Michael Lotz <mmlr@mlotz.ch>

* Add an additional argument to get_vnode() that gets the fs_vnode_ops of the
node. That is needed for a layered filesystem to be able to construct a full
fs_vnode out of a volume/inode pair.
* Adapt places where get_vnode is used. Sadly this is a C API and we can't just
use a default NULL for that argument.
* Introduce a flag B_VNODE_WANTS_OVERLAY_SUB_NODE that can be returned in the
flags field of a fs get_vnode call. A filesystem can use this flag to indicate
that it doesn't support the full set of fs features (attributes, write support)
and it'd like to have unsupported calls emulated by an overlay sub node.
* Add a perliminary overlay filesystem that emulates file attributes using files
on a filesystem where attributes aren't supported. It does currently only
support reading attributes/attribute directories though. All other calls are
just passed through to the super filesystem.
* Adjust places where a HAS_FS_CALL() is taken as a guarantee that the operation
is supported. For the overlay filesystem we may later return a B_UNSUPPORTED,
so make sure that in that case proper fallback options are taken.
* Make the iso9660 filesystem request overlay sub nodes. This can be fine tuned
later to only trigger where there are features on a CD that need emulation
at all.

If you happened to know the attribute file format and location you could build
an iso with read-only attribute support now. Note that this won't be enough to
get a bootable iso-only image as the query and index support is yet missing.


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


# 47c40a10a10dc615e078754503f2c19b9f98c38d 19-Oct-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Prefixed memset_physical() and memcpy_to_physical() with "vm_",
added vm_memcpy_from_physical() and vm_memcpy_physical_page(), and
added respective functions to the vm_translation_map operations. The
architecture specific implementation can now decide how to implement
them most efficiently. Added generic implementations that can be used,
though.
* Changed vm_{get,put}_physical_page(). The former no longer accepts
flags (the only flag PHYSICAL_PAGE_DONT_WAIT wasn't needed anymore).
Instead it returns an implementation-specific handle that has to be
passed to the latter. Added vm_{get,put}_physical_page_current_cpu()
and *_debug() variants, that work only for the current CPU,
respectively when in the kernel debugger. Also adjusted the
vm_translation_map operations accordingly.
* Made consequent use of the physical memory operations in the source
tree.
* Also adjusted the m68k and ppc implementations with respect to the
vm_translation_map operation changes, but they are probably broken,
nevertheless.
* For x86 the generic physical page mapper isn't used anymore. It is
suboptimal in any case. For systems with small memory it is too much
overhead, since one can just map the complete physical memory (that's
not done yet, though). For systems with large memory it counteracts
the VM strategy to reuse the least recently used pages. Since those
pages will most likely not be mapped by the page mapper anymore, it
will keep remapping chunks. This was also the reason why building
Haiku in Haiku was significantly faster with only 256 MB RAM (since
that much could be kept mapped all the time).
Now we're using a different strategy: We have small pools of virtual
page slots per CPU that are used for the physical page operations
(memset_physical(), memcpy_*_physical()) with CPU-pinned thread.
Furthermore we have four slots per translation map, which are used to
map page tables.

These changes speed up the Haiku image build in Haiku significantly. On
my Core2 Duo 2.2 GHz 2 GB machine about 40% to 20 min 40 s (KDEBUG
disabled, block cache debug disabled). Still more than factor 3 slower
than FreeBSD and Linux, though.


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


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

* do_iterative_fd_io_iterate() must check for B_BUFFER_OVERFLOW to handle the
case it has to call the file map translation hook again to fulfill the whole
request; it already handled the partial case correctly.
* This fixes an occasional "Value too large" error when accesssing fragmented
files.


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


# 7a253cf5fe18658b881d2ad5da965dfb3d2c3bd5 20-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Since the file cache can access any kind of data (and not just file data),
we must use {read|write}_pages() instead of {read|write}().
* This should fix accessing other file systems than BFS (ie. those that doesn't
have an io() function) like ext3 and FAT.


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


# 663948966c47fdc1ef9df7a4592cfe0d40b91c0a 18-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added method vfs_asynchronous_write_pages(), which, unsurprisingly,
writes the given page iovecs asynchronously. The new class
AsyncIOCallback is used to inform the caller when the request has been
finished.


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


# 4141741265f09f90cbc37af0a7dd215cef94f63f 13-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added new(vip_io_alloc) operators allocating memory from the VIP I/O
heap.
* Allocate IOBuffers, IORequests, and cookies on the VIP I/O heap, if
necessary.


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


# be87a4934ebebaad6c595ffb7d9f848311a9993e 03-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

do_iterative_fd_io():
* When do_iterative_fd_io_iterate() fails, we must not invoke the
supplied finished hook explicitly, since it is invoked indirectly by
request->SetStatusAndNotify() anyway. Should fix #2557.
* We must detach the descriptor putter as soon as we have adjusted the
request's finished callback, since that will put the descriptor.


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


# 5054db1859039e8f86a723728f570ed32a47fe24 02-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Use vfs_vnode_io() to schedule subrequests instead of calling the FS's
io() hook directly (it might not even have one).
* Fixed incorrect check in synchronous_io() which would cause requests
with more than one vec to finish early. Fixes bug #2558.


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


# cfae07b6ac5571cdca26e35281cfd05c4edd7a52 28-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added kernel private vfs_vnode_io() which performs an io_request on a
vnode (falling back to synchronous I/O if the io() is not supported).


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


# ec598fe493579e3d522453cb407ca3c6b57d715a 27-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added FS interface hooks io() and cancel_io(). The former is supposed
to provide asynchrounous (or only synchronous, if asynchronous is not
supported) I/O request support. It will eventually replace
{read,write}_pages(). None of the FS implementations implement them
yet.
* Implemented some support functions for request-based I/O. File system
implementations can use do_fd_io() which passes an I/O request to the
layer responsible for a given FD, and do_iterative_fd_io(), which
translates a request for a file to subrequests for the underlying
device and passes them on. Both fall back to synchrounous processing
when the io() hook is not supported.
Furthermore added vfs_synchronous_io() which should be handy for the
devfs to perform io_requests synchronously for devices that don't
support the io() hook.


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