Commit Graph

78 Commits

Author SHA1 Message Date
chs f80ed5892c remove PGO_WEAK, it isn't needed anymore. 2002-03-25 02:08:09 +00:00
chs 20a94bdf2d only do v3 stuff for v3 filesystems. 2002-03-23 05:00:57 +00:00
chs b4b7853b08 make sure that if NMODIFIED is clear, all pages attached to the vnode are
clean and without writable mappings.  if we try to flush dirty pages past
EOF to the server when NMODIFIED is clear, we'll update the attrcache before
doing the write, which will try to free the pages past EOF and deadlock.
to deal with this, we write-protect pages before we send them to the server,
and restrict ourselves to creating read-only mappings if NMODIFIED isn't set.
score another one for enami.
2002-03-16 23:05:25 +00:00
chs 8a910799bb use curproc instead of b_proc for NFS. that's what we want for sync commits
and it doesn't cause any problems for async commits.
2002-01-31 05:56:57 +00:00
chs 2a8b52def1 re-enable NFSv3 commit RPCs by abandoning my new approach in favor of
frank's scheme, with one new twist:  don't wait until we've totally run
out of free pages before committing, but instead notice when we've built
up a largish range of uncommitted pages and commit only the older half of
the range, which is likely to already be on disk on the server.
2002-01-26 02:52:19 +00:00
chs b4224d4d38 fix locking in nfs_getpages(). 2001-12-31 07:16:47 +00:00
chs 68b5980eb0 call VOP_PUTPAGES() directly instead of indirecting through
the UVM pager op vector.
2001-11-30 07:08:53 +00:00
lukem 0ffad69384 add RCSIDs 2001-11-10 10:59:08 +00:00
simonb 2d0469db06 Remove so variables that are only ever set and never referenced. 2001-10-13 23:25:58 +00:00
chs 64c6d1d2dc a whole bunch of changes to improve performance and robustness under load:
- remove special treatment of pager_map mappings in pmaps.  this is
   required now, since I've removed the globals that expose the address range.
   pager_map now uses pmap_kenter_pa() instead of pmap_enter(), so there's
   no longer any need to special-case it.
 - eliminate struct uvm_vnode by moving its fields into struct vnode.
 - rewrite the pageout path.  the pager is now responsible for handling the
   high-level requests instead of only getting control after a bunch of work
   has already been done on its behalf.  this will allow us to UBCify LFS,
   which needs tighter control over its pages than other filesystems do.
   writing a page to disk no longer requires making it read-only, which
   allows us to write wired pages without causing all kinds of havoc.
 - use a new PG_PAGEOUT flag to indicate that a page should be freed
   on behalf of the pagedaemon when it's unlocked.  this flag is very similar
   to PG_RELEASED, but unlike PG_RELEASED, PG_PAGEOUT can be cleared if the
   pageout fails due to eg. an indirect-block buffer being locked.
   this allows us to remove the "version" field from struct vm_page,
   and together with shrinking "loan_count" from 32 bits to 16,
   struct vm_page is now 4 bytes smaller.
 - no longer use PG_RELEASED for swap-backed pages.  if the page is busy
   because it's being paged out, we can't release the swap slot to be
   reallocated until that write is complete, but unlike with vnodes we
   don't keep a count of in-progress writes so there's no good way to
   know when the write is done.  instead, when we need to free a busy
   swap-backed page, just sleep until we can get it busy ourselves.
 - implement a fast-path for extending writes which allows us to avoid
   zeroing new pages.  this substantially reduces cpu usage.
 - encapsulate the data used by the genfs code in a struct genfs_node,
   which must be the first element of the filesystem-specific vnode data
   for filesystems which use genfs_{get,put}pages().
 - eliminate many of the UVM pagerops, since they aren't needed anymore
   now that the pager "put" operation is a higher-level operation.
 - enhance the genfs code to allow NFS to use the genfs_{get,put}pages
   instead of a modified copy.
 - clean up struct vnode by removing all the fields that used to be used by
   the vfs_cluster.c code (which we don't use anymore with UBC).
 - remove kmem_object and mb_object since they were useless.
   instead of allocating pages to these objects, we now just allocate
   pages with no object.  such pages are mapped in the kernel until they
   are freed, so we can use the mapping to find the page to free it.
   this allows us to remove splvm() protection in several places.

The sum of all these changes improves write throughput on my
decstation 5000/200 to within 1% of the rate of NetBSD 1.5
and reduces the elapsed time for "make release" of a NetBSD 1.5
source tree on my 128MB pc to 10% less than a 1.5 kernel took.
2001-09-15 20:36:31 +00:00
thorpej 9cb2396749 Make sure to add NFS vnodes to the syncerd worklist. 2001-06-27 17:33:43 +00:00
chs 11a9651c8f replace vm_page_t with struct vm_page *. 2001-05-26 21:27:10 +00:00
chs 88c05e77fe reads at or after EOF should "succeed". 2001-04-16 14:37:43 +00:00
chs d8ed86a474 handle partially full directory buffers by only using (b_bcount - b_resid)
bytes of data from the buffer.
2001-04-03 15:07:23 +00:00
chs dd82ad8e2c eliminate the VM_PAGER_* error codes in favor of the traditional E* codes.
the mapping is:

VM_PAGER_OK		        0
VM_PAGER_BAD		        <unused>
VM_PAGER_FAIL		        <unused>
VM_PAGER_PEND		        0 (see below)
VM_PAGER_ERROR		        EIO
VM_PAGER_AGAIN		        EAGAIN
VM_PAGER_UNLOCK		        EBUSY
VM_PAGER_REFAULT	        ERESTART

for async i/o requests, it used to be possible for the request to
be convert to sync, and the pager would return VM_PAGER_OK or VM_PAGER_PEND
to indicate whether the caller should perform post-i/o cleanup.
this is no longer allowed; pagers must now return 0 to indicate that
the async i/o was successfully started, and the caller never needs to
worry about doing the post-i/o cleanup.
2001-03-10 22:46:45 +00:00
chs 060e70db41 min() -> MIN(), max() -> MAX().
fixes more problems with file offsets > 4GB.
2001-02-27 04:37:44 +00:00
chs f6370c7a84 fix a couple more bugs:
- in nfs_getpages(), unbusy any pages that we don't free in the error path.
 - in nfs_putpages(), only call biowait() if we actually started any i/os.
2001-02-18 15:52:32 +00:00
chs 5706160195 fix several bugs:
- in the cases where we skip over the i/o loop, increment npages by ridx
   so that when the cleanup code starts processing the pgs array at index 0
   it'll actually process all of the pages.
 - process the PG_RELEASED flag when unbusying pages.
 - add some missing MP locking.
 - use MIN() and MAX() instead of min() and max() since the latter are
   functions which take arguments of type "int" but we call them with
   values of type "off_t", so the values could be truncated.
2001-02-05 12:27:18 +00:00
thorpej e4dc9e322e Make sure bp->b_proc is initialized. Should fix a deref-garbage-pointer
problem reported by msaitoh@netbsd.org.  NOTE: These are marked XXXUBC
since the code that allocates the bufs is new with UBC, but it may be
the case that bp->b_proc needs to be intialized to curproc (it's used
in a call to nfs_sigintr()).
2001-01-30 03:47:11 +00:00
enami 744c012068 Use uvm_aio_biodone instead of uvm_aio_aiodone for top-level buf
so that uvmexp.paging is updated if this i/o was initiated by
the pagedaemon.
2001-01-07 05:54:41 +00:00
chs 4e7404469d fix several bugs:
- fix math when skipping writing pages that just need a commit.
 - clear the needcommit stuff and PG_RDONLY flags on pages returned for
   overwrite requests as well as for normal write faults.
 - bail out of nfs_write() if we get an error.
 - remove a bogus attempt to clean up after failed uiomove()s.
 - bring over a workaround for a lock-ordering problem from the genfs code.
 - add some missing MP locking.
2000-12-27 05:15:43 +00:00
jdolecek c2cfcae955 <sys/trace.h> is not needed here 2000-12-13 18:15:56 +00:00
chs f5878a3362 only zero the part of the page after EOF if we're actually
initializing the page.
2000-12-09 22:38:23 +00:00
fvdl a0aebb0c36 Initialize 'error' to 0, so that nfs_putpages doesn't return garbage
when pages already have been committed and nothing needs to be done.
2000-12-04 12:12:20 +00:00
chs aeda8d3b77 Initial integration of the Unified Buffer Cache project. 2000-11-27 08:39:39 +00:00
bjh21 1f4240a461 Extend NFS_V2_ONLY to remove NQNFS lease support as well. Saves another 10k. 2000-09-19 23:26:25 +00:00
fvdl 899fb781e0 Move handling of B_NEEDCOMMIT buffers to nfs_doio, so that bawrite() calls
for them are actually done asynchronously. Idea taken from FreeBSD.

Do away with nfs_writebp completely, it's not needed anymore.

Keep an eye on the range of a file that needs to be committed, and
do it in heaps.
2000-09-19 22:11:47 +00:00
bjh21 33daa8de6b New kernel option, NFS_V2_ONLY, which aims to reduce the NFS client to just
that required to support NFSv2 mounts.  Not finished yet, but already
provides some 44k of saving in code size on arm26.  More savings, and some
documentation, are still to come.
2000-09-19 17:04:50 +00:00
mrg 6eeafef261 remove include of <vm/vm.h> 2000-06-27 17:52:28 +00:00
pk 72cadd83e4 Fix printf() format. 2000-05-18 08:34:26 +00:00
augustss 8529438fe6 Remove register declarations. 2000-03-30 12:51:13 +00:00
fvdl d901f6eae0 Be more careful to block bio interrupts for some data structures. There
were at least a few missed cases where vp->v_{clean,dirty}blkhd were
unprotected since the softdep/trickle sync merge.
1999-11-23 23:52:40 +00:00
fvdl 0b1963121a Add Kirk McKusick's soft updates code to the trunk. Not enabled by
default, as the copyright on the main file (ffs_softdep.c) is such
that is has been put into gnusrc. options SOFTDEP will pull this
in. This code also contains the trickle syncer.

Bump version number to 1.4O
1999-11-15 18:49:07 +00:00
mrg d2397ac5f7 completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
1999-03-24 05:50:49 +00:00
perry 4522c799a1 bzero->memset, bcopy->memcpy, bcmp->memcmp 1998-08-09 20:51:08 +00:00
fvdl 865838bfd7 Fix possible overflow problem in read size computation. 1998-06-21 22:18:16 +00:00
mrg d90485202c - add defopt's for UVM, UVMHIST and PMAP_NEW.
- remove unnecessary UVMHIST_DECL's.
1998-02-10 14:08:44 +00:00
mrg 1a8c7604f4 initial import of the new virtual memory system, UVM, into -current.
UVM was written by chuck cranor <chuck@maria.wustl.edu>, with some
minor portions derived from the old Mach code.  i provided some help
getting swap and paging working, and other bug fixes/ideas.  chuck
silvers <chuq@chuq.com> also provided some other fixes.

this is the rest of the MI portion changes.

this will be KNF'd shortly.  :-)
1998-02-05 07:59:28 +00:00
fvdl 26a975b107 Move the EOF check after getting a block out of the if() that determines
whether we get it off the wire. An nfsiod might have been busy with
it, and finished while we were waiting for it in nfs_getcacheblk, so
we need to check for EOF again no matter what.
1997-11-23 13:52:24 +00:00
fvdl aac8e91164 Oops. Fix goof in previous change. 1997-10-23 14:12:14 +00:00
fvdl 6b89492d21 Just return immediately in nfs_bioread if we got an empty buffer because
of EOF on a directory.
1997-10-22 01:45:16 +00:00
thorpej 98bb00f98f Fix alignment problems. From Frank van der Linden <fvdl@NetBSD.ORG>. 1997-10-20 22:08:44 +00:00
fvdl 6cdaaab885 Only do readaheads when reading sequential blocks; check v_lastr to
achieve this. Improves performance for demand paging. From Chris Demetriou.
1997-10-19 20:27:32 +00:00
fvdl 1cf3a3db94 * Implement optional 32 <-> 64 bit directory cookie translation. This uses
the directory cache as translation table. See nfs_subs.c for comments.
  Makes the code a bit more complex to look at than I would have liked,
  but doesn't affect the speed of the default behavior.
* Optimize caching behavior a bit when buffers are invalidated.
* Save some RPCs in readdir operations by not bothering if there is
  a small amount left to do to fill the buffer. It'll be done in the
  next RPC with a larger chunk anyway. Wastes a bit of buffer space
  but is faster.
* Make n_vattr an allocated vattr struct. This avoids nfsnode bloat,
  and is friendlier to the malloc routines.
1997-10-19 01:46:15 +00:00
fvdl 7f7d814e67 * New directory entry caching system. Provides full caching of any
directory cookie that may be thrown back at us from userspace, up
  to a size limit. Fixes double entry problem.
* Split flags for internal and external use in the NFS mount structure.
* Fix some buffer structure fields that weren're being used correctly.
* Fix missing directory cache inval call in nfs_open.
* Limit on NFS_DIRBLKSIZ no longer needed, bumped to the more reasonable
  value of 8k.
* Various other things that I forget, all related to the dir caching
  somehow, though.
1997-10-10 01:53:17 +00:00
fvdl 43e1b9384f * Deal with servers that don't give complete FSINFO (like NT)
From Olaf Seibert <rhialto@polder.ubc.kun.nl> (PR 3687)
* Make an attempt to check the maximum filesize before attempting
  a write to the server, as write RPCs will typically happen
  asynchronously, and the process will not see the error.
  Fixes problems with unexpectly truncated files at 4G
* Pass up errors in nfs_writerpc correctly
1997-07-17 23:54:27 +00:00
drochner 8c0a9bab00 Don't cast 64bit (off_t) file sizes to vm_offset_t (32bit on many
architectures), truncate them intelligently instead.
The truncation is done centralized in vnode_pager.c.
This prevents from wrap-over effects when parts of large (>2^32 byte) files
are mmapped.
Don't allow to mmap above the numerical range of vm_offset_t.
This is considered a temporary solution until the vm system handles the
object sizes/offsets more cleanly.
1997-07-04 20:22:09 +00:00
fvdl b9f22ef8f3 Only wake up one nfsiod when there is an async write to do. (from FreeBSD). 1997-04-20 16:24:44 +00:00
thorpej aa25de69d1 NFS performance improvement from Doug Rabson/FreeBSD:
Improve the queuing algorithms used by NFS' asynchronous i/o.  The
existing mechanism uses a global queue for some buffers and the
vp->b_dirtyblkhd queue for others.  This turns sequential writes into
randomly ordered writes to the server, affecting both read and write
performance.  The existing mechanism also copes badly with hung
servers, tending to block accesses to other servers when all the iods
are waiting for a hung server.

The new mechanism uses a queue for each mount point.  All asynchronous
i/o goes through this queue which preserves the ordering of requests.
A simple mechanism ensures that the iods are shared out fairly between
active mount points.

Reviewed/integrated/approved by Frank van der Linden <fvdl@netbsd.org>
1996-12-02 22:55:39 +00:00
christos bcf4552fb1 revert kprintf changes 1996-10-13 01:39:03 +00:00