summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_subr.c
Commit message (Collapse)AuthorAgeFilesLines
* More style fixes.kan2004-01-051-15/+13
| | | | Obtained from: bde
* style(9):kan2004-01-051-236/+266
| | | | | | | | | | | Add empty line before first code line in functions with no local variables. Properly terminate comment sentences. Indent lines which are longer that 80 characters. Move v_addpollinfo closer to the rest of poll-related functions. Move DEBUG_VFS_LOCKS ifdefed block to the end of file. Obtained from: bde (partly)
* Cosmetics: strip '\n' from a string passed to Debugger().kan2004-01-041-2/+2
|
* v_vxproc was a bogus name for a thread (pointer).bde2003-12-281-3/+3
|
* - In vget() if LK_NOWAIT is specified we should return EBUSY and not ENOENT.jeff2003-12-161-3/+4
| | | | Submitted by: Stephan Uphoff <ups@stups.com>
* - When doing a forced unmount, VFS attempts to keep VCHR vnodes valid byjeff2003-12-161-1/+28
| | | | | | | | reassigning their v_ops field to specfs, detaching from the mountpoint, etc. However, this is not sufficient. If we vclean() the vnode the pages owned by the vnode are lost, potentially while buffers reference them. Implement parts of vclean() seperately in vgonechrl() so that the pages and bufs associated with a device vnode are not destroyed while in use.
* - Don't forget to unlock the vnode interlock in the LK_NOWAIT case.jeff2003-11-301-1/+2
| | | | | Submitted by: Stephan Uphoff <ups@stups.com> Approved by: re (rwatson)
* - Implement selwakeuppri() which allows raising the priority of atanimura2003-11-091-2/+2
| | | | | | | | | | | | | thread being waken up. The thread waken up can run at a priority as high as after tsleep(). - Replace selwakeup()s with selwakeuppri()s and pass appropriate priorities. - Add cv_broadcastpri() which raises the priority of the broadcast threads. Used by selwakeuppri() if collision occurs. Not objected in: -arch, -current
* Remove mntvnode_mtx and replace it with per-mountpoint mutex.kan2003-11-051-25/+26
| | | | | | | | | | Introduce two new macros MNT_ILOCK(mp)/MNT_IUNLOCK(mp) to operate on this mutex transparently. Eventually new mutex will be protecting more fields in struct mount, not only vnode list. Discussed with: jeff
* Add appropriate const poisoning to the assert_*locked() family so that I canwollman2003-10-231-8/+8
| | | | | | call ASSERT_VOP_LOCKED(vp, __func__) without a diagnostic. Inspired by: the evil and rude OpenAFS cache manager code
* Initialize the buf's b_object in pbgetvp(). Clear it in pbrelvp(). (Thisalc2003-10-201-0/+2
| | | | | | | facilitates synchronization of the vm page's valid field using the vm object's lock.) Suggested by: tegge
* Simplify count_dev()phk2003-10-171-5/+5
|
* Simplify vn_isdisk() a bit.phk2003-10-121-24/+10
|
* - Fix a typo, I meant & and not |. This was causing lockups from the syncerjeff2003-10-111-1/+1
| | | | | | looping forever due to list corruption. Solved by: tegge
* - Fix an XXX. Check the error of vn_lock() in vflush(). Don't specifyjeff2003-10-051-13/+2
| | | | | | LK_RETRY either, we don't want this vnode if it turns into another. - Remove the code that checks the mount point after acquiring the lock we are guaranteed to either fail or get the vnode that we wanted.
* - Rename vcanrecycle() to vtryrecycle() to reflect its new role.jeff2003-10-051-26/+32
| | | | | | | | | | | | | | | | | - In vtryrecycle() try to vgonel the vnode if all of the previous checks passed. We won't vgonel if someone has either acquired a hold or usecount or started the vgone process elsewhere. This is because we may have been removed from the free list while we were inspecting the vnode for recycling. - The VI_TRYLOCK stops two threads from entering getnewvnode() and recycling the same vnode. To further reduce the likelyhood of this event, requeue the vnode on the tail of the list prior to calling vtryrecycle(). We can not actually remove the vnode from the list until we know that it's going to be recycled because other interlock holders may see the VI_FREE flag and try to remove it from the free list. - Kill a bogus XXX comment. If XLOCK is set we shouldn't wait for it regardless of MNT_WAIT because the vnode does not actually belong to this filesystem.
* - Don't cache_purge() in getnewvnode. It's done in vclean(). With thisjeff2003-10-051-11/+5
| | | | | | | purge, the purge in vclean, and the filesystems purge, we had 3 purges per vnode. - Move the insmntque(vp, 0) to vclean() so that we may remove it from the two vgone() functions and reduce the number of lock operations required.
* - Solve a LOR with the sync_mtx by using the VI_ONWORKLST flag to determinejeff2003-10-051-6/+12
| | | | | | | | | | whether or not the sync failed. This could potentially get set between the time that we VOP_UNLOCK and VI_LOCK() but the race would harmelssly lead to the sync being delayed by an extra 30 seconds. If we do not move the vnode it could cause an endless loop if it continues to fail to sync. - Use vhold and vdrop to stop the vnode from changing identities while we have it unlocked. Other internal vfs lists are likely to follow this scheme.
* - Move the xlock 'locking' code into vx_lock() and vx_unlock().jeff2003-10-051-21/+54
| | | | | | | | | | - Create a new function, vgonechrl(), which performs vgone for an in-use character device. Move the code from vflush() that did this into vgonechrl(). - Hold the xlock across the entirety of vgonel() and vgonechrl() so that at no point will an invalid vnode exist on any list without XLOCK set. - Move the xlock code out of vclean() now that it is in the vgone*() functions.
* - In sched_sync() test our preconditions prior to dropping the sync_mtx.jeff2003-10-041-22/+18
| | | | | | | | | | | This is so that we may grab the interlock while still holding the sync_mtx. We have to VI_TRYLOCK() because in all other cases the lock order runs the other way. - If we don't meet any of the preconditions, reinsert the vp into the list for the next second. - We don't need to panic if we fail to sync here because each FSYNC function handles this case. Removing this redundant code also simplifies locking.
* - In a Giantless world, the vn_lock() in vcanrecycle() could legitimatelyjeff2003-10-041-21/+22
| | | | | | | | | | | | | | fail. Remove the panic from that case and document why it might fail. - Document the reason for calling cache_purge() on a newly created vnode. - In insmntque() order the operations so that we can call mtx_unlock() one fewer times. This makes the code somewhat clearer as well. - Add XXX comments in sched_sync() and vflush(). - In vget(), do not sleep while waiting for XLOCK to clear if LK_NOWAIT is set. - In vclean() we don't need to acquire a lock around a single TAILQ_FIRST call. It's ok if we race here, the vinvalbuf will just do nothing. - Increase the scope of the lock in vgonel() to reduce the number of lock operations that are performed.
* - In reassignbuf() don't unlock vp and lock newvp if they are the same.jeff2003-09-201-6/+11
| | | | | | | | Doing so creates a race where the buf is on neither list. - Only vfree() in an error case in vclean() if VSHOULDFREE() thinks we should. - Convert the error case in vclean() to INVARIANTS from DIAGNOSTIC as this really should not happen and is fast to check.
* - Remove spls(). The locking that has replaced them is in place and theyjeff2003-09-191-62/+6
| | | | no longer serve as guidelines for future work.
* Eliminate one case of VI_UNLOCK followed by an immediatekan2003-09-191-3/+2
| | | | VI_LOCK.
* Consistently use the BSD u_int and u_short instead of the SYSV uint andjhb2003-08-071-1/+1
| | | | | | | ushort. In most of these files, there was a mixture of both styles and this change just makes them self-consistent. Requested by: bde (kern_ktrace.c)
* Revert stuff which accidentally ended up in the previous commit.phk2003-07-221-7/+8
|
* Don't attempt to inline large functions mb_alloc() and mb_free(),phk2003-07-221-8/+7
| | | | | | it more than doubles the text size of this file. GCC has wisely ignored us on this previously
* Use __FBSDID().obrien2003-06-111-1/+4
|
* Remove unused variable and now unbalanced call to splbio();phk2003-05-311-2/+0
| | | | Found by: FlexeLint
* Make the maximum number of vnodes a function of both the physical memoryalc2003-05-231-1/+10
| | | | | | | | | | | | | | | | | size and the kernel's heap size, specifically, vm_kmem_size. This function allows a maximum of 40% of the vm_kmem_size to be used for vnodes and vm objects. This is a conservative bound based upon recent problem reports. (In other words, a slight increase in this percentage may be safe.) Finally, machines with less than ~3GB of RAM should be unaffected by this change, i.e., the maximum number of vnodes should remain the same. If necessary, machines with 3GB or more of RAM can increase the maximum number of vnodes by increasing vm_kmem_size. Desired by: scottl Tested by: jake Approved by: re (rwatson,scottl)
* Detect that a vnode has been reclaimed while vflush() was waiting to locktruckman2003-05-161-0/+11
| | | | | | | | | the vnode and restart the loop. Vflush() is vulnerable since it does not hold a reference to the vnode and it holds no other locks while waiting for the vnode lock. The vnode will no longer be on the list when the loop is restarted. Approved by: re (rwatson)
* Optimize the use of splay in gbincore(). During a "make buildworld" thealc2003-05-131-7/+22
| | | | | | | | desired buffer is found at one of the roots more than 60% of the time. Thus, checking both roots before performing either splay eliminates unnecessary splays on the first tree splayed. Approved by: re (jhb)
* Remove bogus locking from DDB's "show lockedvnods" command: usingrwatson2003-05-121-11/+7
| | | | | | | | | | | | | synchronization primitives from inside DDB is generally a bad idea, and in this case it frequently results in panics due to DDB commands being executed from the sio fast interrupt context on a serial console. Replace the locking with a note that a lack of locking means that DDB may get see inconsistent views of the mount and vnode lists, which could also result in a panic. More frequently, though, this avoids a panic than causes it. Discussed with ages ago: bde Approved by: re (scottl)
* - Revert kern/vfs_subr.c revision 1.444. The vm_object's size isn'talc2003-05-031-1/+1
| | | | | | | | | trustworthy for vnode-backed objects. - Restore the old behavior of vm_object_page_remove() when the end of the given range is zero. Add a comment to vm_object_page_remove() regarding this behavior. Reported by: iedowse
* Lock accesses to the vm_object's ref_count and resident_page_count.alc2003-05-011-5/+9
|
* Various changes to vm_object_page_remove():alc2003-04-261-1/+1
| | | | | | | | | | - Eliminate an odd, special-case feature: if start == end == 0 then all pages are removed. Only one caller used this feature and that caller can trivially pass the object's size. - Assert that the vm_object is locked on entry; don't bother testing for a NULL vm_object. - Style: Fix lines that are longer than 80 characters.
* - Convert vm_object_pip_wait() from using tsleep() to msleep().alc2003-04-261-0/+2
| | | | | - Make vm_object_pip_sleep() static. - Lock the vm_object when performing vm_object_pip_wait().
* - Acquire the vm_object's lock when performing vm_object_page_clean().alc2003-04-241-0/+2
| | | | | | - Add a parameter to vm_pageout_flush() that tells vm_pageout_flush() whether its caller has locked the vm_object. (This is a temporary measure to bootstrap vm_object locking.)
* Update locking around vm_object_page_remove() to use the new macros.alc2003-04-181-2/+2
|
* Use vm_object_pip_wait() rather than reimplementing it.alc2003-04-131-2/+1
|
* Adjust the number of vnodes scanned by vlrureclaim() according to thetegge2003-03-261-8/+11
| | | | size of the vnode list.
* We shouldn't assert that a vode is locked in vop_lock_post()yar2003-03-221-1/+2
| | | | | | if VOP_LOCK() has failed. Reviewed by: jeff
* - Remove a dead check for bp->b_vp == vp in vtruncbuf(). This has not beenjeff2003-03-131-14/+17
| | | | | | | possible for some time. - Lock the buf before accessing fields. This should very rarely be locked. - Assert that B_DELWRI is set after we acquire the buf. This should always be the case now.
* - Remove a race between fsync like functions and flushbufqueues() byjeff2003-03-131-1/+0
| | | | | | | | | | | requiring locked bufs in vfs_bio_awrite(). Previously the buf could have been written out by fsync before we acquired the buf lock if it weren't for giant. The cluster_wbuild() handles this race properly but the single write at the end of vfs_bio_awrite() would not. - Modify flushbufqueues() so there is only one copy of the loop. Pass a parameter in that says whether or not we should sync bufs with deps. - Call flushbufqueues() a second time and then break if we couldn't find any bufs without deps.
* Remove ENABLE_VFS_IOOPT. It is a long unfinished work-in-progress.alc2003-03-061-6/+0
| | | | Discussed on: arch@
* Finish cleanup of vprint() which was begun with changing v_tag to a string.njl2003-03-031-25/+3
| | | | | | Remove extraneous uses of vop_null, instead defering to the default op. Rename vnode type "vfs" to the more descriptive "syncer". Fix formatting for various filesystems that use vop_print.
* - Hold the vnode interlock across calls to bgetvp instead of acquiring itjeff2003-03-021-2/+1
| | | | | internally. This is required to stop multiple bufs from being associated with a single lblkno.
* - gc USE_BUFHASH. The smp locking of the buf cache renders this useless.jeff2003-03-011-4/+0
|
* Prevent large files from monopolizing the system buffers. Keepmckusick2003-02-251-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | track of the number of dirty buffers held by a vnode. When a bdwrite is done on a buffer, check the existing number of dirty buffers associated with its vnode. If the number rises above vfs.dirtybufthresh (currently 90% of vfs.hidirtybuffers), one of the other (hopefully older) dirty buffers associated with the vnode is written (using bawrite). In the event that this approach fails to curb the growth in it the vnode's number of dirty buffers (due to soft updates rollback dependencies), the more drastic approach of doing a VOP_FSYNC on the vnode is used. This code primarily affects very large and actively written files such as snapshots. This change should eliminate hanging when taking snapshots or doing background fsck on very large filesystems. Hopefully, one day it will be possible to cache filesystem metadata in the VM cache as is done with file data. As it stands, only the buffer cache can be used which limits total metadata storage to about 20Mb no matter how much memory is available on the system. This rather small memory gets badly thrashed causing a lot of extra I/O. For example, taking a snapshot of a 1Tb filesystem minimally requires about 35,000 write operations, but because of the cache thrashing (we only have about 350 buffers at our disposal) ends up doing about 237,540 I/O's thus taking twenty-five minutes instead of four if it could run entirely in the cache. Reported by: Attila Nagy <bra@fsn.hu> Sponsored by: DARPA & NAI Labs.
* - Add an interlock argument to BUF_LOCK and BUF_TIMELOCK.jeff2003-02-251-41/+34
| | | | | | | | | | - Remove the buftimelock mutex and acquire the buf's interlock to protect these fields instead. - Hold the vnode interlock while locking bufs on the clean/dirty queues. This reduces some cases from one BUF_LOCK with a LK_NOWAIT and another BUF_LOCK with a LK_TIMEFAIL to a single lock. Reviewed by: arch, mckusick
OpenPOWER on IntegriCloud