Commit Graph

51 Commits

Author SHA1 Message Date
fvdl 3d8b2ffe36 Bring over fixes from FreeBSD that weren't incorporated yet, mainly
from Kirk McKusick. They implement taking pending block/inode frees
into account for the sake of correct statfs() numbers, and adding
a new softdep type (newdirblk) to correctly handle newly allocated
directory blocks.

Minor additional changes: 1) swap the newly introduced fs_pendinginodes
and fs_pendingblock fields in ffs_sb_swap, and 2) declare lkt_held
in the debug version of the softdep lock structure volatile, as it
can be modified from interrupt context #ifdef DEBUG.
2001-12-18 10:57:21 +00:00
chs 03dd7ce1e8 when truncating a file, make sure the last block of the file is actually
allocated, since other parts of the code assume this.
2001-12-18 06:50:28 +00:00
chs 9958c29316 VOP_PUTPAGES() requires page-aligned offsets, so be sure to provide such.
fixes PR 14759.

(while I'm here, call VOP_PUTPAGES() directly instead of indirecting through
the UVM pager op vector.)
2001-11-30 07:05:53 +00:00
chs df71d3fadc in both paths that can cause fragments to be expanded (write and truncate-up),
deal with the fragment expansion separately before the rest of the operation.
this allows us to simplify ufs_balloc_range() by not worrying about implicit
fragment expansion.

call VOP_PUTPAGES() directly for vnodes instead of
going through the UVM pager "put" vector.
2001-11-08 05:24:52 +00:00
simonb bb57e2c53c Remove some bogus checks for unsigned variables < 0. 2001-11-06 06:59:05 +00:00
lukem b3b9740195 add __KERNEL_RCSID() 2001-10-30 01:11:53 +00:00
chs 299934b2ed handle allocation errors in truncate-up case. 2001-09-28 11:43:23 +00:00
chs 3be896ac31 we can't assert that the inode and vnode sizes are consistent at the start
of ffs_truncate() since there are cases (eg. when ffs_write() gets ENOSPC)
where they should be different.  move the assert to the end instead.
2001-09-20 08:25:59 +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 eccd469cf7 min() -> MIN() 2001-08-30 03:47:53 +00:00
mrg 67afbd6270 use _KERNEL_OPT 2001-05-30 11:57:16 +00:00
augustss 46ee162100 Fix from chuq:
don't update UVM's notion of the file size before the VOP_FSYNC() when
we're partially truncating a file with softdeps enabled.  doing so could
free pages without updating the dependency info, which would result in
"panic: softdep_write_inodeblock: direct pointer #1 mismatch 0 != N".
2001-01-27 04:23:21 +00:00
matt ad346bb9eb Convert a MALLOC with a variable size to malloc(). Saves 220 bytes of text
on VAX.
2001-01-01 05:17:26 +00:00
chs aeda8d3b77 Initial integration of the Unified Buffer Cache project. 2000-11-27 08:39:39 +00:00
fvdl 81ba8e7ff7 Adapt for VOP_FSYNC parameter change.
Implement range fsync for FFS. Note: not yet implemented for the
SOFTDEP case.
2000-09-19 22:04:08 +00:00
mrg 419501093a remove include of <vm/vm.h> and <uvm/uvm_extern.h> 2000-06-28 14:16:37 +00:00
mycroft 64f5a574a7 In ffs_update():
* Move the clearing of IN_MODIFIED and IN_ACCESSED later, so they are not
  cleared if the bread() failed.
* Explicitly set waitfor to 0 in the softdep case, if IN_MODIFIED is not
  set (mirroring the bwrite()/bdwrite() decision).
2000-05-30 17:23:52 +00:00
mycroft d747ada9c2 Add a new inode flags called IN_ACCESSED. This used in place of IN_MODIFIED
to record that the atime was updated.  In ffs_update(), we only do synchronous
writes if something *other* than the atime was changed.
2000-05-29 18:04:30 +00:00
mycroft 4fc7b946c2 When unwinding a failed allocation, make sure to nuke the unwound block from
the vnode's block list.  This fixes `itrunc3' panics (at least in some cases;
further testing is needed) and prevents further lossage later on.
2000-05-28 08:15:40 +00:00
mycroft 4656dfd24f Add a new function to remove extra buffers when truncating a file. This is
more generic than the vinvalbuf(V_SAVEMETA) case, avoiding synchronous
operations when truncating to a non-zero length.
2000-05-28 04:13:56 +00:00
perseant f0728fdce1 Change the sementics of the last parameter from a boolean ("waitfor") to
a set of flags ("flags").  Two flags are defined, UPDATE_WAIT and
UPDATE_DIROP.

