summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_subr.c
Commit message (Collapse)AuthorAgeFilesLines
...
* - Instead of waiting forever to get a vnode in getnewvnode() wait forjeff2005-04-041-1/+3
| | | | | | | | | | one to become available for one second and then return ENFILE. We can run out of vnodes, and there must be a hard limit because without one we can quickly run out of KVA on x86. Presently the system can deadlock if there are maxvnodes directories in the namecache. The original 4.x BSD behavior was to return ENFILE if we reached the max, but 4.x BSD did not have the vnlru proc so it was less profitable to wait.
* - Disable vfs shared locks by default. They must be specifically enabledjeff2005-03-311-1/+5
| | | | | | | on filesystems which safely support them. It appears that many network filesystems specifically are not shared lock safe. Sponsored by: Isilon Systems, Inc.
* - LK_NOPAUSE is a nop now.jeff2005-03-311-2/+2
| | | | Sponsored by: Isilon Systems, Inc.
* Eliminate v_id and v_ddid. The name cache now holds references todas2005-03-301-2/+1
| | | | | | | | | | vnodes whose names it caches, so we no longer need a `generation number' to tell us if a referenced vnode is invalid. Replace the use of the parent's v_id in the hash function with the address of the parent vnode. Tested by: Peter Holm Glanced at by: jeff, phk
* - Dont clear OWEINACT in vbusy(), we still owe an inactive call if someonejeff2005-03-291-11/+16
| | | | | | | | | | vhold()s us. - Avoid an extra mutex acquire and release in the common case of vgonel() by checking for OWEINACT at the start of the function. - Fix the case where we set OWEINACT in vput(). LK_EXCLUPGRADE drops our shared lock if it fails. Sponsored by: Isilon Systems, Inc.
* - Don't initial v_dd here, let cache_purge() do it for us.jeff2005-03-291-1/+0
| | | | Sponsored by: Isilon Systems, Inc.
* - Move code that should probably be an assert above the main body ofjeff2005-03-281-15/+14
| | | | | | | vrele so that we can decrease the indentation of the real work and make things slightly more clear. Sponsored by: Isilon Systems, Inc.
* - Adjust asserts in vop_lookup_post() to match the new post PDIRUNLOCKjeff2005-03-281-11/+8
| | | | | | vfs. Sponsored by: Isilon Systems, Inc.
* Remove another ';' after if().phk2005-03-271-1/+1
| | | | Also spotted by: bz
* Remove extra ; at end of if().phk2005-03-271-1/+1
| | | | Found by: bz
* - Don't recycle vnodes anymore. Free them once they are dead. getnewvnodejeff2005-03-251-121/+116
| | | | | | | | | | | | | | | | now always allocates a new vnode. - Define a new function, vnlru_free, which frees vnodes from the free list. It takes as a parameter the number of vnodes to free, which is wantfreevnodes - freevnodes when called from vnlru_proc or 1 when called from getnewvnode(). For now, getnewvnode() still tries to reclaim a free vnode before creating a new one when we are near the limit. - Define a function, vdestroy, which handles the actual release of memory and teardown of locks, etc. This could become a uma_dtor() routine. - Get rid of minvnodes. Now wantfreevnodes is 1/4th the max vnodes. This keeps more unreferenced vnodes around so that files which have only been stat'd are less likely to be kicked out of the system before we have a chance to read them, etc. These vnodes may still be freed via the normal vnlru_proc() routines which may some day become a real lru.
* - Pass LK_EXCLUSIVE to VFS_ROOT() to satisfy the new flags argument. Forjeff2005-03-241-1/+1
| | | | | | now, all calls to VFS_ROOT() should still acquire exclusive locks. Sponsored by: Isilon Systems, Inc.
* - If vput() is called with a shared lock it must upgrade to an exclusivejeff2005-03-241-3/+12
| | | | | | | | | | | before it can call VOP_INACTIVE(). This must use the EXCLUPGRADE path because we may violate some lock order with another locked vnode if we drop and reacquire the lock. If EXCLUPGRADE fails, we mark the vnode with VI_OWEINACT. This case should be very rare. - Clear VI_OWEINACT in vinactive() and vbusy(). - If VI_OWEINACT is set in vgone() do the VOP_INACTIVE call here as well. Sponsored by: Isilon Systems, Inc.
* - Now that there are no external users of vfree() make it static.jeff2005-03-151-48/+12
| | | | | | | | | | | | | | | | - Move VSHOULDBUSY, VSHOULDFREE, and VTRYRECYCLE into vfs_subr.c so no one else attempts to grow a dependency on them. - Now that objects with pages hold the vnode we don't have to do unlocked checks for the page count in the vm object in VSHOULDFREE. These three macros could simply check for holdcnt state transitions to determine whether the vnode is on the free list already, but the extra safety the flag affords us is probably worth the minimal cost. - The leafonly sysctl and code have been dead for several years now, remove the sysctl and the code that employed it from vtryrecycle(). - vtryrecycle() also no longer has to check the object's page count as the object holds the vnode until it reaches 0. Sponsored by: Isilon Systems, Inc.
* - Expose vholdl() so it may be used outside of vfs_subr.cjeff2005-03-151-2/+1
|
* - Increment the holdcnt once for each usecount reference. This allows usjeff2005-03-141-3/+4
| | | | | | | to use only the holdcnt to determine whether a vnode may be recycled, simplifying the V* macros as well as vtryrecycle(), etc. Sponsored by: Isilon Systems, Inc.
* - We do not have to check the object's ref_count in VSHOULDFREE orjeff2005-03-141-3/+3
| | | | | | | | vtryrecycle(). All obj refs also ref the vnode. - Consistently use v_incr_usecount() to increment the usecount. This will be more important later. Sponsored by: Isilon Systems, Inc.
* - Slightly rearrange vrele() to move the common case in one indentationjeff2005-03-141-20/+17
| | | | | | level. Sponsored by: Isilon Systems, Inc.
* - Rework vget() so we drop the usecount in two failure cases that werejeff2005-03-141-24/+24
| | | | | | missed by my last commit. Sponsored by: Isilon Systems, Inc.
* - Remove vx_lock, vx_unlock, vx_wait, etc.jeff2005-03-131-225/+129
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Add a vn_start_write/vn_finished_write around vlrureclaim so we don't do writing ops without suspending. This could suspend the vlruproc which should not be a problem under normal circumstances. - Manually implement VMIGHTFREE in vlrureclaim as this was the only instance where it was used. - Acquire a lock before calling vgone() as it now requires it. - Move the acquisition of the vnode interlock from vtryrecycle() to getnewvnode() so that if it fails we don't drop and reacquire the vnode_free_list_mtx. - Check for a usecount or holdcount at the end of vtryrecycle() in case someone grabbed a ref while we were recycling. Abort the recycle, and on the final ref drop this vnode will be placed on the head of the free list. - Move the redundant VOP_INACTIVE protection code into the local vinactive() routine to avoid code bloat. - Keep the vnode lock held across calls to vgone() in several places. - vgonel() no longer uses XLOCK, instead callers must hold an exclusive vnode lock. The VI_DOOMED flag is set to allow other threads to detect a vnode which is no longer valid. This flag is set until the last reference is gone, and there are no chances for a new ref. vgonel() holds this lock across the entire function, which greatly simplifies logic. _ Only vfree() in one place in vgone() not three. - Adjust vget() to check the VI_DOOMED flag prior to waiting on the lock in the LK_NOWAIT case. In other cases, check after we have slept and acquired an exlusive lock. This will simulate the old vx_wait() behavior. Sponsored by: Isilon Systems, Inc.
* - Enable SMP VFS by default on current. More users are needed to turn upjeff2005-02-231-1/+5
| | | | | | | any remaining bugs. Anyone inconvenienced by this can still disable it in the loader. Sponsored by: Isilon Systems, Inc.
* - Only the xlock holder should be calling VOP_LOCK on a vp once VI_XLOCKjeff2005-02-231-0/+5
| | | | | | | has been set. Assert that this is the case so that we catch filesystems who are using naked VOP_LOCKs in illegal cases. Sponsored by: Isilon Systems, Inc.
* - Add a check for xlock in vop_lock_assert. Presently the xlock isjeff2005-02-221-1/+2
| | | | | | | considered to be as good as an exclusive lock, although there is still a possibility of someone acquiring a VOP LOCK while xlock is held. Sponsored by: Isilon Systems, Inc.
* Zero the v_un container field to make sure everything is gone.phk2005-02-221-1/+1
|
* Reap more benefits from DEVFS:phk2005-02-221-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | List devfs_dirents rather than vnodes off their shared struct cdev, this saves a pointer field in the vnode at the expense of a field in the devfs_dirent. There are often 100 times more vnodes so this is bargain. In addition it makes it harder for people to try to do stypid things like "finding the vnode from cdev". Since DEVFS handles all VCHR nodes now, we can do the vnode related cleanup in devfs_reclaim() instead of in dev_rel() and vgonel(). Similarly, we can do the struct cdev related cleanup in dev_rel() instead of devfs_reclaim(). rename idestroy_dev() to destroy_devl() for consistency. Add LIST_ENTRY de_alias to struct devfs_dirent. Remove v_specnext from struct vnode. Change si_hlist to si_alist in struct cdev. String new devfs vnodes' devfs_dirent on si_alist when we create them and take them off in devfs_reclaim(). Fix devfs_revoke() accordingly. Also don't clear fields devfs_reclaim() will clear when called from vgone(); Let devfs_reclaim() call dev_rel() instead of vgonel(). Move the usecount tracking from dev_rel() to devfs_reclaim(), and let dev_rel() take a struct cdev argument instead of vnode. Destroy SI_CHEAPCLONE devices in dev_rel() (instead of devfs_reclaim()) when they are no longer used. (This should maybe happen in devfs_close() instead.)
* Remove vfinddev(), it is generally bogus when faced with jails andphk2005-02-221-20/+0
| | | | chroot and has no legitimate use(r)s in the tree.
* Try to unbreak the vnode locking around vop_reclaim() (based mostly onphk2005-02-191-36/+30
| | | | | | | | | patch from kan@). Pull bufobj_invalbuf() out of vinvalbuf() and make g_vfs call it on close. This is not yet a generally safe function, but for this very specific use it is safe. This solves the problem with buffers not being flushed by unmount or after failed mount attempts.
* Make sure to drop the VI_LOCK in vgonel();phk2005-02-181-1/+3
| | | | Spotted by: Taku YAMAMOTO <taku@tackymt.homeip.net>
* Introduce vx_wait{l}() and use it instead of home-rolled versions.phk2005-02-171-6/+31
|
* Convert KASSERTS to VNASSERTSphk2005-02-171-22/+27
|
* Make various vnode related functions staticphk2005-02-101-65/+9
|
* Don't pass NULL to vprint()phk2005-02-101-1/+1
|
* - Add a new assert in the getnewvnode(). Assert that the usecount is stilljeff2005-02-081-2/+4
| | | | | | | 0 to detect getnewvnode() races. - Add the vnode address to a few panics near by to help in debugging. Sponsored by: Isilon Systems, Inc.
* Access vmobject via the bufobj instead of the vnodephk2005-02-071-11/+11
|
* Don't call VOP_DESTROYVOBJECT(), trust that VOP_RECLAIM() did whatphk2005-02-071-2/+3
| | | | was necessary.
* Remove unused argument to vrecycle()phk2005-01-281-7/+1
|
* Integrate vclean() into vgonel().phk2005-01-281-68/+51
| | | | Various associated polishing.
* Remove register keywordphk2005-01-281-5/+5
|
* Don't use VOP_GETVOBJECT, use vp->v_object directly.phk2005-01-251-11/+12
|
* Eliminate the constant flags argument to vclean()phk2005-01-241-16/+8
|
* Change vprint() to vn_printf() which takes varargs.phk2005-01-241-12/+15
| | | | Add #define for vprint() to call vn_printf().
* Kill the VV_OBJBUF and test the v_object for NULL instead.phk2005-01-241-2/+0
|
* - Add the tunable and sysctl for the mpsafevfs. It currently defaultsjeff2005-01-241-37/+49
| | | | | | | | | | | | | | | to off. - Protect access to mnt_kern_flag with the mointpoint mutex. - Remove some KASSERTs which are not legal checks without the appropriate locks held. - Use VCANRECYCLE() rather than rolling several slightly different checks together. - Return from vtryrecycle() with a recycled vnode rather than a locked vnode. This simplifies some locking. - Remove several GIANT_REQUIRED lines. - Add a few KASSERTs to help with INACT debugging. Sponsored By: Isilon Systems, Inc.
* Fix a bug I introduced in 1.561 which has caused considerable filesystemphk2005-01-161-5/+5
| | | | | | | | | unhappiness lately. As far as I can tell, no files that have made it safely to disk have been endangered, but stuff in transit has been in peril. Pointy hat: phk
* Eliminate unused and unnecessary "cred" argument from vinvalbuf()phk2005-01-141-4/+3
|
* Ditch vfs_object_create() and make the callers call VOP_CREATEVOBJECT()phk2005-01-131-16/+0
| | | | directly.
* Add BO_SYNC() and add a default which uses the secret vnode pointerphk2005-01-111-1/+1
| | | | and VOP_FSYNC() for now.
* More vnode -> bufobj migration.phk2005-01-111-12/+13
|
* Give flushbuflist() a struct bufv as first argument and avoid home-rollingphk2005-01-111-36/+21
| | | | | | | | TAILQ_FOREACH_SAFE(). Loose the error pointer argument and return any errors the normal way. Return EAGAIN for the case where more work needs to be done.
* Remove the unused credential argument from VOP_FSYNC() and VFS_SYNC().phk2005-01-111-3/+3
| | | | | | | | | | | | | | | | | | I'm not sure why a credential was added to these in the first place, it is not used anywhere and it doesn't make much sense: The credentials for syncing a file (ability to write to the file) should be checked at the system call level. Credentials for syncing one or more filesystems ("none") should be checked at the system call level as well. If the filesystem implementation needs a particular credential to carry out the syncing it would logically have to the cached mount credential, or a credential cached along with any delayed write data. Discussed with: rwatson
OpenPOWER on IntegriCloud