summaryrefslogtreecommitdiff
path: root/sys/kern/vfs_cluster.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Changes imported from XFS for FreeBSD project:Craig Rodrigues2005-12-071-0/+15
| | | | | | | | | | | | | | | | | - add fields to struct buf (needed by XFS) - 3 private fields: b_fsprivate1, b_fsprivate2, b_fsprivate3 - b_pin_count, count of pinned buffer - add new B_MANAGED flag - add breada() function to initiate asynchronous I/O on read-ahead blocks. - add bufdone_finish(), bpin(), bunpin_wait() functions Patches provided by: kan Reviewed by: phk Silence on: arch@ Notes: svn path=/head/; revision=153192
* Normalize a significant number of kernel malloc type names:Robert Watson2005-10-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | - Prefer '_' to ' ', as it results in more easily parsed results in memory monitoring tools such as vmstat. - Remove punctuation that is incompatible with using memory type names as file names, such as '/' characters. - Disambiguate some collisions by adding subsystem prefixes to some memory types. - Generally prefer lower case to upper case. - If the same type is defined in multiple architecture directories, attempt to use the same name in additional cases. Not all instances were caught in this change, so more work is required to finish this conversion. Similar changes are required for UMA zone names. Notes: svn path=/head/; revision=151897
* Only set B_RAM (Read ahead mark) on an incore buffers if we can lock it.Stephan Uphoff2005-10-241-3/+8
| | | | | | | | | | This fixes a race condition caused by the unlocked write access to the b_flags field. MFC after: 3 days Notes: svn path=/head/; revision=151621
* Do not use vm_pager_init() to initialize vnode_pbuf_freecnt variable.Alexander Kabaev2005-08-131-6/+0
| | | | | | | | | | | | | | vm_pager_init() is run before required nswbuf variable has been set to correct value. This caused system to run with single pbuf available for vnode_pager. Handle both cluster_pbuf_freecnt and vnode_pbuf_freecnt variable in the same way. Reported by: ade Obtained from: alc MFC after: 2 days Notes: svn path=/head/; revision=149035
* Revert revision 1.164: pmap_qremove() does not require protection byAlan Cox2005-05-141-2/+0
| | | | | | | | | VM_LOCK_GIANT. Discussed with: jeff Notes: svn path=/head/; revision=146202
* - Remove spls and comments relating to them.Jeff Roberson2005-05-011-26/+2
| | | | Notes: svn path=/head/; revision=145734
* - Call VM_LOCK_GIANT in cluster_callback() to protect some pmap calls. VFSJeff Roberson2005-04-301-0/+2
| | | | | | | | | will not be acquiring Giant before calling this function anymore. Sponsored by: Isilon Systems, Inc. Notes: svn path=/head/; revision=145700
* make cluster_callback() staticPoul-Henning Kamp2005-02-101-1/+2
| | | | Notes: svn path=/head/; revision=141628
* - Remove GIANT_REQUIRED where giant is no longer required.Jeff Roberson2005-01-241-6/+0
| | | | | | | Sponsored By: Isilon Systems, Inc. Notes: svn path=/head/; revision=140718
* Eliminate (now) unnecessary acquisition and release of the global pageAlan Cox2004-12-291-4/+0
| | | | | | | queues lock. Notes: svn path=/head/; revision=139393
* Don't manually set b_bufobj, pbgetvp() does this for us.Poul-Henning Kamp2004-11-151-1/+0
| | | | Notes: svn path=/head/; revision=137724
* Explicitly call pbrelvp()Poul-Henning Kamp2004-11-151-0/+1
| | | | Notes: svn path=/head/; revision=137719
* Retire b_magic now, we have the bufobj containing the same hint.Poul-Henning Kamp2004-11-041-1/+0
| | | | Notes: svn path=/head/; revision=137197
* Lock bp->b_bufobj->b_object instead of bp->b_objectPoul-Henning Kamp2004-10-281-8/+8
| | | | Notes: svn path=/head/; revision=137010
* Avoid using bp->b_vp when we already have the vnode by other means.Poul-Henning Kamp2004-10-271-6/+5
| | | | Notes: svn path=/head/; revision=136989
* Synchronize access to the vm page's PG_BUSY flag using the containing vmAlan Cox2004-10-271-4/+4
| | | | | | | | object's lock. In the same place, eliminate unnecessary checks for a NULL vm object pointer. Notes: svn path=/head/; revision=136985
* Move the buffer method vector (buf->b_op) to the bufobj.Poul-Henning Kamp2004-10-241-5/+2
| | | | | | | | | | | | | | | | | | | | 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(). Notes: svn path=/head/; revision=136927
* Add b_bufobj to struct buf which eventually will eliminate the need for b_vp.Poul-Henning Kamp2004-10-221-4/+5
| | | | | | | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=136767
* Move the VI_BWAIT flag into no bo_flag element of bufobj and call it BO_WWAITPoul-Henning Kamp2004-10-211-3/+1
| | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=136751
* Give cluster_write() an explicit vnode argument.Poul-Henning Kamp2004-09-271-6/+1
| | | | | | | In the future a struct buf will not automatically point out a vnode for us. Notes: svn path=/head/; revision=135858
* Eliminate unused second argument to reassignbuf() and simplify itPoul-Henning Kamp2004-07-251-1/+1
| | | | | | | accordingly. Notes: svn path=/head/; revision=132640
* Remove advertising clause from University of California Regent's license,Warner Losh2004-04-051-4/+0
| | | | | | | | | per letter dated July 22, 1999. Approved by: core Notes: svn path=/head/; revision=127911
* Update the statfs structure with 64-bit fields to allowKirk McKusick2003-11-121-2/+2
| | | | | | | | | | | | | | | | | | | | accurate reporting of multi-terabyte filesystem sizes. You should build and boot a new kernel BEFORE doing a `make world' as the new kernel will know about binaries using the old statfs structure, but an old kernel will not know about the new system calls that support the new statfs structure. Running an old kernel after a `make world' will cause programs such as `df' that do a statfs system call to fail with a bad system call. Reviewed by: Bruce Evans <bde@zeta.org.au> Reviewed by: Tim Robbins <tjr@freebsd.org> Reviewed by: Julian Elischer <julian@elischer.org> Reviewed by: the hoards of <arch@freebsd.org> Sponsored by: DARPA & NAI Labs. Notes: svn path=/head/; revision=122537
* Initialize the buf's b_object in pbgetvp(). Clear it in pbrelvp(). (ThisAlan Cox2003-10-201-1/+0
| | | | | | | | | | facilitates synchronization of the vm page's valid field using the vm object's lock.) Suggested by: tegge Notes: svn path=/head/; revision=121287
* - Synchronize access to a vm page's valid field using the containingAlan Cox2003-10-201-4/+10
| | | | | | | vm object's lock. Notes: svn path=/head/; revision=121269
* DuH!Poul-Henning Kamp2003-10-181-2/+2
| | | | | | | | bp->b_iooffset (the spot on the disk), not bp->b_offset (the offset in the file) Notes: svn path=/head/; revision=121205
* Initialize bp->b_offset before calling VOP_STRATEGY()Poul-Henning Kamp2003-10-181-0/+2
| | | | Notes: svn path=/head/; revision=121200
* - Move BX_BKGRDWAIT and BX_BKGRDINPROG to BV_ and the b_vflags field.Jeff Roberson2003-08-281-7/+11
| | | | | | | | | | | | | | | | | | | | | - Surround all accesses of the BKGRD{WAIT,INPROG} flags with the vnode interlock. - Don't use the B_LOCKED flag and QUEUE_LOCKED for background write buffers. Check for the BKGRDINPROG flag before recycling or throwing away a buffer. We do this instead because it is not safe for us to move the original buffer to a new queue from the callback on the background write buffer. - Remove the B_LOCKED flag and the locked buffer queue. They are no longer used. - The vnode interlock is used around checks for BKGRDINPROG where it may not be strictly necessary. If we hold the buf lock the a back-ground write will not be started without our knowledge, one may only be completed while we're not looking. Rather than remove the code, Document two of the places where this extra locking is done. A pass should be done to verify and minimize the locking later. Notes: svn path=/head/; revision=119521
* Revert stuff which accidentally ended up in the previous commit.Poul-Henning Kamp2003-07-221-2/+2
| | | | Notes: svn path=/head/; revision=117879
* Don't attempt to inline large functions mb_alloc() and mb_free(),Poul-Henning Kamp2003-07-221-2/+2
| | | | | | | | | it more than doubles the text size of this file. GCC has wisely ignored us on this previously Notes: svn path=/head/; revision=117878
* Use __FBSDID().David E. O'Brien2003-06-111-1/+3
| | | | Notes: svn path=/head/; revision=116182
* The IO_NOWDRAIN and B_NOWDRAIN hacks are no longer needed to preventPoul-Henning Kamp2003-05-311-1/+1
| | | | | | | | | deadlocks with vnode backed md(4) devices because md now uses a kthread to run the bio requests instead of doing it directly from the bio down path. Notes: svn path=/head/; revision=115456
* In cluster_wbuild(), initialise b_iocmd to BIO_WRITE before callingIan Dowse2003-05-281-1/+3
| | | | | | | | | | | | | | | | | | buf_start() to avoid triggering a panic in softdep_disk_io_initiation() if b_iocmd happened to be BIO_READ. The later initialisation of b_iocmd in cluster_wbuild() could probably be moved to before the buf_start() call, but this patch keeps the change as simple as possible. This is reported to fix occasional "softdep_disk_io_initiation: read" panics, especially on NFS servers. Reported by: Nick Hilliard <nick@netability.ie> Tested by: Nick Hilliard <nick@netability.ie> Approved by: re (rwatson) Notes: svn path=/head/; revision=115365
* - Lock the vm_object when performing vm_object_pip_add().Alan Cox2003-04-201-0/+8
| | | | Notes: svn path=/head/; revision=113745
* - We are not guaranteed that read ahead blocks are not in memory already.Jeff Roberson2003-03-301-1/+9
| | | | | | | | Check for B_DELWRI as well as B_CACHED before issuing io on a buffer. This is especially important since we are changing the b_iocmd. Notes: svn path=/head/; revision=112838
* Including <sys/stdint.h> is (almost?) universally only to be able to usePoul-Henning Kamp2003-03-181-1/+0
| | | | | | | | %j in printfs, so put a newsted include in <sys/systm.h> where the printf prototype lives and save everybody else the trouble. Notes: svn path=/head/; revision=112367
* - Unlock the target bp and not the pager buf bp in a failure case inJeff Roberson2003-03-171-1/+1
| | | | | | | | | | cluster_wbuild(). This was causing strange panics that were widely reported on current@. Big Pointy Hat to: jeff Notes: svn path=/head/; revision=112347
* - Tune down read_max. For single disks we get no gain out of reading moreJeff Roberson2003-03-131-1/+1
| | | | | | | | | than a MAXPHYS size block ahead. Having this set too high just leaves other processes starved for IO and screws up interactive response. Let the users with RAID set it higher when they need it. Notes: svn path=/head/; revision=112175
* - Regularize variable usage in cluster_read().Jeff Roberson2003-03-111-92/+62
| | | | | | | | | | | | - Issue the io that we will later block on prior to doing cluster read ahead so that it is more likely to be ready when we block. - Loop issuing clustered reads until we've exhausted the seq count supplied by the file system. - Use a sysctl tunable "vfs.read_max" to determine the maximum number of blocks that we'll read ahead. Notes: svn path=/head/; revision=112080
* - Hold the buf lock while manipulating and inspecting its fields.Jeff Roberson2003-03-041-56/+70
| | | | | | | | | | | | | | | | | | | - Use gbincore() and not incore() so that we can drop the vnode interlock as we acquire the buflock. - Use GB_LOCK_NOWAIT when getting bufs for read ahead clusters so that we don't block on locked bufs. - Convert a while loop to a howmany() that will most likely be faster on modern processors. There is another while loop divide that was left near by because it is operating on a 64bit int and is most likely faster. - Cleanup the cluster_read() code a little to get rid of a goto and make the logic clearer. Tested on: x86, alpha Tested by: Steve Kargl <sgk@troutmask.apl.washington.edu> Reviewd by: arch Notes: svn path=/head/; revision=111886
* - Add a new 'flags' parameter to getblk().Jeff Roberson2003-03-041-4/+4
| | | | | | | | | | | | | - Define one flag GB_LOCK_NOWAIT that tells getblk() to pass the LK_NOWAIT flag to the initial BUF_LOCK(). This will eventually be used in cases were we want to use a buffer only if it is not currently in use. - Convert all consumers of the getblk() api to use this extra parameter. Reviwed by: arch Not objected to by: mckusick Notes: svn path=/head/; revision=111856
* - Add an interlock argument to BUF_LOCK and BUF_TIMELOCK.Jeff Roberson2003-02-251-3/+5
| | | | | | | | | | | | | - 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 Notes: svn path=/head/; revision=111463
* Remove duplicate includes.Olivier Houchard2003-02-201-1/+0
| | | | | | | Submitted by: Cyril Nguyen-Huu <cyril@ci0.org> Notes: svn path=/head/; revision=111161
* Back out M_* changes, per decision of the TRB.Warner Losh2003-02-191-1/+1
| | | | | | | Approved by: trb Notes: svn path=/head/; revision=111119
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.Alfred Perlstein2003-01-211-1/+1
| | | | | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT. Notes: svn path=/head/; revision=109623
* - Use %j to print intmax_t values.John Baldwin2002-11-071-3/+4
| | | | | | | - Cast more daddr_t values to intmax_t when printing to quiet warnings. Notes: svn path=/head/; revision=106597
* - Use incore() where no other interlock locking is necessary.Jeff Roberson2002-09-251-2/+6
| | | | | | | - Lock access to numoutput. Notes: svn path=/head/; revision=103931
* Replace various spelling with FALLTHROUGH which is lint()ablePhilippe Charnier2002-08-251-3/+3
| | | | Notes: svn path=/head/; revision=102412
* o Lock page accesses by vm_page_io_start() with the page queues lock.Alan Cox2002-07-311-1/+4
| | | | | | | o Assert that the page queues lock is held in vm_page_io_start(). Notes: svn path=/head/; revision=101019
* Replace the global buffer hash table with per-vnode splay trees using aMatthew Dillon2002-07-101-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | methodology similar to the vm_map_entry splay and the VM splay that Alan Cox is working on. Extensive testing has appeared to have shown no increase in overhead. Disadvantages Dirties more cache lines during lookups. Not as fast as a hash table lookup (but still N log N and optimal when there is locality of reference). Advantages vnode->v_dirtyblkhd is now perfectly sorted, making fsync/sync/filesystem syncer operate more efficiently. I get to rip out all the old hacks (some of which were mine) that tried to keep the v_dirtyblkhd tailq sorted. The per-vnode splay tree should be easier to lock / SMPng pushdown on vnodes will be easier. This commit along with another that Alan is working on for the VM page global hash table will allow me to implement ranged fsync(), optimize server-side nfs commit rpcs, and implement partial syncs by the filesystem syncer (aka filesystem syncer would detect that someone is trying to get the vnode lock, remembers its place, and skip to the next vnode). Note that the buffer cache splay is somewhat more complex then other splays due to special handling of background bitmap writes (multiple buffers with the same lblkno in the same vnode), and B_INVAL discontinuities between the old hash table and the existence of the buffer on the v_cleanblkhd list. Suggested by: alc Notes: svn path=/head/; revision=99737