summaryrefslogtreecommitdiff
path: root/sys/kern/vfs_bio.c
AgeCommit message (Collapse)Author
2024-11-05Return the number of freed pages in bufbackoff().Martin Pieuchot
Reviewed by miod@, ok tb@, beck@
2024-02-03Remove Softdep.Bob Beck
Softdep has been a no-op for some time now, this removes it to get it out of the way. Flensing mostly done in Talinn, with some help from krw@ ok deraadt@
2023-04-26Fix splassert noticed by sthenBob Beck
Called wrong incore when not holding bio. ok claudio@
2023-04-24Remove recursive spl grabbing in vfs_bio.cBob Beck
in preparation for improvements. ok claudio@
2022-08-14remove unneeded includes in sys/kernJonathan Gray
ok mpi@ miod@
2022-08-12Put more struct vnode fields under splbio().Visa Hankala
Buffer cache related struct vnode fields can be accessed in interrupt context. Be more consistent with the use of splbio(). OK mpi@
2021-12-12Add vnode parameter to VOP_STRATEGY()Visa Hankala
Pass the device vnode as a parameter to VOP_STRATEGY() to allow calling the correct vop_strategy callback. Now the vnode is also available in the callback. OK mpi@
2021-09-05Introduce dummy pagers for 'special' subsystems using UVM objects.Martin Pieuchot
Some pmaps (x86, hppa) and the buffer cache rely on UVM objects to allocate and manipulate pages. These objects should not be manipulated by uvm_fault() and do not currently require the same locking enforcement. Use the dummy pagers to explicitly document which UVM functions are meant to manipulate UVM objects (uobj) that do not need the upcoming `vmobjlock' and instead still rely on the KERNEL_LOCK(). Tested by many as part of a larger diff. ok kettenis@, beck@
2021-06-16Change the prefix of UVM object functions to match NetBSD's.Martin Pieuchot
For example uvm_objinit() becomes uvm_obj_init(). Reduce differences between the trees and help porting new functions needed for UVM object locking. No functionnal change.
2021-03-10spellingJonathan Gray
ok gnezdo@ semarie@ mpi@
2020-10-05Fix write hang-up on file system on vnd.asou
ok beck@
2020-09-14add three static probes for vfs: cleaner, bufcache_take and bufcache_rel.Jasper Lievisse Adriaanse
while here, swap two lines in bufcache_release() to put a KASSERT() first following the pattern in bufcache_take() ok beck@ mpi@
2020-09-12Add a NULL check in bufbackoff so we don't die when passed a NULL pmem range.Bob Beck
Noticed by, and based on a diff from Mike Small <smallm@sdf.org>.
2020-07-14Do not convert the NOCACHE buffers that come from a vnd strategy routineBob Beck
into more delayed writes if the vnd is mounted from a file on an MNT_ASYNC filesystem. This prevents a situaiton where the cleaner can not clean delayed writes out without making more delayed writes, and we end up waiting for the syncer to spit things occasionaly when it runs. noticed and reported by sven falempin <sven.falempin@gmail.com> on tech, who validated this fixes his issue. ok krw@
2020-04-29Ensure that if we are doing a delayed write with a NOCACHE buffer, weBob Beck
clear the NOCACHE flag, since if we are doing a delayed write the buffer must be cached or it is thrown away when the "write" is done. fixes vnd on mfs regress tests. ok kettenis@ deraadt@
2020-03-12Revert previous. Something in it causes unexpected slowdown.Visa Hankala
2020-03-12Enable caching when turning a synchronous write into a delayed write.Visa Hankala
Otherwise the write will be discarded, which would prevent use of vnd(4) on top of an async-mounted file system. OK beck@
2020-03-04Make an assertion free from side effects. The intention was probably toanton
assert that the wire count is equal to 1 and not unconditionally set it to 1. ok kettenis@ mpi@
2020-01-26invert some if logic to shortcircuit some loops and reduce nesting.Ted Unangst
no function change.
2019-12-30clear B_NOCACHE if the buffer has dependencies for softdep, sinceBob Beck
otherwise we are guaranteed to panic a few lines down in softdep_deallocate_dependencies. Found by Matthias Pitzl <matthias_pitzl@genua.de> running vnd's on top of a softdep filesystem. ok bluhm@ deraadt@
2019-12-08Convert infinite sleeps to tsleep_nsec(9).Martin Pieuchot
ok visa@, jca@
2019-11-29Re commit what was committed in version 1.43 with a fix added toBob Beck
ensure we handle the uvm_objects of bread_cluster buffers correctly. Original commit message: Fix the buffer cache code to not use a giant uvm obj of all pages when a small one on each buf is all that is needed. reduces the cost of large frees by about 25%. Again, lots of assistence from kettenis and mlarkin still ok kettenis@
2019-11-15Fix a spelling error in a comment and remove some extra whitespaceMike Larkin
in a few places. No code change.
2019-07-19getblk(9): tsleep(9) -> tsleep_nsec(9); ok visa@cheloha
2019-05-09Don't unconditionally throw away dma memory when we don't need to.Bob Beck
Noticed by me and otto@ ok tedu@
2019-05-08Modify the buffer cache to always flip recovered DMA buffers high.Bob Beck
This also modifies the backoff logic to only back off what is requested and not a "mimimum" amount. Tested by me, benno@, tedu@ anda ports build by naddy@. ok tedu@
2019-02-17if a write fails, we mark the buffer invalid and throw it away. this canTed Unangst
lead to lost errors, where a later fsync will return success. to fix this, set a flag on the vnode indicating a past error has occurred, and return an error for future fsync calls. ok bluhm deraadt visa
2018-11-21free(9) sizes for bread_cluser().Martin Pieuchot
ok mikeb@, visa@
2018-08-13Simplify the startup of the cleaner, reaper and update threads byVisa Hankala
passing the main function directly to kthread_create(9). The start_* functions are mere stepping stones nowadays and can be pruned. They used to contain more logic in the pre-kthread era. While here, set `cleanerproc' and `syncerproc' during the thread creation rather than expect the threads to set the proc pointer. Also, rename `sched_sync' to `syncer_thread' to reduce confusion with the scheduler-related functions. OK kettenis@, deraadt@, mpi@
2017-08-27Revisit 2q queue sizes. Limit the hot queue to 1/20th the cache size upBob Beck
to a max of 4096 pages. Limit the warm and cold queues to half the cache. This allows us to more effectively notice re-interest in buffers instead of losing it in a large hot queue. Discussed and shown with claudio@ and benno@ at tk217
2017-08-22Add some buffercache docsStefan Fritsch
* add clarifications and bread_cluster() buffercache(9) * add some comments to vfs_bio.c ok tedu@
2017-07-12Invalidate read-ahead buffers when read shortMike Belopuhov
Buffercache performs read-ahead for cluster reads by extending the length of an original read operation to the MAXPHYS (64k). Upon I/O completion, the length is trimmed and the buffer is returned to the filesystem and the remaining data is cached. However, under certain circumstances, the underlying hardware may fail to do a complete I/O operation and return with a non- zero value of the residual length (i.e. data that wasn't read). The residual length may exceed the size of an original request and must be re-adjusted to uphold the contract with the caller, e.g. the filesystem. At the same time, read-ahead buffers that cover chunks of memory corresponding to the residual length must be invalidated and not cached. Discussed at length during d2k17, ok tedu
2017-04-18ensure the buffer cache backs off all the way with the correct typeBob Beck
of memory, handling the fact that both queues are actually in dma space when not flipping buffers high
2017-04-16Flip previously warm pages in the buffer cache to memory above the DMABob Beck
region if uvm tells us it is available. nits from deraadt@ ok krw@ guenther@ kettenis@
2017-02-28Switch geteblks()'s size argument from int to size_t. It's called withMartin Natano
unsigned variables as argument in most places anyway. Decrease the chance of signedness/range mismatch issues. ok stefan
2017-02-14Convert most of the manual checks for CPU hogging to sched_pause().Martin Pieuchot
The distinction between preempt() and yield() stays as it is usueful to know if a thread decided to yield by itself or if the kernel told him to go away. ok tedu@, guenther@
2016-09-16move buf_rb_bufs from RB macros to RBT functionsDavid Gwynne
i had to shuffle the order of some header bits cos RBT_PROTOTYPE needs to see what RBT_HEAD produces.
2016-09-15all pools have their ipl set via pool_setipl, so fold it into pool_init.David Gwynne
the ioff argument to pool_init() is unused and has been for many years, so this replaces it with an ipl argument. because the ipl will be set on init we no longer need pool_setipl. most of these changes have been done with coccinelle using the spatch below. cocci sucks at formatting code though, so i fixed that by hand. the manpage and subr_pool.c bits i did myself. ok tedu@ jmatthew@ @ipl@ expression pp; expression ipl; expression s, a, o, f, m, p; @@ -pool_init(pp, s, a, o, f, m, p); -pool_setipl(pp, ipl); +pool_init(pp, s, a, ipl, f, m, p);
2016-09-04Remove support for tape block devices. Nobody mount(8)s tapes any longer.Christian Weisgerber
ok deraadt@ guenther@
2016-06-07per trending style, add continue to empty loops.Ted Unangst
ok mglocker
2016-03-17- add realloc_pages to move a buffer's physmem from one range to another.Bob Beck
- modify B_DMA handling to be in vfs_biomem.c - change buffer allocation to try allocations with NOWAIT and to throw away clean pages if allocation fails - allocate with WAITOK only if you can't throw away enough pages to succeed "probably sound" deraadt@
2016-03-10Start some refactoring in here. this gets bufadjust outBob Beck
of the hibernate path and starts preparing for some other work in here
2016-03-06Do not fetch the same block multiple times if it is already presentMartin Pieuchot
in the buffer cache. When the Dynamic Buffer Cache has been introduced bread_cluster() became the replacement of cluster_read(). However this function did not consider the B_CACHE flag of the first buffer of a cluster like its predecessor did. This improves a lot read operations on MSDOSFS while reducing the number of DMA operations. ok beck@
2015-11-28move buffer size adjustment to buf_adjcnt - from Walter NetoBob Beck
ok mpi@
2015-07-19Use two 2q caches for the buffer cache, moving previously warm buffers from theBob Beck
first queue to the second. Mark the first queue as DMA in preparation for being able to use more memory by flipping. Flipper code currently only sets and clears the flag. ok tedu@ guenther@
2015-03-14Remove some includes include-what-you-use claims don'tJonathan Gray
have any direct symbols used. Tested for indirect use by compiling amd64/i386/sparc64 kernels. ok tedu@ deraadt@
2015-02-07Introduce VM_KERNEL_SPACE_SIZE as a replacement forMiod Vallat
(VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS). This will allow these to no longer be constants in the future. ok guenther@
2015-01-18Revert 1.166 (but keep the bufq_wait() interface change), for this is wrongMiod Vallat
and the bufq pointer might be NULL at the time it is `saved'. Found the hard way on sparc due to the limited kva, with all disk active processes ending up sleeping on "buf_needva". ok kettenis@ krw@
2015-01-09save the bufq pointer from the buf before we turn it loose so it won'tTed Unangst
change on us. also, remove unused second arg to bufq_wait. from pedro at bitrig via david hill. ok beck kettenis
2014-12-16primary change: move uvm_vnode out of vnode, keeping only a pointer.Ted Unangst
objective: vnode.h doesn't include uvm_extern.h anymore. followup changes: include uvm_extern.h or lock.h where necessary. ok and help from deraadt