Commit Graph

79 Commits

Author SHA1 Message Date
enami 9e1deeab34 Add missing pageq lock while uvm_pagefree() is called (either directly
or indirectly).  Reviewed by chuq.
2002-05-29 11:04:39 +00:00
enami 1578726840 Just give up to do readahead rather than waiting busy pages.
While I'm here, added few patchable variable so that one can
easily measure readahead behaviour.
2002-05-18 02:54:57 +00:00
perseant 3fa1c8abe9 Protect v_synclist with splbio(); note that LIST_REMOVE is not an idempotent
operation if more than one LIST_REMOVE happens on interrupt, so both the test
for VONWORKLIST and the LIST_REMOVE(vp, v_synclist) need to be in splbio().
2002-05-14 19:37:18 +00:00
enami 293906a53a Redo rev. 1.57 a bit different way; don't use `tpg' since it may be freed.
Subtract the number of pages behind us when calculating new offset instead.
2002-05-10 07:51:37 +00:00
enami 911c9febb2 Don't modify the local variable `n' in genfs_putpages(). It should contain
the number of elements in the page array at the beginning of every iteration.
2002-05-10 02:51:44 +00:00
enami e3cc9c0682 When traversing by list, if the page next to us is a page in the cluster,
advance the pointer.
2002-05-09 07:22:09 +00:00
enami fabaf9a730 - In genfs_putpages(), no need to restrict the cluster within the given
region.
- In uvm_aio_aiodone(), remove assertions no longer true.
2002-05-09 07:14:37 +00:00
enami 8876669f4c Since npages may includes number of pages behind us, we can't use it to
update current offset.  Instead, use the last page in the run of pages
to calculate new offset.
2002-05-06 00:42:22 +00:00
enami e6513c283e Stylistic change; introduce new local variable and use it instead of
sprinkling different expression to test if we're pagedaemon.
2002-05-06 00:18:15 +00:00
enami 6335b88f05 We don't need to re-activate page in genfs_putpages() when GOP_WRITE returns
ENOMEM (temporary memory shortage) since it is already handled in
uvm_aio_aiodone() for both async/sync case.  Discussed with chuq.
2002-04-26 03:57:31 +00:00
enami 6cfcfb947c genfs_{compat_}getpages(): For PGO_LOCKED request, it is safe to return
read only page if it was due to read fault.  This avoid many unnecessary
read fault introduced by recent nfs_bio.c change.  Reviewed by chuq.
2002-04-16 06:05:05 +00:00
enami 08625200a0 KNF and other misc. cosmetic changes. 2002-04-16 06:00:46 +00:00
chs 72c455ce83 in genfs_compat_getpages(), clear any part of a page that
VOP_READ() doesn't fill in (eg. because it's past EOF).
2002-03-22 03:51:51 +00:00
atatat 31144d9976 Convert ioctl code to use EPASSTHROUGH instead of -1 or ENOTTY for
indicating an unhandled "command".  ERESTART is -1, which can lead to
confusion.  ERESTART has been moved to -3 and EPASSTHROUGH has been
placed at -4.  No ioctl code should now return -1 anywhere.  The
ioctl() system call is now properly restartable.
2002-03-17 19:40:26 +00:00
chs a51be40dcb don't yield the cpu in genfs_putpages() if we're the pagedaemon.
pointed out by enami.  fixes PR 15784.
2002-03-02 06:58:01 +00:00
enami 9a623b9870 Don't use MALLOC for variable sized allocation. 2002-02-20 06:16:22 +00:00
chs 96f907f394 fix two problems:
- when yielding the cpu while using the vnode's page list, use a marker page
   to keep our place in the list (like the other cases where we drop the lock).
 - wait until no one else has the page busy before deciding if the page needs
   to be cleaned.  a page will be dirty while it's being initialized but will
   be marked clean before PG_BUSY is cleared.
both found by enami.
2002-02-19 15:49:39 +00:00
enami fe24174a3b Don't bother to subtract 0. 2002-02-13 05:20:41 +00:00
enami 52a2a21502 Don't leave junk in pgs[] array since it will be passed to uvn_findpages()
again.
2002-02-12 01:08:12 +00:00
chs 0365a63944 in genfs_putpages():
- yield the cpu if we've taken too long.
 - when traversing by offset, skip over any pages that we clustered.
