summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_subr.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Collapse vnode->v_object and buf->b_object into bufobj->bo_object.phk2004-10-251-4/+0
|
* Move the buffer method vector (buf->b_op) to the bufobj.phk2004-10-241-0/+1
| | | | | | | | | | | | | | | | | Extend it with a strategy method. Add bufstrategy() which do the usual VOP_SPECSTRATEGY/VOP_STRATEGY song and dance. Rename ibwrite to bufwrite(). Move the two NFS buf_ops to more sensible places, add bufstrategy to them. Add inlines for bwrite() and bstrategy() which calls through buf->b_bufobj->b_ops->b_{write,strategy}(). Replace almost all VOP_STRATEGY()/VOP_SPECSTRATEGY() calls with bstrategy().
* When MAC is enabled, warn if getnewvnode() is asked to produce a vnoderwatson2004-10-221-0/+2
| | | | | | without a mountpoint. In this scenario, there's no useful source for a label on the vnode, since we can't query the mountpoint for the labeling strategy or default label.
* Alas, poor SPECFS! -- I knew him, Horatio; A filesystem of infinitephk2004-10-221-3/+3
| | | | | | | | | | | jest, of most excellent fancy: he hath taught me lessons a thousand times; and now, how abhorred in my imagination it is! my gorge rises at it. Here were those hacks that I have curs'd I know not how oft. Where be your kludges now? your workarounds? your layering violations, that were wont to set the table on a roar? Move the skeleton of specfs into devfs where it now belongs and bury the rest.
* Add b_bufobj to struct buf which eventually will eliminate the need for b_vp.phk2004-10-221-87/+64
| | | | | | | | | | | | | | | | | | Initialize b_bufobj for all buffers. Make incore() and gbincore() take a bufobj instead of a vnode. Make inmem() local to vfs_bio.c Change a lot of VI_[UN]LOCK(bp->b_vp) to BO_[UN]LOCK(bp->b_bufobj) also VI_MTX() to BO_MTX(), Make buf_vlist_add() take a bufobj instead of a vnode. Eliminate other uses of bp->b_vp where bp->b_bufobj will do. Various minor polishing: remove "register", turn panic into KASSERT, use new function declarations, TAILQ_FOREACH_SAFE() etc.
* Move the VI_BWAIT flag into no bo_flag element of bufobj and call it BO_WWAITphk2004-10-211-55/+22
| | | | | | | | | | Add bufobj_wref(), bufobj_wdrop() and bufobj_wwait() to handle the write count on a bufobj. Bufobj_wdrop() replaces vwakeup(). Use these functions all relevant places except in ffs_softdep.c where the use if interlocked_sleep() makes this impossible. Rename b_vnbufs to b_bobufs now that we touch all the relevant files anyway.
* Add BO_* macros parallel to VI_* macros for manipulating the bo_mtx.phk2004-10-211-7/+11
| | | | | | | | | Initialize the bo_mtx when we allocate a vnode i getnewvnode() For now we point to the vnodes interlock mutex, that retains the exact same locking sematics. Move v_numoutput from vnode to bufobj. Add renaming macro to postpone code sweep.
* Polish vtruncbuf() to improve readability and style a bit.phk2004-10-211-49/+42
|
* Simplify buf_vlist_remove().phk2004-10-211-34/+16
| | | | | Now that we have encapsulated the splaytree related information into a structure we can eliminate the half of this function.
* vtryrecycle: Don't rely on type VBAD alone to mean that we don't needgrog2004-10-061-1/+1
| | | | | | to clean the vnode. If v_data is set, we still need to clean it. This code change should catch all incidents of the previous commit (INVARIANTS only).
* getnewvnode: Weaken the panic "cleaned vnode isn't" to a warning.grog2004-10-061-1/+3
| | | | | | | | | | | | | | Discussion: this panic (or waning) only occurs when the kernel is compiled with INVARIANTS. Otherwise the problem (which means that the vp->v_data field isn't NULL, and represents a coding error and possibly a memory leak) is silently ignored by setting it to NULL later on. Panicking here isn't very helpful: by this time, we can only find the symptoms. The panic occurs long after the reason for "not cleaning" has been forgotten; in the case in point, it was the result of severe file system corruption which left the v_type field set to VBAD. That issue will be addressed by a separate commit.
* Fix a LOR relating to freeing cdevs.phk2004-10-011-8/+2
|
* Hold dev_lock and check for NULL devsw pointer when we determinephk2004-09-241-1/+5
| | | | if a vnode is a disk.
* Do not refcount the cdevsw, but rather maintain a cdev->si_threadcountphk2004-09-231-24/+17
| | | | | | | | | | of the number of threads which are inside whatever is behind the cdevsw for this particular cdev. Make the device mutex visible through dev_lock() and dev_unlock(). We may want finer granularity later. Replace spechash_mtx use with dev_lock()/dev_unlock().
* Remove unused B_WRITEINPROG flagphk2004-09-151-1/+0
|
* Create simple function init_va_filerev() for initializing a va_filerevphk2004-09-071-0/+13
| | | | | | | | | field. Replace three instances of longhaired initialization va_filerev fields. Added XXX comment wondering why we don't use random bits instead of uptime of the system for this purpose.
* Don't attempt to trigger the syncer thread final sync code in thetruckman2004-08-201-0/+3
| | | | | | | | | | shutdown_pre_sync state if the RB_NOSYNC flag is set. This is the likely cause of hangs after a system panic that are keeping crash dumps from being done. This is a MFC candidate for RELENG_5. MFC after: 3 days
* s/MAX_SAFE_MAXVNODES/MAXVNODES_MAX/gobrien2004-08-161-5/+6
|
* Add locking to the kqueue subsystem. This also makes the kqueue subsystemjmg2004-08-151-5/+16
| | | | | | | | | | | | | a more complete subsystem, and removes the knowlege of how things are implemented from the drivers. Include locking around filter ops, so a module like aio will know when not to be unloaded if there are outstanding knotes using it's filter ops. Currently, it uses the MTX_DUPOK even though it is not always safe to aquire duplicate locks. Witness currently doesn't support the ability to discover if a dup lock is ok (in some cases). Reviewed by: green, rwatson (both earlier versions)
* In v_addpollinfo(), we allocate storage to back vp->v_pollinfo. However,rwatson2004-08-111-1/+7
| | | | | | | | | we may sleep when doing so; check that we didn't race with another thread allocating storage for the vnode after allocation is made to a local pointer, and only update the vnode pointer if it's still NULL. Otherwise, accept that another thread got there first, and release the local storage. Discussed with: jmg
* Skip the syncing disks loop if there are no dirty buffers. Remove anjl2004-08-101-1/+1
| | | | | | variable used to flag the initial printf. Submitted by: truckman (earlier version)
* Put a cap on the auto-tuning of kern.maxvnodes.obrien2004-08-021-0/+8
| | | | Cap value chosen by: scottl
* Minor message cleanup.njl2004-07-301-2/+1
|
* Convert the vfsconf list to a TAILQ.phk2004-07-271-21/+10
| | | | | | | | Introduce vfs_byname() function to find things on it. Staticize vfs_nmount() function under the name vfs_donmount(). Various cleanups.
* Rename suser_cred()'s PRISON_ROOT flag to SUSER_ALLOWJAIL. This iscperciva2004-07-261-6/+6
| | | | | | | | | | | somewhat clearer, but more importantly allows for a consistent naming scheme for suser_cred flags. The old name is still defined, but will be removed in a few days (unless I hear any complaints...) Discussed with: rwatson, scottl Requested by: jhb
* Eliminate unused second argument to reassignbuf() and simplify itphk2004-07-251-31/+12
| | | | accordingly.
* put several of the options for DEBUG_VFS_LOCKS under control of sysctls.alfred2004-07-211-0/+14
|
* Cleanup shutdown output.alfred2004-07-151-2/+1
|
* Tidy up system shutdown.alfred2004-07-151-1/+11
|
* Make VFS_ROOT() and vflush() take a thread argument.alfred2004-07-121-4/+4
| | | | | | This is to allow filesystems to decide based on the passed thread which vnode to return. Several filesystems used curthread, they now use the passed thread.
* Dump the actual bad values when this assertion is tripped.alfred2004-07-121-1/+3
|
* Update for the KDB framework:marcel2004-07-101-2/+3
| | | | o Call kdb_enter() instead of Debugger().
* fixup sysctl by fsid nodealfred2004-07-081-2/+2
|
* Introduce vfs_suser(), used to test if a user should have special privsalfred2004-07-061-0/+16
| | | | for a mount.
* NFS mobility PHASE I, II & III (phase VI, and V pending):alfred2004-07-061-1/+1
| | | | | | | | | | | | | | | Rebind the client socket when we experience a timeout. This fixes the case where our IP changes for some reason. Signal a VFS event when NFS transitions from up to down and vice versa. Add a placeholder vfs_sysctl where we will put status reporting shortly. Also: Make down NFS mounts return EIO instead of EINTR when there is a soft timeout or force unmount in progress.
* Unconditionally set last_work_seen while in the SYNCER_RUNNING statetruckman2004-07-051-5/+4
| | | | | | | | | | | so that last_work_seen has a reasonable value at the transition to the SYNCER_SHUTTING_DOWN state, even if net_worklist_len happened to be zero at the time. Initialize last_work_seen to zero as a safety measure in case the syncer never ran in the SYNCER_RUNNING state. Tested by: phk
* Rework syncer termination code:truckman2004-07-051-33/+79
| | | | | | | | | | | | | | | | | | | | | Speed up the syncer when shutting down by sleeping for a shorter period of time instead of cranking up rushjob and using the normal one second sleep. Skip empty worklist slots when shutting down to avoid lengthy intervals of inactivity. Give I/O more time to complete between steps by not speeding the syncer quite as much. Terminate the syncer after one full pass through the worklist plus one second with the worklist containing nothing but syncer vnodes. Print an indication of shutdown progress to the console. Add a sysctl, vfs.worklist_len, to allow the size of the syncer worklist to be monitored.
* Give synthetic root filesystem device vnodes a v_bsize of DEV_BSIZE.phk2004-07-041-0/+1
|
* Pass the operation in with the fsidctl.alfred2004-07-041-2/+8
| | | | | Remove some fsidctls that we will not be using. Correct prototypes for fs sysctls.
* Make the last commit handle non-phk root devices better.phk2004-07-041-2/+3
|
* Blocksize for I/O should be a property of the vnode and not found by gropingphk2004-07-041-0/+1
| | | | | | | | | around in the vnodes surroundings when we allocate a block. Assign a blocksize when we create a vnode, and yell a warning (and ignore it) if we got the wrong size. Please email all such warnings to me.
* Introduce a new kevent filter. EVFILT_FS that will be used to signalalfred2004-07-041-0/+62
| | | | | | | | | | | generic filesystem events to userspace. Currently only mount and unmount of filesystems are signalled. Soon to be added, up/down status of NFS. Introduce a sysctl node used to route requests to/from filesystems based on filesystem ids. Introduce a new vfsop, vfs_sysctl(mp, req) that is used as the callback/ entrypoint by the sysctl code to change individual filesystems.
* Revision 1.496 would not boot on my system due toalfred2004-07-041-1/+2
| | | | | | | | ffs_mount -> bdevvp -> getnewvnode(..., mp = NULL, ...) -> insmntqueue(vp, mp = NULL) -> KASSERT -> panic Make getnewvnode() only call insmntqueue() if the mountpoint parameter is not NULL.
* When we traverse the vnodes on a mountpoint we need to look out forphk2004-07-041-38/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | our cached 'next vnode' being removed from this mountpoint. If we find that it was recycled, we restart our traversal from the start of the list. Code to do that is in all local disk filesystems (and a few other places) and looks roughly like this: MNT_ILOCK(mp); loop: for (vp = TAILQ_FIRST(&mp...); (vp = nvp) != NULL; nvp = TAILQ_NEXT(vp,...)) { if (vp->v_mount != mp) goto loop; MNT_IUNLOCK(mp); ... MNT_ILOCK(mp); } MNT_IUNLOCK(mp); The code which takes vnodes off a mountpoint looks like this: MNT_ILOCK(vp->v_mount); ... TAILQ_REMOVE(&vp->v_mount->mnt_nvnodelist, vp, v_nmntvnodes); ... MNT_IUNLOCK(vp->v_mount); ... vp->v_mount = something; (Take a moment and try to spot the locking error before you read on.) On a SMP system, one CPU could have removed nvp from our mountlist but not yet gotten to assign a new value to vp->v_mount while another CPU simultaneously get to the top of the traversal loop where it finds that (vp->v_mount != mp) is not true despite the fact that the vnode has indeed been removed from our mountpoint. Fix: Introduce the macro MNT_VNODE_FOREACH() to traverse the list of vnodes on a mountpoint while taking into account that vnodes may be removed from the list as we go. This saves approx 65 lines of duplicated code. Split the insmntque() which potentially moves a vnode from one mount point to another into delmntque() and insmntque() which does just what the names say. Fix delmntque() to set vp->v_mount to NULL while holding the mountpoint lock.
* When shutting down the syncer kernel thread, first tell it to runtruckman2004-07-011-6/+68
| | | | | | | | | | | | | faster and iterate to over its work list a few times in an attempt to empty the work list before the syncer terminates. This leaves fewer dirty blocks to be written at the "syncing disks" stage and keeps the the "giving up on N buffers" problem from being triggered by the presence of a large soft updates work list at system shutdown time. The downside is that the syncer takes noticeably longer to terminate. Tested by: "Arjan van Leeuwen" <avleeuwen AT piwebs DOT com> Approved by: mckusick
* Second half of the dev_t cleanup.phk2004-06-171-8/+8
| | | | | | | | | | | The big lines are: NODEV -> NULL NOUDEV -> NODEV udev_t -> dev_t udev2dev() -> findcdev() Various minor adjustments including handling of userland access to kernel space struct cdev etc.
* Do the dreaded s/dev_t/struct cdev */phk2004-06-161-12/+12
| | | | Bump __FreeBSD_version accordingly.
* Remove a left over from userland buffer-cache access to disks.phk2004-06-141-5/+2
|
* Assert Giant in vrele().rwatson2004-05-311-0/+2
|
* Put deprecated sysctl code inside BURN_BRIDGES.mux2004-04-111-3/+5
|
OpenPOWER on IntegriCloud