Commit Graph

110 Commits

Author SHA1 Message Date
yamt c2025ab0ea change n_mtime from time_t to timespec in order to improve
cache consistency.
(1 second granularity is too loose these days.)
2003-09-26 11:51:53 +00:00
yamt 883426c958 don't call nfs_delayedtruncate() from nfs_getpages().
it causes simplelock deadlock.
2003-09-17 09:11:12 +00:00
pk e881551a43 VOP_PUTPAGES() must be called with the vnode's interlock held. 2003-08-26 16:40:10 +00:00
agc aad01611e7 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22364, verified by myself.
2003-08-07 16:26:28 +00:00
pk 09f1c82201 Make life slightly easier for the compiler's optimisation routines. 2003-08-03 18:20:53 +00:00
fvdl d5aece61d6 Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
2003-06-29 22:28:00 +00:00
darrenr 960df3c8d1 Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records.  The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
2003-06-28 14:20:43 +00:00
yamt c8ad6cc17b interlock for NFLUSHINPROG/NFLUSHWANT. 2003-05-22 15:59:24 +00:00
yamt ddd5ced644 eliminate memcpy in the common and easy case of write. 2003-05-21 13:27:19 +00:00
yamt 4811ccb6a0 correct a KASSERT. 2003-05-16 17:16:05 +00:00
yamt 19bdd5d1e5 acquire vmobjlock when touch pg->flags. 2003-05-15 14:34:06 +00:00
yamt de31ef25cd simple lock for nfs iod. 2003-05-07 16:18:53 +00:00
yamt 3698fcc62e - check page's offset in the object as well. (pointed by Chuck Silvers.)
- remove false assertion.
2003-05-03 17:27:20 +00:00
yamt 455e4333eb - if writerpc ends with a stable result, no need to commit them anymore.
- add comments.
2003-05-03 16:46:39 +00:00
yamt 8c5ba805e5 better handling of write verifier change. 2003-05-03 16:28:57 +00:00
yamt 8178e19cb6 fix a use of an uninitialized variable. 2003-04-18 15:19:02 +00:00
yamt 63de87c34b remove line-wrapping that is no longer needed. 2003-04-15 13:48:40 +00:00
yamt dcf4c9093f fix a typo in the previous. 2003-04-12 14:41:28 +00:00
yamt 1505b097fa set b_resid correctly. 2003-04-12 14:38:57 +00:00
yamt 9ad479d8c2 split nfs_doio to nfs_doio_{phys,read,write} to avoid too deep indents. 2003-04-12 14:26:58 +00:00
yamt 043759a005 - do FILESYNC writes if we're freeing the page or the page doesn't
belong to us.  otherwise, data will be lost on server crash.
- use b_bcount instead of b_bufsize to determine
  how many pages we should deal with.

based on a patch from Chuck Silvers.
discussed on tech-kern.
2003-04-12 06:53:09 +00:00
yamt 65e3d14a8a rename a very confusing variable name.
(must_commit -> stalewriteverf)
2003-04-09 14:30:30 +00:00
yamt b90af31ce6 when commit failed and fall to write, re-set 'off' and 'cnt'
because it can be changed in 'needcommit' path.
2003-04-09 14:27:58 +00:00
yamt 9b96b4ab78 make per-iod datas together. 2003-04-09 14:22:33 +00:00
thorpej b78f59b443 Merge the nathanw_sa branch. 2003-01-18 08:51:40 +00:00
yamt 059aba1c85 fix panic (assertion failure) on error case.
if uiomove is failed, we should clean up pages past eof.

the problem reported by kay.
ok'ed by Chuck Silvers.
2002-10-29 10:15:16 +00:00
jdolecek e0cc03a09b merge kqueue branch into -current
kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
2002-10-23 09:10:23 +00:00
yamt 005c29fafb fix a page locking deadlock problem for nfs.
add a flag that specify if the file can be truncated safely or not
to nfsm_loadattr and friends.  when it isn't safe, just mark the nfsnode
as "should be truncated later".

ok'ed by Frank van der Linden and Chuck Silvers.
close kern/18036.
2002-10-21 12:52:32 +00:00
bouyer 3a7aeb79ca nfs_doio(): handle the case where nfs_writerpc() returned error != 0.
Fix kern/18125. OK'd by thorpej and chs.
2002-09-01 10:39:38 +00:00
enami 59a79c7928 Remove wrong assertion in previous commit. 2002-05-06 03:20:54 +00:00
enami cfa571e2e2 The per nfsnode n_commitlock is a sleep lock, but we can't sleep if
PGO_LOCKED getpages request.  So, just make the lock fail and tell
the caller that there is no pages available if we can't acquire it.
The caller will call us again soon without PGO_LOCKED.  Reviewed by chuq.
2002-05-06 00:07:51 +00:00
chs a5838679d1 only use UBC_FAULTBUSY to access offsets past EOF,
otherwise we can deadlock trying to busy the same page in uiomove().
2002-04-10 03:06:57 +00:00
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