History log of /haiku/src/tools/fs_shell/file_cache.cpp
Revision Date Author Comments
# 425ac1b6 20-Jun-2023 Alexander von Gluck IV <kallisti5@unixzen.com>

refactor: Swap %Ld for %lld in all format usages

* %Ld is an undocumented alias for %lld in glibc.
* muslc doesn't implement it for this reason.
* While we will likely never drop %Ld support,
lets clean house and set a better example.

Change-Id: Id46dad3104abae483e80cc5c05d1464d3ecd8030
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6636
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>


# 846b2f90 06-Jul-2012 Axel Dörfler <axeld@ibm.kiwi>

Changed the kernel's file_map.cpp to be usable from the fs_shell as well.

* This should reduce our maintenance burden a tiny bit :-)
* It also fixes a bug in the fs_shell, see hrev43395.


# 386be45a 24-May-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Fixed 64 bit warnings.


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


# cf844822 24-Nov-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added B_PRIdTIME and B_PRIiTIME macros (for time_t).
* Added FSSH_[S]SIZE_MAX to headers/private/fs_shell/fssh_types.h.
* Fixed various 64 bit compiler warnings. Nothing too serious, though.


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


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

* Added file_cache_is_enabled() function.
* Added file_map_set_mode() function that you can use to keep a whole file
cached. This is needed for the swap file support: FILE_MAP_CACHE_ALL will
not only precache all file_io_vecs when called, but it will also cause all
file_map_translate() calls to fail that would require further caching (ie.
if the file size had changed).
* Updated the fs_shell file map code to the latest one (with several bug fixes).


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


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

Added functions file_cache_{disable,enable}(). They allow to disable
actual caching in the file cache, i.e. all reads and writes go directly
to the underlying device. The implementation is not quite complete,
since the VM can still add pages to the cache when the file is mmap()ed,
which can lead to inconsistencies.


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


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

* bfs_fsync() was the only place which could cause the
fs_vnode_ops::write_pages() to be called with fsReenter = true. Since
this is no longer the case, the argument has become superfluous. For
read_pages() it always was. Removed the argument from the functions
and all functions that propagated it.
* Some whitespace at the end of lines was removed.


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


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

* Made the private kernel locking primitives available to file systems as well.
* Applied Korli's mutex_unlock() fix to block_cache.cpp.
* Removed block_cache_priv.h, as it's no longer needed (moved its definitions
into block_cache.cpp, as in the kernel file).


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


# 87aa1668 06-Jan-2008 Axel Dörfler <axeld@pinc-software.de>

* The file_map constructor would not set the size of the file_map object,
causing all reads with an offset unequal to 0 to fail.
* Also fixed file_map_translate() which was hiding this problem.
* Fixed build and warnings when compiled with debugging output.


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


# d0007186 26-Nov-2007 Axel Dörfler <axeld@pinc-software.de>

The fs_shell cache implementation had the same problem as our real cache
until r22998 - but since this was the only implementation, its consequences
were much more likely.


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


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

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


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


# 417f276c 04-Oct-2007 Axel Dörfler <axeld@pinc-software.de>

Forgot to commit the fs_shell with r22434, thanks for the note, Stefano!


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


# 84498b0d 02-May-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

Incorrect vfs_put_vnode(). Missed that one when changing from
vfs_get_vnode() to vfs_lookup_vnode().


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


# c94089f5 28-Apr-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

Use vfs_lookup_vnode() instead of vfs_get_vnode() when creating a file
cache, so we don't run into a "vnode ... is not becoming unbusy"
problem.


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


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

Beginnings of a new, better portable FS shell with Haiku FS interface.
Doesn't do anything ATM, but already provides the required system
interface (VFS, caches, POSIX functions).


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


# 846b2f90f670827f5ddc6b22772ffb0038c70745 06-Jul-2012 Axel Dörfler <axeld@ibm.kiwi>

Changed the kernel's file_map.cpp to be usable from the fs_shell as well.

* This should reduce our maintenance burden a tiny bit :-)
* It also fixes a bug in the fs_shell, see hrev43395.


# 386be45abcfda37fcb4f30a664150430dac19aac 24-May-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Fixed 64 bit warnings.


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


# cf844822db58eed3db11f93243e38503eb1a4b91 24-Nov-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added B_PRIdTIME and B_PRIiTIME macros (for time_t).
* Added FSSH_[S]SIZE_MAX to headers/private/fs_shell/fssh_types.h.
* Fixed various 64 bit compiler warnings. Nothing too serious, though.


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


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

* Added file_cache_is_enabled() function.
* Added file_map_set_mode() function that you can use to keep a whole file
cached. This is needed for the swap file support: FILE_MAP_CACHE_ALL will
not only precache all file_io_vecs when called, but it will also cause all
file_map_translate() calls to fail that would require further caching (ie.
if the file size had changed).
* Updated the fs_shell file map code to the latest one (with several bug fixes).


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


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

Added functions file_cache_{disable,enable}(). They allow to disable
actual caching in the file cache, i.e. all reads and writes go directly
to the underlying device. The implementation is not quite complete,
since the VM can still add pages to the cache when the file is mmap()ed,
which can lead to inconsistencies.


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


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

* bfs_fsync() was the only place which could cause the
fs_vnode_ops::write_pages() to be called with fsReenter = true. Since
this is no longer the case, the argument has become superfluous. For
read_pages() it always was. Removed the argument from the functions
and all functions that propagated it.
* Some whitespace at the end of lines was removed.


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


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

* Made the private kernel locking primitives available to file systems as well.
* Applied Korli's mutex_unlock() fix to block_cache.cpp.
* Removed block_cache_priv.h, as it's no longer needed (moved its definitions
into block_cache.cpp, as in the kernel file).


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


# 87aa1668c9eab80ebfc9e9a510a28f8786c57403 06-Jan-2008 Axel Dörfler <axeld@pinc-software.de>

* The file_map constructor would not set the size of the file_map object,
causing all reads with an offset unequal to 0 to fail.
* Also fixed file_map_translate() which was hiding this problem.
* Fixed build and warnings when compiled with debugging output.


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


# d0007186e5821d622d11bfce95d6db3ac04fd14c 26-Nov-2007 Axel Dörfler <axeld@pinc-software.de>

The fs_shell cache implementation had the same problem as our real cache
until r22998 - but since this was the only implementation, its consequences
were much more likely.


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


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

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


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


# 417f276c05ea693ad26aa7c1357832ec414ebaf4 04-Oct-2007 Axel Dörfler <axeld@pinc-software.de>

Forgot to commit the fs_shell with r22434, thanks for the note, Stefano!


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


# 84498b0ddc399a32a1b1a61ddc847ba16b75e23e 02-May-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

Incorrect vfs_put_vnode(). Missed that one when changing from
vfs_get_vnode() to vfs_lookup_vnode().


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


# c94089f5db1086061d49cbcfc384a799e6009959 28-Apr-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

Use vfs_lookup_vnode() instead of vfs_get_vnode() when creating a file
cache, so we don't run into a "vnode ... is not becoming unbusy"
problem.


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


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

Beginnings of a new, better portable FS shell with Haiku FS interface.
Doesn't do anything ATM, but already provides the required system
interface (VFS, caches, POSIX functions).


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