2002-01-26 02:44:27 +00:00
chs 03ea276e84 in genfs_gop_write(), actually set the B_ASYNC flag on buffers that we're
not going to wait for.  this doesn't matter for real devices since we call
VOP_STRATEGY() directly, but NFS uses this flag to decide whether or not
to hand the buffer off to an nfsiod thread.
2001-12-31 06:44:58 +00:00
chs 64b0c2adbb in genfs_putpages(), we must wait for any pending write i/os to complete
if the putpages request is synchronous.
2001-12-31 06:40:08 +00:00
chs 40bf5f0e12 add some compatibility routines to allow mmap() to work non-UBCified
filesystems (in the same non-coherent fashion that they worked before).
2001-12-18 07:49:36 +00:00
chs 4d14671458 add VOP_GETPAGES and VOP_PUTPAGES methods for layered filesystems.
drop the interlock on the upper layer, acquire the interlock on the
lower layer.
2001-12-06 04:29:23 +00:00
chs 5a690c92a1 add a VOP_PUTPAGES method for all the filesystems that don't have pages,
just unlock the interlock.
2001-12-06 04:27:40 +00:00
christos 420771d7cc PR/14781: Matthew Fredette: Clamp the number of read-ahead pages to 16 because
other code has this limit. Also while I am here, convert the magic 16 into
a #define constant and use it in the appropriate places. This is a temporary
fix, since all this read-ahead business is XXXUBC anyway.
2001-11-30 15:18:39 +00:00
lukem 2565646230 don't need <sys/types.h> when including <sys/param.h> 2001-11-15 09:47:59 +00:00
lukem e4b00f433c add RCSIDs 2001-11-10 13:33:40 +00:00
enami 6e46b6ec2c s/genfs_do_putpages/genfs_gop_write/ in uvmhist. 2001-10-03 14:13:08 +00:00
chs 4111c37251 when zeroing pages past EOF, don't zero the page containing EOF if it
already contains valid data.  should fix PRs 13361 and 13436.
2001-09-21 07:52:25 +00:00
chs 5f5ac77eff add a forward decl for struct vm_page. 2001-09-15 22:38:40 +00:00
chs 099a6b5258 interfaces and structures used by new genfs_{get,put}pages(). 2001-09-15 21:33:05 +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
chs 5a4fdb6ddb make genfs get/put work for block devices as well:
- the "fs bshift" for block devices is always DEV_BSHIFT.
 - retrieve the device vnode from VOP_BMAP() and use that to set b_dev
   in page i/o buffers.
2001-08-17 05:51:29 +00:00
assar bec71dc090 change vop_symlink and vop_mknod to return vpp (the created node)
refed, so that the caller can actually use it.  update callers and
file systems that implement these vnode operations
2001-07-24 15:39:30 +00:00
chs 766dfc9b6f be sure to allocate dirty zeroed pages to cover blocks we allocate
to resolve a write fault.  fixes PR 13201.
also, be sure to allocate blocks for write faults to holes even if
the page is already in memory.  fixes PR 13189.
2001-06-14 08:22:14 +00:00
wiz fa87a2091d Typos in comments (misc/13133 by Michael K. Sanders) 2001-06-07 13:32:46 +00:00
chs 45701591c6 add a genfs_mmap() and change all of the disk-based filesystems
to implement VOP_MMAP() with the genfs version, in preparation for
actually using this VOP.
2001-05-28 02:50:51 +00:00
chs 11a9651c8f replace vm_page_t with struct vm_page *. 2001-05-26 21:27:10 +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 667e1805e6 in genfs_getpages(), don't try to optimize zeroing past EOF.
fixes PR 12297.
2001-02-28 02:59:19 +00:00
chs f87a22a66b distinguish between a file's in-memory EOF (which marks the offset at
which we disallow creation of page cache pages) and its on-disk EOF
(which marks the offset at which there is not (yet) data on disk that
we need to read when creating pages).  for requests with PGO_PASTEOF,
the in-memory EOF maybe be much larger than the on-disk EOF.
2001-02-27 02:57:02 +00:00
chs 1a5818b05e fix a couple more bugs:
- in genfs_getpages(), unbusy any pages that we don't free in the error path.
 - in genfs_putpages(), if we get a bmap error, record that in the master buf.
2001-02-18 15:03:42 +00:00
fvdl f12c24a45c Oops, removal unintenionally commited debug code. 2001-02-12 19:12:10 +00:00
fvdl dd32618956 Format arg nit. 2001-02-12 17:41:49 +00:00
chs 8c14e1d2db 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.
 - in the PGO_PASTEOF case, use the larger of the current file size and the
   end of the requested range of pages as the file size for this request.
   this fixes some problems with sparsing writes to large offsets.
2001-02-05 12:26:08 +00:00
fvdl f4ddf5e1b6 Cast lbn to off_t in a few places, to avoid daddr_t overflow and all sorts
of havoc. From Bill Sommerfeld.
2001-01-22 16:39:54 +00:00
chs 68b98ea45f several bugs:
- in genfs_getpages() don't start read-ahead if we get an error on the
   sync read, and always start read-ahead after the range of the sync read
   if we do any at all.
 - off-by-one error in genfs_size().
2000-12-27 04:47:43 +00:00
enami 0088605039 Don't cache a device vnode in a layer node cache once the layer node
is inactivated.  Otherwise, the device won't closed.
2000-12-21 03:51:02 +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