Under the old semantics, VOP_UPDATE would block if waitfor were set,
under the assumption that directory operations should be done
synchronously.  At least LFS and FFS+softdep do not make this
assumption; FFS+softdep got around the problem by enclosing all relevant
calls to VOP_UPDATE in a "if(!DOINGSOFTDEP(vp))", while LFS simply
ignored waitfor, one of the reasons why NFS-serving an LFS filesystem
did not work properly.

Under the new semantics, the UPDATE_DIROP flag is a hint to the
fs-specific update routine that the call comes from a dirop routine, and
should be wait for, or not, accordingly.

Closes PR#8996.
2000-05-13 23:43:06 +00:00
augustss 169ac5b3c1 Remove register declarations. 2000-03-30 12:41:09 +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
mycroft b174019ccc Pass null pointers to VOP_UPDATE rather than having all the callers fetch the
current time themselves.
1999-03-05 21:09:48 +00:00
mycroft 86ed73efb4 Permit the access and modify time pointers passed to VOP_UPDATE to be null,
meaning the current time.
1999-03-05 20:47:06 +00:00
thorpej 1fcae7f1be defopt FFS_EI 1998-11-12 19:51:10 +00:00
thorpej f7948d05a1 Use DINODE_SIZE rather than pointer arithmetic. 1998-10-23 00:31:28 +00:00
christos e62c8fd824 Missed a conditional for FFS_EI; appears when we compile without -Ox 1998-10-04 18:07:57 +00:00
perry 27ca6798df bzero->memset, bcopy->memcpy, bcmp->memcmp 1998-08-09 20:15:38 +00:00
scottr 7171cca4b8 Protect various config(8)-generated files from inclusion while
building LKMs.  Fixes PR 5557.
1998-06-09 07:46:31 +00:00
scottr d48f258f90 Use the newly-defined opt_quota.h. 1998-06-08 04:27:50 +00:00
bouyer 091dafd39f Add support for reading/writing FFS in non-native byte order, conditioned
to "options FFS_EI". The superblock and inodes (without blk addr) are
byteswapped at disk read/write time, other metadatas are byteswapped
when used (as they are acceeded directly in the buffer cache).
This required the addition of a "um_flags" field to struct ufsmount.
ffs_bswap.c contains superblock and inode byteswap routines also used
by userland utilities.
1998-03-18 15:57:26 +00:00
fvdl e5bc90f40c Merge with Lite2 + local changes 1998-03-01 02:20:01 +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
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
bouyer 76c414a957 Add support for ext2fs, this needed a few modifications to ufs/ufs/inode.h:
- added an "union inode_ext" to struct inode, for the per-fs extentions.
  For now only ext2fs uses it.
- i_din is now an union:
	union {
		struct  dinode ffs_din; /* 128 bytes of the on-disk dinode. */
		struct ext2fs_dinode e2fs_din; /* 128 bytes of the on-disk dinode. */
	} i_din
  Added a lot of #define i_ffs_* and i_e2fs_* to access the fields.
- Added two macros: FFS_ITIMES and EXT2FS_ITIMES. ITIMES calls the rigth
  macro, depending on the time of the inode. ITIMES is used where necessary,
  FFS_ITIMES and EXT2FS_ITIMES in other places.
1997-06-11 10:09:37 +00:00
tls 0024ac02cf Correct old inode flag names in comment, and reformat for 80 character screen 1997-01-27 10:30:14 +00:00
thorpej 34e2fb3bb6 Performance enhancement from Kirk McKusick <mckusick@McKusick.COM>:
When freeing an indirect block, there is no need to write it (synchronously,
no less!) before tossing it.
1996-11-06 03:02:59 +00:00
mycroft c52352c819 Add a set of generic file system operations that most file systems use.
Also, fix some time stamp bogosities.
1996-09-01 23:47:48 +00:00
mycroft 261382c331 Change VOP_UPDATE() semantics:
* Make 2nd and 3rd args timespecs, not timevals.
* Consistently pass a Boolean as the 4th arg (except in LFS).
Also, fix ffs_update() and lfs_update() to actually change the nsec fields.
1996-05-11 18:26:27 +00:00
christos ec3d880232 ffs prototypes 1996-02-09 22:22:18 +00:00
cgd 94b7cf1b85 compensate for timeval/timespec/stat structure changes. 1995-06-15 23:22:41 +00:00
mycroft a63cb01c7d Sync with CSRG. 1994-12-14 13:03:35 +00:00
mycroft f5720d1edd Don't allow truncating past maxfilesize. 1994-10-28 19:31:07 +00:00
cgd fccfa11af5 New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD' 1994-06-29 06:39:25 +00:00
mycroft 914f6b157b Fastlink compat. 1994-06-15 15:35:06 +00:00
mycroft 6d939e6bec Format police. 1994-06-13 20:49:56 +00:00
pk 3eb1a95749 Check requested file size; negative values cause havoc. 1994-06-13 20:38:42 +00:00