aboutsummaryrefslogtreecommitdiff
path: root/sys/vm/vm_swap.c
Commit message (Collapse)AuthorAgeFilesLines
* Merge swap_pager.c and vm_swap.c into swap_pager.c, the separationPoul-Henning Kamp2003-07-181-546/+0
| | | | | | | | | | | | is not natural and needlessly exposes a lot of dirty laundry. Move private interfaces between the two from swap_pager.h to swap_pager.c and staticize as much as possible. No functional change. Notes: svn path=/head/; revision=117722
* Add the same KASSERT to all VOP_STRATEGY and VOP_SPECSTRATEGY implementationsPoul-Henning Kamp2003-06-151-0/+2
| | | | | | | to check that the buffer points to the correct vnode. Notes: svn path=/head/; revision=116412
* Use __FBSDID().David E. O'Brien2003-06-111-1/+3
| | | | Notes: svn path=/head/; revision=116226
* Fix NFS file swapping, I broke it 3 months ago it seems.Poul-Henning Kamp2003-06-051-6/+6
| | | | Notes: svn path=/head/; revision=115883
* Provide a mac_check_system_swapoff() entry point, which permits MACRobert Watson2003-03-051-0/+8
| | | | | | | | | | modules to authorize disabling of swap against a particular vnode. Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories Notes: svn path=/head/; revision=111936
* NO_GEOM cleanup:Poul-Henning Kamp2003-03-021-5/+12
| | | | | | | | Use VOP_IOCTL(DIOCGMEDIASIZE) to check the size of a potential swap device instead of the cdevsw->d_psize() method. Notes: svn path=/head/; revision=111732
* Fix swapping to a file, it was broken when SPECSTRATEGY was introduced.Matthew Dillon2003-01-201-1/+4
| | | | Notes: svn path=/head/; revision=109587
* Temporarily introduce a new VOP_SPECSTRATEGY operation while I tryPoul-Henning Kamp2003-01-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to sort out disk-io from file-io in the vm/buffer/filesystem space. The intent is to sort VOP_STRATEGY calls into those which operate on "real" vnodes and those which operate on VCHR vnodes. For the latter kind, the call will be changed to VOP_SPECSTRATEGY, possibly conditionally for those places where dual-use happens. Add a default VOP_SPECSTRATEGY method which will call the normal VOP_STRATEGY. First time it is called it will print debugging information. This will only happen if a normal vnode is passed to VOP_SPECSTRATEGY by mistake. Add a real VOP_SPECSTRATEGY in specfs, which does what VOP_STRATEGY does on a VCHR vnode today. Add a new VOP_STRATEGY method in specfs to catch instances where the conversion to VOP_SPECSTRATEGY has not yet happened. Handle the request just like we always did, but first time called print debugging information. Apart up to two instances of console messages per boot, this amounts to a glorified no-op commit. If you get any of the messages on your console I would very much like a copy of them mailed to phk@freebsd.org Notes: svn path=/head/; revision=108686
* Revert use of dmmax_mask, I had overlooked a '~'.Poul-Henning Kamp2003-01-031-2/+2
| | | | | | | Spotted by: bde Notes: svn path=/head/; revision=108609
* Avoid extern decls in .c files by putting them in the vm/swap_pager.hPoul-Henning Kamp2003-01-031-3/+2
| | | | | | | | include file where they belong. Share the dmmax_mask variable. Notes: svn path=/head/; revision=108600
* Retire sys/dmap.h by including the two lines of it which mattersPoul-Henning Kamp2003-01-031-1/+3
| | | | | | | directly in vm/vm_swap.c. Notes: svn path=/head/; revision=108595
* Convert calls to BUF_STRATEGY to VOP_STRATEGY calls. This is a no-op sincePoul-Henning Kamp2003-01-031-1/+1
| | | | | | | all BUF_STRATEGY did in the first place was call VOP_STRATEGY. Notes: svn path=/head/; revision=108589
* This is David Schultz's swapoff code which I am finally able to commit.Matthew Dillon2002-12-151-6/+134
| | | | | | | | | | This should be considered highly experimental for the moment. Submitted by: David Schultz <dschultz@uclink.Berkeley.EDU> MFC after: 3 weeks Notes: svn path=/head/; revision=107913
* Merge from MAC tree: rename mac_check_vnode_swapon() toRobert Watson2002-10-271-1/+1
| | | | | | | | | | | | | | mac_check_system_swapon(), to reflect the fact that the primary object of this change is the running kernel as a whole, rather than just the vnode. We'll drop additional checks of this class into the same check namespace, including reboot(), sysctl(), et al. Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories Notes: svn path=/head/; revision=106023
* Introduce MAC_CHECK_VNODE_SWAPON, which permits MAC policies toRobert Watson2002-10-221-1/+7
| | | | | | | | | | | | | | perform authorization checks during swapon() events; policies might choose to enforce protections based on the credential requesting the swap configuration, the target of the swap operation, or other factors such as internal policy state. Approved by: re Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories Notes: svn path=/head/; revision=105717
* - Lock access to numoutput on the swap devices.Jeff Roberson2002-09-251-0/+2
| | | | Notes: svn path=/head/; revision=103924
* Remove all use of vnode->v_tag, replacing with appropriate substitutes.Nate Lawson2002-09-141-2/+4
| | | | | | | | | | | | | | | v_tag is now const char * and should only be used for debugging. Additionally: 1. All users of VT_NTS now check vfsconf->vf_type VFCF_NETWORK 2. The user of VT_PROCFS now checks for the new flag VV_PROCDEP, which is propagated by pseudofs to all child vnodes if the fs sets PFS_PROCDEP. Suggested by: phk Reviewed by: bde, rwatson (earlier version) Notes: svn path=/head/; revision=103314
* - Replace v_flag with v_iflag and v_vflagJeff Roberson2002-08-041-2/+4
| | | | | | | | | | | | | | | | | | - v_vflag is protected by the vnode lock and is used when synchronization with VOP calls is needed. - v_iflag is protected by interlock and is used for dealing with vnode management issues. These flags include X/O LOCK, FREE, DOOMED, etc. - All accesses to v_iflag and v_vflag have either been locked or marked with mp_fixme's. - Many ASSERT_VOP_LOCKED calls have been added where the locking was not clear. - Many functions in vfs_subr.c were restructured to provide for stronger locking. Idea stolen from: BSD/OS Notes: svn path=/head/; revision=101308
* Export nswapdev through sysctl(8).Dag-Erling Smørgrav2002-05-311-0/+2
| | | | | | | Sponsored by: DARPA, NAI Labs Notes: svn path=/head/; revision=97654
* Expand the one-line function pbreassignbuf() the only place it is or couldPoul-Henning Kamp2002-05-051-1/+1
| | | | | | | be used. Notes: svn path=/head/; revision=96073
* Change the suser() API to take advantage of td_ucred as well as do aJohn Baldwin2002-04-011-1/+1
| | | | | | | | | | | | | | | general cleanup of the API. The entire API now consists of two functions similar to the pre-KSE API. The suser() function takes a thread pointer as its only argument. The td_ucred member of this thread must be valid so the only valid thread pointers are curthread and a few kernel threads such as thread0. The suser_cred() function takes a pointer to a struct ucred as its first argument and an integer flag as its second argument. The flag is currently only used for the PRISON_ROOT flag. Discussed on: smp@ Notes: svn path=/head/; revision=93593
* Remove references to vm_zone.h and switch over to the new uma API.Jeff Roberson2002-03-201-1/+1
| | | | Notes: svn path=/head/; revision=92748
* Remove __P.Alfred Perlstein2002-03-191-1/+1
| | | | Notes: svn path=/head/; revision=92727
* - Remove a number of extra newlines that do not belong here according toEivind Eklund2002-03-101-1/+0
| | | | | | | | | | | | style(9) - Minor space adjustment in cases where we have "( ", " )", if(), return(), while(), for(), etc. - Add /* SYMBOL */ after a few #endifs. Reviewed by: alc Notes: svn path=/head/; revision=92029
* Simple p_ucred -> td_ucred changes to start using the per-thread ucredJohn Baldwin2002-02-271-6/+5
| | | | | | | reference. Notes: svn path=/head/; revision=91406
* KSE Milestone 2Julian Elischer2001-09-121-16/+16
| | | | | | | | | | | | | | | | | Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha Notes: svn path=/head/; revision=83366
* make swapon() MPSAFE (will adjust syscalls.master later)Matthew Dillon2001-08-311-5/+13
| | | | Notes: svn path=/head/; revision=82699
* Permit direct swapping to NFS regular files using swapon(2). WeIan Dowse2001-07-281-3/+10
| | | | | | | | | | | | | already allow this for NFS swap configured via BOOTP, so it is known to work fine. For many diskless configurations is is more flexible to have the client set up swapping itself; it can recreate a sparse swap file to save on server space for example, and it works with a non-NFS root filesystem such as an in-kernel filesystem image. Notes: svn path=/head/; revision=80517
* whitespace / register cleanupMatthew Dillon2001-07-041-5/+5
| | | | Notes: svn path=/head/; revision=79242
* Change the way information about swap devices is exported to be moreThomas Moestl2001-06-011-28/+34
| | | | | | | | | | | canonical: define a versioned struct xswdev, and add a sysctl node handler that allows the user to get this structure for a certain device index by specifying this index as last element of the MIB. This new node handler, vm.swap_info, replaces the old vm.nswapdev and vm.swapdevX.* (where X was the index) sysctls. Notes: svn path=/head/; revision=77604
* Introduce per-swap area accounting in the VM system, and exportRobert Watson2001-02-231-2/+32
| | | | | | | | | | | | | | this information via the vm.nswapdev sysctl (number of swap areas) and vm.swapdevX nodes (where X is the device), which contain the MIBs dev, blocks, used, and flags. These changes are required to allow top and other userland swap-monitoring utilities to run without setgid kmem. Submitted by: Thomas Moestl <tmoestl@gmx.net> Reviewed by: freebsd-audit Notes: svn path=/head/; revision=72949
* - If swap metadata does not fit into the KVM, reduce the number ofSeigo Tanimura2000-12-131-0/+8
| | | | | | | | | | | | | | | | | | struct swblock entries by dividing the number of the entries by 2 until the swap metadata fits. - Reject swapon(2) upon failure of swap_zone allocation. This is just a temporary fix. Better solutions include: (suggested by: dillon) o reserving swap in SWAP_META_PAGES chunks, and o swapping the swblock structures themselves. Reviewed by: alfred, dillon Notes: svn path=/head/; revision=69972
* The swap bitmap allocator was not calculating the bitmap size properlyMatthew Dillon2000-10-131-3/+17
| | | | | | | | | | | | | | | | | | in the face of non-stripe-aligned swap areas. The bug could cause a panic during boot. Refuse to configure a swap area that is too large (67 GB or so) Properly document the power-of-2 requirement for SWB_NPAGES. The patch is slightly different then the one Tor enclosed in the P.R., but accomplishes the same thing. PR: kern/20273 Submitted by: Tor.Egge@fast.no Notes: svn path=/head/; revision=67082
* Separate the struct bio related stuff out of <sys/buf.h> intoPoul-Henning Kamp2000-05-051-0/+1
| | | | | | | | | | | | | | | | | | <sys/bio.h>. <sys/bio.h> is now a prerequisite for <sys/buf.h> but it shall not be made a nested include according to bdes teachings on the subject of nested includes. Diskdrivers and similar stuff below specfs::strategy() should no longer need to include <sys/buf.> unless they need caching of data. Still a few bogus uses of struct buf to track down. Repocopy by: peter Notes: svn path=/head/; revision=60041
* Remove unneeded #include <vm/vm_zone.h>Poul-Henning Kamp2000-04-301-1/+0
| | | | | | | Generated by: src/tools/tools/kerninclude Notes: svn path=/head/; revision=59794
* Complete the bio/buf divorce for all code below devfs::strategyPoul-Henning Kamp2000-04-151-3/+3
| | | | | | | | | | | | | Exceptions: Vinum untouched. This means that it cannot be compiled. Greg Lehey is on the case. CCD not converted yet, casts to struct buf (still safe) atapi-cd casts to struct buf to examine B_PHYS Notes: svn path=/head/; revision=59249
* Move B_ERROR flag to b_ioflags and call it BIO_ERROR.Poul-Henning Kamp2000-04-021-3/+3
| | | | | | | | | | | | | | | | (Much of this done by script) Move B_ORDERED flag to b_ioflags and call it BIO_ORDERED. Move b_pblkno and b_iodone_chain to struct bio while we transition, they will be obsoleted once bio structs chain/stack. Add bio_queue field for struct bio aware disksort. Address a lot of stylistic issues brought up by bde. Notes: svn path=/head/; revision=58934
* Revert spelling mistake I made in the previous commitPhilippe Charnier2000-03-271-1/+1
| | | | | | | Requested by: Alan and Bruce Notes: svn path=/head/; revision=58705
* SpellingPhilippe Charnier2000-03-261-1/+1
| | | | Notes: svn path=/head/; revision=58634
* Rename the existing BUF_STRATEGY() to DEV_STRATEGY()Poul-Henning Kamp2000-03-201-1/+1
| | | | | | | | | | | substitute BUF_WRITE(foo) for VOP_BWRITE(foo->b_vp, foo) substitute BUF_STRATEGY(foo) for VOP_STRATEGY(foo->b_vp, foo) This patch is machine generated except for the ccd.c and buf.h parts. Notes: svn path=/head/; revision=58349
* Remove B_READ, B_WRITE and B_FREEBUF and replace them with a newPoul-Henning Kamp2000-03-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | field in struct buf: b_iocmd. The b_iocmd is enforced to have exactly one bit set. B_WRITE was bogusly defined as zero giving rise to obvious coding mistakes. Also eliminate the redundant struct buf flag B_CALL, it can just as efficiently be done by comparing b_iodone to NULL. Should you get a panic or drop into the debugger, complaining about "b_iocmd", don't continue. It is likely to write on your disk where it should have been reading. This change is a step in the direction towards a stackable BIO capability. A lot of this patch were machine generated (Thanks to style(9) compliance!) Vinum users: Greg has not had time to test this yet, be careful. Notes: svn path=/head/; revision=58345
* The swapdev_vp changes made to rip out the swap specfs interactionMatthew Dillon2000-01-251-8/+8
| | | | | | | | | | | also broke diskless swapping. Moving the swapdev_vp initialization to more commonly run code solves the problem. PR: kern/16165 Additional testing by: David Gilbert <dgilbert@velocet.ca> Notes: svn path=/head/; revision=56599
* Give vn_isdisk() a second argument where it can return a suitable errno.Poul-Henning Kamp2000-01-101-2/+1
| | | | | | | Suggested by: bde Notes: svn path=/head/; revision=55756
* Fix the swap backed vn case - this was broken by my rev 1.128 toPeter Wemm1999-12-281-9/+42
| | | | | | | | | | | | | | | | | | | | | swap_pager.c and related commits. Essentially swap_pager.c is backed out to before the changes, but swapdev_vp is converted into a real vnode with just VOP_STRATEGY(). It no longer abuses specfs vnops and no longer needs a dev_t and /dev/drum (or /dev/swapdev) for the intermediate layer. This essentially restores the vnode interface as the interface to the bottom of the swap pager, and vm_swap.c provides a clean vnode interface. This will need to be revisited when we swap to files (vnodes) - which is the other reason for keeping the vnode interface between the swap pager and the swap devices. OK'ed by: dillon Notes: svn path=/head/; revision=55175
* Introduce NDFREE (and remove VOP_ABORTOP)Eivind Eklund1999-12-151-0/+2
| | | | Notes: svn path=/head/; revision=54655
* Report swapdevices as cdevs rather than bdevs.Poul-Henning Kamp1999-11-291-1/+1
| | | | | | | Remove unused dev2budev() function. Notes: svn path=/head/; revision=53899
* Isolate the swapdev_vp "not quite" vnode in the only source file whichPoul-Henning Kamp1999-11-221-35/+4
| | | | | | | | | needs it now that /dev/drum is gone. Reviewed by: eivind, peter Notes: svn path=/head/; revision=53594
* Remove the non-functional "swap device" userland front-end to thePeter Wemm1999-11-181-75/+3
| | | | | | | | | | | | | | | | | | | | | | | | multiplexed underlying swap devices (/dev/drum). The only thing it did was to allow root to open /dev/drum, but not do anything with it. Various utilities used to grovel around in here, but Matt has written a much nicer (and clean) front-end to this for libkvm, and nothing uses the old system any more. The VM system was calling VOP_STRATEGY() on the vp of the first underlying swap device (not the /dev/drum one, the first real device), and using the VOP system to indirectly (and only) call swstrategy() to choose an underlying device and enqueue it on that device. I have changed it to avoid diverting through the VOP system and to call the only possible target directly, saving a little bit of time and some complexity. In all, nothing much changes, except some scaffolding to support the roundabout way of calling swstrategy() is gone. Matt gave me the ok to do this some time ago, and I apologize for taking so long to get around to it. Notes: svn path=/head/; revision=53338
* Fix a panic(8) implementation:Poul-Henning Kamp1999-10-081-5/+17
| | | | | | | | | | hexdump -C < /dev/drum by simply refusing to do I/O from userland. a panic. I'm not sure we even need /dev/drum anymore, it seems to have been broken for a long time thi Notes: svn path=/head/; revision=52035
* Introduce swopen to prevent blockdevice opens and insist on minor==0.Poul-Henning Kamp1999-10-041-1/+17
| | | | Notes: svn path=/head/; revision=51930