aboutsummaryrefslogtreecommitdiff
path: root/sys/nfsclient/nfs_bio.c
Commit message (Collapse)AuthorAgeFilesLines
* Add comment to clarify a commit rpc optimization already being performed.Matthew Dillon1999-09-201-0/+8
| | | | Notes: svn path=/head/; revision=51475
* Asynchronized client-side nfs_commit. NFS commit operations wereMatthew Dillon1999-09-171-3/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | previously issued synchronously even if async daemons (nfsiod's) were available. The commit has been moved from the strategy code to the doio code in order to asynchronize it. Removed use of lastr in preparation for removal of vnode->v_lastr. It has been replaced with seqcount, which is already supported by the system and, in fact, gives us a better heuristic for sequential detection then lastr ever did. Made major performance improvements to the server side commit. The server previously fsync'd the entire file for each commit rpc. The server now bawrite()s only those buffers related to the offset/size specified in the commit rpc. Note that we do not commit the meta-data yet. This works still needs to be done. Note that a further optimization can be done (and has not yet been done) on the client: we can merge multiple potential commit rpc's into a single rpc with a greater file offset/size range and greatly reduce rpc traffic. Reviewed by: Alan Cox <alc@cs.rice.edu>, David Greenman <dg@root.com> Notes: svn path=/head/; revision=51344
* $Id$ -> $FreeBSD$Peter Wemm1999-08-281-1/+1
| | | | Notes: svn path=/head/; revision=50477
* Add the (inline) function vm_page_undirty for clearing the dirty bitmaskAlan Cox1999-08-171-3/+3
| | | | | | | | | | | of a vm_page. Use it. Submitted by: dillon Notes: svn path=/head/; revision=49945
* nfs_getcacheblk() can return 0 if the mount is interruptible. It need to beDmitrij Tejblum1999-08-121-1/+5
| | | | | | | | | checked by the caller. Broken in: rev. 1.70 (1999/05/02) Notes: svn path=/head/; revision=49659
* Convert buffer locking from using the B_BUSY and B_WANTED flags to usingKirk McKusick1999-06-261-1/+2
| | | | | | | | | | lockmgr locks. This commit should be functionally equivalent to the old semantics. That is, all buffer locking is done with LK_EXCLUSIVE requests. Changes to take advantage of LK_SHARED and LK_RECURSIVE will be done in future commits. Notes: svn path=/head/; revision=48225
* Add a vnode argument to VOP_BWRITE to get rid of the last vnodeKirk McKusick1999-06-161-3/+3
| | | | | | | | operator special case. Delete special case code from vnode_if.sh, vnode_if.src, umap_vnops.c, and null_vnops.c. Notes: svn path=/head/; revision=47964
* Don't mistake a non-async block that needs to be committed for anPeter Wemm1999-06-051-2/+2
| | | | | | | | | interrupted write. Obtained from: fvdl@NetBSD.org via OpenBSD. Notes: svn path=/head/; revision=47749
* remove b_proc from struct buf, it's (now) unused.Poul-Henning Kamp1999-05-061-9/+7
| | | | | | | Reviewed by: dillon, bde Notes: svn path=/head/; revision=46580
* The VFS/BIO subsystem contained a number of hacks in order to optimizeAlan Cox1999-05-021-173/+240
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | piecemeal, middle-of-file writes for NFS. These hacks have caused no end of trouble, especially when combined with mmap(). I've removed them. Instead, NFS will issue a read-before-write to fully instantiate the struct buf containing the write. NFS does, however, optimize piecemeal appends to files. For most common file operations, you will not notice the difference. The sole remaining fragment in the VFS/BIO system is b_dirtyoff/end, which NFS uses to avoid cache coherency issues with read-merge-write style operations. NFS also optimizes the write-covers-entire-buffer case by avoiding the read-before-write. There is quite a bit of room for further optimization in these areas. The VM system marks pages fully-valid (AKA vm_page_t->valid = VM_PAGE_BITS_ALL) in several places, most noteably in vm_fault. This is not correct operation. The vm_pager_get_pages() code is now responsible for marking VM pages all-valid. A number of VM helper routines have been added to aid in zeroing-out the invalid portions of a VM page prior to the page being marked all-valid. This operation is necessary to properly support mmap(). The zeroing occurs most often when dealing with file-EOF situations. Several bugs have been fixed in the NFS subsystem, including bits handling file and directory EOF situations and buf->b_flags consistancy issues relating to clearing B_ERROR & B_INVAL, and handling B_DONE. getblk() and allocbuf() have been rewritten. B_CACHE operation is now formally defined in comments and more straightforward in implementation. B_CACHE for VMIO buffers is based on the validity of the backing store. B_CACHE for non-VMIO buffers is based simply on whether the buffer is B_INVAL or not (B_CACHE set if B_INVAL clear, and vise-versa). biodone() is now responsible for setting B_CACHE when a successful read completes. B_CACHE is also set when a bdwrite() is initiated and when a bwrite() is initiated. VFS VOP_BWRITE routines (there are only two - nfs_bwrite() and bwrite()) are now expected to set B_CACHE. This means that bowrite() and bawrite() also set B_CACHE indirectly. There are a number of places in the code which were previously using buf->b_bufsize (which is DEV_BSIZE aligned) when they should have been using buf->b_bcount. These have been fixed. getblk() now clears B_DONE on return because the rest of the system is so bad about dealing with B_DONE. Major fixes to NFS/TCP have been made. A server-side bug could cause requests to be lost by the server due to nfs_realign() overwriting other rpc's in the same TCP mbuf chain. The server's kernel must be recompiled to get the benefit of the fixes. Submitted by: Matthew Dillon <dillon@apollo.backplane.com> Notes: svn path=/head/; revision=46349
* Hold nfsd's upages in-core with PHOLD rather than P_NOSWAP.Peter Wemm1999-04-061-2/+2
| | | | Notes: svn path=/head/; revision=45361
* Catch a case spotted by Tor where files mmapped could leave garbage in theJulian Elischer1999-04-051-10/+46
| | | | | | | | | | | | | | | unallocated parts of the last page when the file ended on a frag but not a page boundary. Delimitted by tags PRE_MATT_MMAP_EOF and POST_MATT_MMAP_EOF, in files alpha/alpha/pmap.c i386/i386/pmap.c nfs/nfs_bio.c vm/pmap.h vm/vm_page.c vm/vm_page.h vm/vnode_pager.c miscfs/specfs/spec_vnops.c ufs/ufs/ufs_readwrite.c kern/vfs_bio.c Submitted by: Matt Dillon <dillon@freebsd.org> Reviewed by: Alan Cox <alc@freebsd.org> Notes: svn path=/head/; revision=45347
* Reviewed by: Many at differnt times in differnt parts,Julian Elischer1999-03-121-21/+36
| | | | | | | | | | | | | | | | | | | | | | | | | including alan, john, me, luoqi, and kirk Submitted by: Matt Dillon <dillon@frebsd.org> This change implements a relatively sophisticated fix to getnewbuf(). There were two problems with getnewbuf(). First, the writerecursion can lead to a system stack overflow when you have NFS and/or VN devices in the system. Second, the free/dirty buffer accounting was completely broken. Not only did the nfs routines blow it trying to manually account for the buffer state, but the accounting that was done did not work well with the purpose of their existance: figuring out when getnewbuf() needs to sleep. The meat of the change is to kern/vfs_bio.c. The remaining diffs are all minor except for NFS, which includes both the fixes for bp interaction AND fixes for a 'biodone(): buffer already done' lockup. Sys/buf.h also contains a chaining structure which is not used by this patchset but is used by other patches that are coming soon. This patch deliniated by tags PRE_MAT_GETBUF and POST_MAT_GETBUF. (sorry for the missing T matt) Notes: svn path=/head/; revision=44679
* This is a rather large commit that encompasses the new swapper,Matthew Dillon1999-01-211-11/+27
| | | | | | | | | | | | | changes to the VM system to support the new swapper, VM bug fixes, several VM optimizations, and some additional revamping of the VM code. The specific bug fixes will be documented with additional forced commits. This commit is somewhat rough in regards to code cleanup issues. Reviewed by: "John S. Dyson" <root@dyson.iquest.net>, "David Greenman" <dg@root.com> Notes: svn path=/head/; revision=42957
* (Hopefully) fix support for "large" files. Mostly cast block numbers to off_tDmitrij Tejblum1998-12-141-13/+13
| | | | | | | before they multiplied to block sizes. Notes: svn path=/head/; revision=41791
* The "easy" fixes for compiling the kernel -Wunused: remove unreferenced staticArchie Cobbs1998-12-071-3/+1
| | | | | | | and local variables, goto labels, and functions declared but not defined. Notes: svn path=/head/; revision=41591
* Remove [apparently] bogus casts to u_long for the vnode_pager_setsize()Peter Wemm1998-11-091-2/+2
| | | | | | | | | | second argument. np_size is a 64 bit int, so is the second arg. This might have caused needless 2G/4G file size problems. I believe it was Bruce who queried this. Notes: svn path=/head/; revision=41026
* Mark directory buffers that have no valid data with B_INVALKirk McKusick1998-09-291-1/+6
| | | | | | | so that they are not put in the cache. Notes: svn path=/head/; revision=39782
* When adding data to a buffer, we need to clear the B_NEEDCOMMIT flagKirk McKusick1998-09-291-1/+2
| | | | | | | which says that the data is on server but not committed. Notes: svn path=/head/; revision=39781
* Cosmetic changes to the PAGE_XXX macros to make them consistent withDoug Rabson1998-09-041-2/+2
| | | | | | | the other objects in vm. Notes: svn path=/head/; revision=38799
* Avoid an egcs pessimization for 64-bit signed division on i386's.Bruce Evans1998-06-141-2/+2
| | | | | | | | | | | | Pre-2.8 versions of gcc generate a call to __divdi3() for all 64-bit signed divisions, but egcs optimizes them to a shift and fixup when the divisor is a constant power of 2. Unfortunately, it generates a call to __cmpdi2() for the fixup, although all except possibly ancient versions of gcc and egcs do ordinary 64-bit comparisons inline. Notes: svn path=/head/; revision=36979
* Make sure we go a nfs_fsinfo() in get/putpages before callingPeter Wemm1998-06-011-30/+70
| | | | | | | | | | | readrpc/writerpc, since they assume it's already been done. This could break if the first read/write access to a nfs filesystem was an exec() or mmap() instead of a read(), write() syscall. (or statfs()). nfs_getpages() could return an errno (EOPNOTSUPP) instead of a VM_PAGER_* return code. Some layout tweaks for the get/putpages code. Notes: svn path=/head/; revision=36563
* When using NFSv3, use the remote server's idea of the maximum file sizePeter Wemm1998-05-301-2/+7
| | | | | | | | | | | | | | | | | | | rather than assuming 2^64. It may not like files that big. :-) On the nfs server, calculate and report the max file size as the point that the block numbers in the cache would turn negative. (ie: 1099511627775 bytes (1TB)). One of the things I'm worried about however, is that directory offsets are really cookies on a NFSv3 server and can be rather large, especially when/if the server generates the opaque directory cookies by using a local filesystem offset in what comes out as the upper 32 bits of the 64 bit cookie. (a server is free to do this, it could save byte swapping depending on the native 64 bit byte order) Obtained from: NetBSD Notes: svn path=/head/; revision=36473
* A cleaner fix for PR#5102, clear nonsense flags at mount time rather thanPeter Wemm1998-05-201-3/+1
| | | | | | | | | in the core of nfs_bio.c at the 11th hour. PR: 5102 Notes: svn path=/head/; revision=36248
* Allow control of the attribute cache timeouts at mount time.Peter Wemm1998-05-191-3/+5
| | | | | | | | | We had run out of bits in the nfs mount flags, I have moved the internal state flags into a seperate variable. These are no longer visible via statfs(), but I don't know of anything that looks at them. Notes: svn path=/head/; revision=36176
* Don't allow the readdirplus routine to be used in NFS V2.Steve Price1998-03-281-1/+3
| | | | | | | | | PR: 5102 Reviewed by: msmith Submitted by: Dmitry Kohmanyuk <dk@farm.org> Notes: svn path=/head/; revision=34930
* Reviewed by: dyson@freebsd.org (john Dyson), dg@root.com (david greenman)Julian Elischer1998-03-081-1/+5
| | | | | | | | Submitted by: Kirk McKusick (mcKusick@mckusick.com) Obtained from: WHistle development tree Notes: svn path=/head/; revision=34266
* This mega-commit is meant to fix numerous interrelated problems. ThereJohn Dyson1998-03-071-22/+145
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | has been some bitrot and incorrect assumptions in the vfs_bio code. These problems have manifest themselves worse on NFS type filesystems, but can still affect local filesystems under certain circumstances. Most of the problems have involved mmap consistancy, and as a side-effect broke the vfs.ioopt code. This code might have been committed seperately, but almost everything is interrelated. 1) Allow (pmap_object_init_pt) prefaulting of buffer-busy pages that are fully valid. 2) Rather than deactivating erroneously read initial (header) pages in kern_exec, we now free them. 3) Fix the rundown of non-VMIO buffers that are in an inconsistent (missing vp) state. 4) Fix the disassociation of pages from buffers in brelse. The previous code had rotted and was faulty in a couple of important circumstances. 5) Remove a gratuitious buffer wakeup in vfs_vmio_release. 6) Remove a crufty and currently unused cluster mechanism for VBLK files in vfs_bio_awrite. When the code is functional, I'll add back a cleaner version. 7) The page busy count wakeups assocated with the buffer cache usage were incorrectly cleaned up in a previous commit by me. Revert to the original, correct version, but with a cleaner implementation. 8) The cluster read code now tries to keep data associated with buffers more aggressively (without breaking the heuristics) when it is presumed that the read data (buffers) will be soon needed. 9) Change to filesystem lockmgr locks so that they use LK_NOPAUSE. The delay loop waiting is not useful for filesystem locks, due to the length of the time intervals. 10) Correct and clean-up spec_getpages. 11) Implement a fully functional nfs_getpages, nfs_putpages. 12) Fix nfs_write so that modifications are coherent with the NFS data on the server disk (at least as well as NFS seems to allow.) 13) Properly support MS_INVALIDATE on NFS. 14) Properly pass down MS_INVALIDATE to lower levels of the VM code from vm_map_clean. 15) Better support the notion of pages being busy but valid, so that fewer in-transit waits occur. (use p->busy more for pageouts instead of PG_BUSY.) Since the page is fully valid, it is still usable for reads. 16) It is possible (in error) for cached pages to be busy. Make the page allocation code handle that case correctly. (It should probably be a printf or panic, but I want the system to handle coding errors robustly. I'll probably add a printf.) 17) Correct the design and usage of vm_page_sleep. It didn't handle consistancy problems very well, so make the design a little less lofty. After vm_page_sleep, if it ever blocked, it is still important to relookup the page (if the object generation count changed), and verify it's status (always.) 18) In vm_pageout.c, vm_pageout_clean had rotted, so clean that up. 19) Push the page busy for writes and VM_PROT_READ into vm_pageout_flush. 20) Fix vm_pager_put_pages and it's descendents to support an int flag instead of a boolean, so that we can pass down the invalidate bit. Notes: svn path=/head/; revision=34206
* Trivial filesystem getpages/putpages implementations, set the second.Mike Smith1998-03-061-1/+16
| | | | | | | | These should be considered the first steps in a work-in-progress. Submitted by: Terry Lambert <terry@freebsd.org> Notes: svn path=/head/; revision=34096
* Back out DIAGNOSTIC changes.Eivind Eklund1998-02-061-2/+1
| | | | Notes: svn path=/head/; revision=33134
* Turn DIAGNOSTIC into a new-style option.Eivind Eklund1998-02-041-1/+2
| | | | Notes: svn path=/head/; revision=33108
* Release the buffer when an error occurs while reading directory entries.Tor Egge1998-01-311-3/+6
| | | | Notes: svn path=/head/; revision=32912
* Various NFS fixes:John Dyson1998-01-251-87/+78
| | | | | | | | | | | | | | | | | | | Make vfs_bio buffer mgmt work better. Buffers were being used after brelse. Make nfs_getpages work independently of other NFS interfaces. This eliminates some difficult recursion problems and decreases pagefault overhead. Remove an erroneous vfs_unbusy_pages. Fix a reentrancy problem, with nfs_vinvalbuf when vnode is already being rundown. Reassignbuf wasn't being called when needed under certain circumstances. (Thanks to Bill Paul for help.) Notes: svn path=/head/; revision=32755
* Make our v_usecount vnode reference count work identically to theJohn Dyson1998-01-061-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | original BSD code. The association between the vnode and the vm_object no longer includes reference counts. The major difference is that vm_object's are no longer freed gratuitiously from the vnode, and so once an object is created for the vnode, it will last as long as the vnode does. When a vnode object reference count is incremented, then the underlying vnode reference count is incremented also. The two "objects" are now more intimately related, and so the interactions are now much less complex. When vnodes are now normally placed onto the free queue with an object still attached. The rundown of the object happens at vnode rundown time, and happens with exactly the same filesystem semantics of the original VFS code. There is absolutely no need for vnode_pager_uncache and other travesties like that anymore. A side-effect of these changes is that SMP locking should be much simpler, the I/O copyin/copyout optimizations work, NFS should be more ponderable, and further work on layered filesystems should be less frustrating, because of the totally coherent management of the vnode objects and vnodes. Please be careful with your system while running this code, but I would greatly appreciate feedback as soon a reasonably possible. Notes: svn path=/head/; revision=32286
* Various of the ISP users have commented that the 1.41 version of theJohn Dyson1997-12-081-115/+19
| | | | | | | | | nfs_bio.c code worked better than the 1.44. This commit reverts the important parts of 1.44 to 1.41, and we will fix it when we can get a handle on the problem. Notes: svn path=/head/; revision=31617
* unifdef -U__NetBSD__ -D__FreeBSD__Poul-Henning Kamp1997-09-101-5/+1
| | | | Notes: svn path=/head/; revision=29288
* Removed unused #includes.Bruce Evans1997-08-021-3/+1
| | | | Notes: svn path=/head/; revision=27845
* Avoid small synchronous writes when an application does lots of random-accessDoug Rabson1997-06-251-19/+115
| | | | | | | short writes within a block (e.g. ld). Notes: svn path=/head/; revision=26929
* Upgrade NFS to support the new vfs_bio resource/buffer management.John Dyson1997-06-161-1/+2
| | | | Notes: svn path=/head/; revision=26669
* Fix a problem caused by removing large numbers of files from a directoryDoug Rabson1997-06-061-2/+6
| | | | | | | which could cause a bad size to be given to uiomove, causing a page fault. Notes: svn path=/head/; revision=26469
* Fix some performance problems with the NFS mmap fixes.Doug Rabson1997-06-031-4/+4
| | | | Notes: svn path=/head/; revision=26409
* Fix a few bugs with NFS and mmap caused by NFS' use of b_validoffDoug Rabson1997-05-191-2/+83
| | | | | | | | | | | and b_validend. The changes to vfs_bio.c are a bit ugly but hopefully can be tidied up later by a slight redesign. PR: kern/2573, kern/2754, kern/3046 (possibly) Reviewed by: dyson Notes: svn path=/head/; revision=25930
* Check the B_CLUSTER flag when choosing whether to use unstable or filesyncDoug Rabson1997-05-131-2/+2
| | | | | | | | | | writes. PR: kern/3438 Submitted by: Tor Egge <Tor.Egge@idi.ntnu.no> Notes: svn path=/head/; revision=25785
* Fix a bug where a program which appended many small records to a file couldDoug Rabson1997-04-191-1/+3
| | | | | | | | | | | | | | | | wind up writing zeros instead of real data when the file is on an NFSv2 mounted directory. While tracking this bug down, I noticed that nfs_asyncio was waking *all* the iods when a block was written instead of just one per block. Fixing this gives a 25% performance improvment for writes on v2 (less for v3). Both are 2.2 candidates. PR: kern/2774 Notes: svn path=/head/; revision=25023
* Don't allow partial buffers to be cluster-comitted.Doug Rabson1997-04-181-4/+7
| | | | | | | | | | Zero the b_dirty{off,end} after cluster-comitting a group of buffers. With these fixes, I was able to complete a 'make world' with remote src and obj directories. Notes: svn path=/head/; revision=25003
* The code which recovered from a modified directory situation did not checkDoug Rabson1997-04-031-1/+8
| | | | | | | | for eof when re-caching the directory. This could cause it to loop forever if a directory was truncated. Notes: svn path=/head/; revision=24577
* YAMInTheWrongDirectionF22 (part of rev.1.28.2.3: set B_CLUSTEROK forBruce Evans1997-03-091-2/+2
| | | | | | | commits). Notes: svn path=/head/; revision=23570
* Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are notPeter Wemm1997-02-221-1/+1
| | | | | | | ready for it yet. Notes: svn path=/head/; revision=22975
* This is the kernel Lite/2 commit. There are some requisite userlandJohn Dyson1997-02-101-21/+5
| | | | | | | | | | | | | | | | | | changes, so don't expect to be able to run the kernel as-is (very well) without the appropriate Lite/2 userland changes. The system boots and can mount UFS filesystems. Untested: ext2fs, msdosfs, NFS Known problems: Incorrect Berkeley ID strings in some files. Mount_std mounts will not work until the getfsent library routine is changed. Reviewed by: various people Submitted by: Jeffery Hsu <hsu@freebsd.org> Notes: svn path=/head/; revision=22521
* Make the long-awaited change from $Id$ to $FreeBSD$Jordan K. Hubbard1997-01-141-1/+1
| | | | | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise. Notes: svn path=/head/; revision=21673