Commit Graph

348 Commits

Author SHA1 Message Date
Mike Pritchard 812ac98e83 Correct the new Lite2 #ifdef DIAGNOSTIC ffs_checkblk routine
to not return without setting a return value when it
can't read a block error or detects a bad cylinder group,
since the caller is expecting a return value.
It will now panic at this point, since the thing
to do in this case would be to return a "bad block"
status to the caller, and the caller will panic
anyways when that happens.

Also updated to panic strings in this routine to read
"ffs_checkblk: ..." instead of "checkblk: ...".
1997-02-10 17:05:30 +00:00
Mike Pritchard 04a0d5e517 Make this compile after the Lite2 merge.
A non-existent variable was being used.
1997-02-10 16:29:32 +00:00
Mike Pritchard d2b52eb257 Make ffs_subr.c compile when DIAGNOSTIC is defined.
It looks like this was broken before the Lite2 merge :-(.
VOP_BMAP was being called with the wrong number of arguments.
1997-02-10 16:27:53 +00:00
John Dyson 996c772f58 This is the kernel Lite/2 commit. There are some requisite userland
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>
1997-02-10 02:22:35 +00:00
Jordan K. Hubbard 1130b656e5 Make the long-awaited change from $Id$ to $FreeBSD$
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.
1997-01-14 07:20:47 +00:00
John Dyson 8b612c4b4a This commit is the embodiment of some VFS read clustering improvements.
Firstly, now our read-ahead clustering is on a file descriptor basis and not
on a per-vnode basis.  This will allow multiple processes reading the
same file to take advantage of read-ahead clustering.  Secondly, there
previously was a problem with large reads still using the ramp-up
algorithm.  Of course, that was bogus, and now we read the entire
"chunk" off of the disk in one operation.   The read-ahead clustering
algorithm should use less CPU than the previous also (I hope :-)).

NOTE:  THAT LKMS MUST BE REBUILT!!!
1996-12-29 02:45:28 +00:00
John Dyson b68a757139 Significant performance improvement for mmap'ed files. This commit
makes MADV_SEQUENTIAL much more effective.  I suggest that
we start using MADV_SEQUENTIAL on system utilities that mmap
their input files, and the I/O is predominantely sequential.
Below is a test with 'cmp' on two relatively large binary files,
where the files are so large that the caching is ineffective:

+ ls -l t1.xxx t2.xxx
-rw-r--r--  1 root  wheel  65598384 Dec 10 12:13 t1.xxx
-rw-r--r--  1 root  wheel  65598384 Dec 10 12:14 t2.xxx

+ time cmp t1.xxx t2.xxx
3.78user 0.70system 1:33.43elapsed 4%CPU

+ time cmpmadv t1.xxx t2.xxx
4.21user 1.05system 0:30.93elapsed 17%CPU

This change is as a result of an observation made by BDE.
1996-12-11 05:17:23 +00:00
Bruce Evans 4eb73cdaff Removed all references to b_cylinder (aka b_cylin). It was evil and
hasn't been used for a year or two since disksort() started sorting
on b_pblkno.
1996-12-01 16:34:41 +00:00
Søren Schmidt 7cb29d3394 This update adds the support for != 512 byte sector SCSI devices to
the sd & od drivers. There is also slight changes to fdisk & newfs
in order to comply with different sectorsizes.
Currently sectors of size 512, 1024 & 2048 are supported, the only
restriction beeing in fdisk, which hunts for the sectorsize of
the device.
This is based on patches to od.c and the other system files by
John Gumb & Barry Scott, minor changes and the sd.c patches by
me.
There also exist some patches for the msdos filesys code, but I
havn't been able to test those (yet).

	John Gumb (john@talisker.demon.co.uk)
	Barry Scott (barry@scottb.demon.co.uk)
1996-12-01 11:25:38 +00:00
Julian Elischer 3f6f17ee1e Submitted by: Archie and me.
We encountered an interesting situation where the superblock for
a file system got written to disk with the "fs_fmod" flag set to
one. It appears that this flag is normally supposed to be cleared
during ffs_sync(), but we experienced a crash, or some other weird
occurrence that left it on the disk set to 1.

Later this partition was mounted read-only... and the fs_fmod
field was never cleared, causing ffs_sync() to panic "rofs mod"
when trying to unmount that filesystem (ffs_vfsops.c: line 790).

fix:
set this bit to 0 when you load the superblock from disk.
(see more complete mail on this to hackers)
1996-11-13 01:45:56 +00:00
David Greenman e75838f701 Eliminate an unnecessary synchronous write (and an 8K bcopy+bzero) when
truncating/deleting large files.

Reviewed by:	mckusick, dyson
Submitted by:	Kirk McKusick <mckusick@mckusick.com>, modified for
		FreeBSD by me.
1996-11-05 08:19:40 +00:00
Jeffrey Hsu 78769fbc6a struct mfsnode bloated in size by 12 bytes, so reduce spare padding by 3 longs.
We now only have 4 spare bytes before hitting the dreaded 32 byte threshold.
1996-11-04 20:53:02 +00:00
Bruce Evans 206e5b7e27 Fixed some races and misleading comments in ufs_rename().
1. When a directory is renamed to an existing (empty) directory,
it is possible for the target vnode to become the source vnode
underneath you (because another process may complete the same
rename).  It was assumed that this can't happen, and the bogus
errno EINVAL was returned.  This was fairly harmless.

Fix: return ENOENT instead, as if the source directory was renamed
a little earlier.

2. The same metamorphosis is possible for non-directories.  It was
assumed that this can't happen, and the code for handling "just
removing a link name" happened to be used.  This would have worked
except for fatal bugs in the link name removal - the link name was
assumed to still be there, and a null pointer was followed.

Fix: check the result of relookup().  This fixes PR 1930.

Notes:

(a) POSIX seems to say that removing link names shall have no effect.
BSD (4.4Lite2 at least) does something reasonable instead.

(b) The relookup() may find a file unrelated to the original.
Removing this isn't correct.  Consider 3 existing files A, B and
C, and concurrent renames: AB = rename(A, B), another AB, and
CA = rename("c", "a").  If rename() is atomic, then only the
following results are possible:

	AB, AB (fails), CA: A = original C, B = original A, C = gone
	AB, CA, AB:         A = gone,       B = original C, C = gone
	CA, AB, AB (fails): A = gone,       B = original C, C = gone

but ufs_rename() can give:

	A,AB,CA,B (sorta):  A = gone,       B = original A, C = gone

This usually doesn't matter, since getting into a race is usually
an error.
---

These fixes should be in 2.1.6 and 2.2.
1996-11-04 16:05:51 +00:00
Bruce Evans ccb174975a Fixed lblktosize(). It overflowed at 2G. This bug only affected
ufs_read() and ufs_write().

Found by: looking at warnings for comparing the result of lblktosize()
(which is usually daddr_t = long) with file sizes (which are u_quad_t
for ufs).  File sizes should probably be off_t's to avoid warnings
when the are compared with file offsets, so the fixed lblktosize()
casts to off_t instead of u_quad_t.

Added definition of smalllblksize().  It is the same as the old
lblksize() and is more efficient for small block numbers on 32-bit
machines.

Use smalllblktosize() instead of its expansion in blksize() and
dblksize().  This keeps the line length short and makes it more
obvious that the shift can't overflow.
1996-10-12 22:12:51 +00:00
Bruce Evans 253c0899b2 Don't include <sys/conf.h> for the kernel in disk-related headers.
It is needed for implementation details but very little of it is
needed for the interface.  Include it in the few places that didn't
already include it.

Include <sys/ioccom.h> in <sys/disklabel.h> (as already in
<sys/diskslice.h>) so that all the disk-related headers are almost
self-sufficient.
1996-09-20 17:39:44 +00:00
Nate Williams d977b72dbd Whoops, I should've used the LINT config file. More ts -> tv changes
for timespec structure.
1996-09-20 05:56:36 +00:00
Nate Williams 030e2e9ebb In sys/time.h, struct timespec is defined as:
/*
         * Structure defined by POSIX.4 to be like a timeval.
         */
        struct timespec {
                time_t  ts_sec;         /* seconds */
                long    ts_nsec;        /* and nanoseconds */
        };

        The correct names of the fields are tv_sec and tv_nsec.

Reminded by:	James Drobina <jdrobina@infinet.com>
1996-09-19 18:21:32 +00:00
Peter Wemm 7b8830a51e Argh, I have had one "uid 0 on /: file system full" too many. The problem
is that it doesn't say _what_ did it! (the core dumped console message
is very useful for listing the process name and pid).  This adds similar
information.
1996-09-17 14:38:16 +00:00
John Dyson c645dc1239 Fix a VOP_UNLOCK panic when using options DIAGNOSTIC during dismount. 1996-09-07 17:34:57 +00:00
Justin T. Gibbs 23da239df6 Use bowrite instead of VOP_BWRITE in a few cases. This can probably be taken
further.
1996-09-06 05:36:29 +00:00
Bruce Evans b71fec07db Eliminated nested include of <sys/unistd.h> in <sys/file.h> in the kernel.
Include it directly in the few places where it is used.

Reduced some #includes of <sys/file.h> to #includes of <sys/fcntl.h> or
nothing.
1996-09-03 14:25:27 +00:00
David Greenman 9e04304259 Implemented kernel side of MNT_NOATIME mount option. This option disables
the file access time update on reads and can be useful in reducing
filesystem overhead in cases where the access time is not important (like
Usenet news spools).
1996-09-03 07:09:11 +00:00
Bruce Evans 09a8dfa260 Don't depend in the kernel on the gcc feature of doing arithmetic on
pointers of type `void *'.  Warn about this in future.
1996-08-31 14:48:13 +00:00
John Dyson 6476c0d204 Even though this looks like it, this is not a complex code change.
The interface into the "VMIO" system has changed to be more consistant
and robust.  Essentially, it is now no longer necessary to call vn_open
to get merged VM/Buffer cache operation, and exceptional conditions
such as merged operation of VBLK devices is simpler and more correct.

This code corrects a potentially large set of problems including the
problems with ktrace output and loaded systems, file create/deletes,
etc.

Most of the changes to NFS are cosmetic and name changes, eliminating
a layer of subroutine calls.  The direct calls to vput/vrele have
been re-instituted for better cross platform compatibility.

Reviewed by: davidg
1996-08-21 21:56:23 +00:00
Bruce Evans 6ab46d52a5 Don't use NULL in non-pointer contexts. 1996-07-12 04:12:25 +00:00
Garrett Wollman 5c17ec631e Quiet a couple of -Wunused warnings. 1996-07-09 16:51:18 +00:00
David Greenman b9355dedd9 Fixed end condition for clustered reads.
Submitted by:	Kirk McKusick via Lite-2 and email
1996-06-25 03:00:44 +00:00
Gary Palmer c23670e294 Clean up -Wunused warnings.
Reviewed by:		bde
1996-06-12 05:11:41 +00:00
David Greenman 2f9bae59d6 Moved the fsnode MALLOC to before the call to getnewvnode() so that the
process won't possibly block before filling in the fsnode pointer (v_data)
which might be dereferenced during a sync since the vnode is put on the
mnt_vnodelist by getnewvnode.

Pointed out by Matt Day <mday@artisoft.com>
1996-06-12 03:37:57 +00:00
Gary Palmer 6ddbf1e299 Clean up various compiler warnings. Most (if not all) were benign
Reviewed by:	bde
1996-05-08 04:29:08 +00:00
Poul-Henning Kamp ab76ac21e7 disksort() is gone, all drivers now use tqdisksort(). 1996-05-03 15:05:17 +00:00
Poul-Henning Kamp e911eafcba removed:
CLBYTES PD_SHIFT PGSHIFT NBPG PGOFSET CLSIZELOG2 CLSIZE pdei()
        ptei() kvtopte() ptetov() ispt() ptetoav() &c &c
new:
        NPDEPG

Major macro cleanup.
1996-05-02 14:21:14 +00:00
Bruce Evans 2043dc9a22 Removed bogus _BEGIN_DECLS/_END_DECLS.
Removed unused struct tag declarations in cloned code.

Added or cleaned up idempotency ifdefs.
1996-05-01 02:16:17 +00:00
Bruce Evans 10d245c58a Yet more b_flags fixes. The previous ones broke the clearing of B_DONE
and B_READ before writing.  This was was fatal.  They also broke the
clearing of B_INVAL before doing i/o.  This didn't actually matter.

Submitted by:	mostly by joerg
1996-04-19 19:34:19 +00:00
Poul-Henning Kamp b96b6bb1e6 Replace usage of buf->b_actf by queue.3 and buf->b_act 1996-04-08 07:54:51 +00:00
Bruce Evans a1fbfdff14 Fixed reference counting related to relookup(). relookup() must
be called with the directory referenced, and this reference will
be dropped iff relookup() fails, so the value returned must not be
ignored.

Reviewed by:	davidg
1996-03-29 12:30:30 +00:00
Jeffrey Hsu b9258a868b Make type compatible with Lite2.
Submitted by:	bde
1996-03-27 07:58:57 +00:00
John Dyson 847a3ba792 Handle the bogus device that MFS uses as its VBLK device. We now don't
try to VMIO open it on MFS mounts.  This will fix the mfs_badops
panic.
1996-03-02 22:18:34 +00:00
John Dyson 91477adc6e Enable VMIO for non-VDIR metadata and block device. 1996-03-02 03:45:12 +00:00
John Dyson 33309c7fc0 More b_flags fixes. 1996-03-02 01:49:51 +00:00
John Dyson f5d1e6dae6 Fix a bug that b_flags was getting unnecessarily modified by
the slice code.  The effect up to now has been insignficant, but
improved buffer allocation code will break with this problem.
1996-03-01 19:01:04 +00:00
Mike Pritchard 86abf1c4b2 Add a prototype for the quotactl system call. 1996-02-27 07:57:57 +00:00
Bruce Evans e6302eab11 Removed vestigial support for the obsolete FIFO option. In ext2fs
it caused null pointer panics for all fifo operations unless FIFO
was defined.
1996-02-25 20:12:36 +00:00
Mike Pritchard 6c5e9bbdf5 Fix a bunch of spelling errors in the comment fields of
a bunch of system include files.
1996-01-30 23:02:38 +00:00
John Dyson bd7e5f992e Eliminated many redundant vm_map_lookup operations for vm_mmap.
Speed up for vfs_bio -- addition of a routine bqrelse to greatly diminish
	overhead for merged cache.
Efficiency improvement for vfs_cluster.  It used to do alot of redundant
	calls to cluster_rbuild.
Correct the ordering for vrele of .text and release of credentials.
Use the selective tlb update for 486/586/P6.
Numerous fixes to the size of objects allocated for files.  Additionally,
	fixes in the various pagers.
Fixes for proper positioning of vnode_pager_setsize in msdosfs and ext2fs.
Fixes in the swap pager for exhausted resources.  The pageout code
	will not as readily thrash.
Change the page queue flags (PG_ACTIVE, PG_INACTIVE, PG_FREE, PG_CACHE) into
	page queue indices (PQ_ACTIVE, PQ_INACTIVE, PQ_FREE, PQ_CACHE),
	thereby improving efficiency of several routines.
Eliminate even more unnecessary vm_page_protect operations.
Significantly speed up process forks.
Make vm_object_page_clean more efficient, thereby eliminating the pause
	that happens every 30seconds.
Make sequential clustered writes B_ASYNC instead of B_DELWRI even in the
	case of filesystems mounted async.
Fix a panic with busy pages when write clustering is done for non-VMIO
	buffers.
1996-01-19 04:00:31 +00:00
Bruce Evans 51ea8b57b8 Partially fixed negative and truncated "Avail" counts in df output.
This fixes PR943.

ffs/ffs_vfsops.c:
ffs_statfs() multiplied by (100 - minfree) as part of calculating the
minfree percentage (complemented in 100%), so with the standard minfree
of 8, it was broken for file systems of size >= 1TB/92 = 11GB.  Use the
standard freespace() macro instead.  This also fixes a rounding bug (the
"Avail" count was sometimes 1 too small).

ffs/* (not fixed):
The freespace() macro multiplies by minfree, so with the standard
minfree of 8, it is broken for file systems of size >= 1TB/8 = 128GB.
This bug is more serious since it affects block allocation.

ffs/ffs_alloc.c (not fixed):
Ordinary users are sometimes allowed to allocate 1 (partial) block
too many so that the "Avail" count goes negative.  E.g., if there is
1 fragment available and the file is fairly large, one more full
block is allocated.

df/df.c:
ufs_df() used/uses essentially the same code as ffs_statfs(), so it
had/has the same bugs.

ufs_df() gratuitously replaced "Avail" counts of < 0 by 0, so it
gave different results for non-mounted file systems in this case.
1996-01-14 18:55:09 +00:00
Poul-Henning Kamp c68970939f The second cast wasn't needed.
Submitted by:	bde
1996-01-07 09:42:36 +00:00
Poul-Henning Kamp 5f7351637a Fix the asami&phk bug. This was a sign-extension bug, where a long
got multiplied by a constant before being upgraded to long long.
This should fix kern/104 and possibly kern/105.
Thanks to: dyson & asami.
1996-01-06 12:49:53 +00:00
Garrett Wollman 01733a9b6d Convert QUOTA to new-style option. 1996-01-05 18:31:58 +00:00
Garrett Wollman 0e41ee3037 Convert DDB to new-style option. 1996-01-04 21:13:23 +00:00
Peter Wemm a5b996a7ec recording cvs-1.6 file death 1995-12-30 19:02:48 +00:00
Bruce Evans 0772e1c90b Fixed prototyping and staticizing for -DDEBUG case. 1995-12-22 17:56:37 +00:00
Poul-Henning Kamp 8b03ba27f5 Staticize. 1995-12-22 15:58:56 +00:00
Poul-Henning Kamp b8dce649f1 Staticize. 1995-12-17 21:14:36 +00:00
Peter Wemm dbe525ffb0 Silence a harmless warning... 1995-12-15 03:36:25 +00:00
Bruce Evans d9ed07695e Included <sys/conf.h> and updated to indirect devswitches so that
this compiles again, and added a prototype.
1995-12-14 20:16:15 +00:00
Peter Wemm 78a9e5aea0 *hack alert*! :-) This adds an option to the MFS_ROOT code so that it
is possible to boot a kernel with an empty in-core MFS image, and have
it load the image from floppy directly.  This is admittedly a hack and
would be better replaced by a self-loading ram-disk.
1995-12-14 14:25:03 +00:00
John Dyson a316d390bd Changes to support 1Tb filesizes. Pages are now named by an
(object,index) pair instead of (object,offset) pair.
1995-12-11 04:58:34 +00:00
David Greenman efeaf95a41 Untangled the vm.h include file spaghetti. 1995-12-07 12:48:31 +00:00
Bruce Evans f9bfc49779 Fixed compilation of lfs utilities which I broke the other day by
#including lfs_extern.h and goop to support it in lfs_conv.c.
1995-12-06 19:46:37 +00:00
Bruce Evans 57a4e3fa8a Completed function declarations and/or added prototypes and/or #includes
to get the prototypes.
1995-12-03 11:17:15 +00:00
Bruce Evans a349554809 Removed bogus __BEGIN_DECS/__END_DECLS. 1995-11-28 07:23:09 +00:00
Peter Wemm 018309ece7 After having put on my Asbestos suit, complete the MFS_ROOT part of Terry's
mountroot changes.  This means that the mfs_initminiroot functionality
into the root mfs_mount....
1995-11-28 03:15:58 +00:00
Peter Wemm 59a4c16a68 Attempt to solve the busy-buffers-on-shutdown caused by MFS once and for all.
What was happening, was that the main mfs loop was sleeping, and when it was
being awoken by a wakeup when it was supposed to process some IO requests.

The problem was that if it was being woken out of the tsleep() by a signal
at shutdown, it was going straight into dounmount() without servicing any
pending IO requests, causing dounmount() to fail because there were busy
buffers (and they could not be "processed" because the processing loop was
trying to unmount rather than dispatching into mfs_doio()).

This (dare I say it :-) appears to be a layering problem....
1995-11-28 02:15:29 +00:00
John Dyson dc4a0cee58 Update the wd.c driver to use the new TAILQ scheme for device
buffer queue.  Also, create a new subroutine 'tqdisksort' that
is an improved version of the original disksort that also uses
TAILQs.
1995-11-23 07:24:41 +00:00
Bruce Evans 512fef80a9 Completed function declarations and/or added prototypes. 1995-11-21 12:55:26 +00:00
Poul-Henning Kamp c03020b22f Fix compiler warnings. 1995-11-20 12:25:37 +00:00
John Dyson aa3960192e General fixes to the vfs clustring code:
1) Make cluster buffer list be a non-malloced chain.  This eliminates
yet another 'evil' M_WAITOK and generally cleans up the code.
2) Fix write clustering for ext2fs.  It was just broken.  Also, ffs
clustering had an efficiency problem that more bawrites were happening
than should have been.
3) Make changes to buf.h to support the above, plus remove b_pfcent
at the request of David Greenman.

Note that the reallocblocks code is disabled pending rewrite for
the cluster buffer list changes.
1995-11-19 19:55:26 +00:00
John Dyson f00c174fea Change incorrect '#if EXT2FS' to '#ifdef EXT2FS' 1995-11-19 19:46:23 +00:00
Poul-Henning Kamp af8364b0ad Get rid of the last debug sysctl variables of the old style. 1995-11-14 09:40:06 +00:00
Bruce Evans d2d3e8751c Included <sys/sysproto.h> to get central declarations for syscall args
structs and prototypes for syscalls.

Ifdefed duplicated decentralized declarations of args structs.  It's
convenient to have this visible but they are hard to maintain.  Some
are already different from the central declarations.  4.4lite2 puts
them in comments in the function headers but I wanted to avoid the
large changes for that.
1995-11-12 06:43:28 +00:00
Bruce Evans f57e65478d Introduced a type `vop_t' for vnode operation functions and used
it 1138 times (:-() in casts and a few more times in declarations.
This change is null for the i386.

The type has to be `typedef int vop_t(void *)' and not `typedef
int vop_t()' because `gcc -Wstrict-prototypes' warns about the
latter.  Since vnode op functions are called with args of different
(struct pointer) types, neither of these function types is any use
for type checking of the arg, so it would be preferable not to use
the complete function type, especially since using the complete
type requires adding 1138 casts to avoid compiler warnings and
another 40+ casts to reverse the function pointer conversions before
calling the functions.
1995-11-09 08:17:23 +00:00
John Dyson f520ae1e5e This commit causes UFS to perform at Linux EXT2FS metadata rates. After
earlier discussions with DG, and a recent email exchange with SEF, I
decided to allow UFS to run wide-open on an experimental basis.  We
will probably support eventually multiple async modes, and this is
the fastest the we can expect.  Just use the -o async flag on the
UFS mount.  Good luck...
1995-11-06 03:21:41 +00:00
John Dyson bacc8b1678 Changes to existing files for ext2fs support. The UFS mods need rework
in the future as they are a bit crufty -- but at least the stuff is in the
tree now.
1995-11-05 23:36:07 +00:00
John Dyson c15c761192 Fix ufs_bmap so that triple indirect blocks might work.
Submitted by:	Godmar Back <gback@facility.cs.utah.edu>
1995-11-05 23:07:37 +00:00
John Dyson 4dc4e0d228 Make MNT_ASYNC more effective for UFS. It should not be too much more
dangerous than the original MNT_ASYNC.  There might be some minor
security considerations due to data writes not being posted as promptly
as before.  Meta-data operations are still not quite as fast as Linux,
but streaming I/O is still higher.
1995-11-05 21:01:15 +00:00
Peter Wemm b72967f933 mfs_open could panic with false identification: panic("mfs_ioctl: .... 1995-10-31 10:45:48 +00:00
John Dyson 2c4488fce3 Finalize GETPAGES layering scheme. Move the device GETPAGES
interface into specfs code.  No need at this point to modify the
PUTPAGES stuff except in the layered-type (NULL/UNION) filesystems.
1995-10-23 02:23:29 +00:00
David Greenman d68a41903e Moved the filesystem read-only check out of the syscalls and into the
filesystem layer, as was done in lite-2. Merged in some other cosmetic
changes while I was at it. Rewrote most of msdosfs_access() to be more
like ufs_access() and to include the FS read-only check.

Obtained from: partially from 4.4BSD-lite2
1995-10-22 09:32:48 +00:00
Bruce Evans 821692d618 Return EINVAL instead of panicing for rename("dir1", "dir2/..").
Fixes part of PR 760.

This bug seems to be very old.
1995-10-07 10:14:12 +00:00
Poul-Henning Kamp b49afdd5c4 use roundup2 to avoid a bunch of 64bit divides. 1995-10-06 09:56:51 +00:00
John Dyson 10d86e5e1f Re-enable read clustering. 1995-09-25 06:00:59 +00:00
David Greenman ecf0c3ce4f Shit! I changed the wrong doclusterread! ...Thanks to Steven Wallace and
Poul-Henning for convincing me that I should look at my mistake! :-)
1995-09-22 06:02:40 +00:00
David Greenman aee3c74900 Disable file read clustering until the bug(s) in vfs_cluster.c are fixed.
This should temporarily fix the sig 10/11 problems that people have been
having for the past 3 weeks.
1995-09-22 00:05:46 +00:00
Bruce Evans 191e1a59da Remove transitory labelling code. Labels are now handled by essentially
the original 4.4lite code.  Machine Specific Partitions are now handled
separately.
1995-09-16 17:04:06 +00:00
Bruce Evans 0efe304fe1 Fix benign type mismatch in a call to VOP_BMAP(). 1995-09-11 15:56:46 +00:00
Julian Elischer f3c3ae3c38 Obtained from:4.4lite2
fix a change where a shortcut resulted in teh wrong answer..

e.g.
touch a
touch b
mv a b
resulted in b being removed and a being moved to b

in the shortcut..
touch a
ln a b
mv a b
the wrong link was removed..
leaving a instead of b, giving a different result to when
both files were separate.
1995-09-09 01:43:49 +00:00
David Greenman 9eda220c0b Slight optimization for the standard case of rotdelay=0. 1995-09-08 17:16:32 +00:00
John Dyson 60c7a2cd4e Correct a case in the ffs_getpages where a page is not found in
a sparse file and the page is zeroed but not set valid, clean.
1995-09-07 04:39:09 +00:00
John Dyson 3441c37e0b Added indirect pointer for ffs_getpages, and added external declaration. 1995-09-06 05:41:17 +00:00
John Dyson d3b10c455e Added new ffs_getpages routine. It isn't optimized yet, but FFS
now does it's own getpage -- instead of using the default routine
in vnode_pager.c.
1995-09-06 05:39:28 +00:00
John Dyson 5316959a2c Correct prototype for ufs_bmaparray() 1995-09-04 01:13:42 +00:00
John Dyson c83ebe7781 Added VOP_GETPAGES/VOP_PUTPAGES and also the "backwards" block count
for VOP_BMAP.  Updated affected filesystems...
1995-09-04 00:21:16 +00:00
Bruce Evans 8d7459c596 Declare vfs_mountroot() in the right place. 1995-08-30 01:34:28 +00:00
Bruce Evans 4bb0ce8ce3 Fix correct_writedisklabel() and writedisklabel(). Their setting of
bp->b_flags has been broken for many years:
a) they didn't set B_BUSY for doing i/o.  This has been fatal since
   1995/07/25 when biodone() started checking that B_BUSY is set.
b) they didn't set B_INVAL for releasing the buffer.  This at best
   just put a useless buffer in the LRU queue for a little while.

Fix a couple of spelling errors and complete a couple of function
pointer declarations.
1995-08-28 16:09:11 +00:00
Julian Elischer 2b14f991e6 Reviewed by: julian with quick glances by bruce and others
Submitted by:	terry (terry lambert)
This is  a composite of 3 patch sets submitted by terry.
they are:
New low-level init code that supports loadbal modules better
some cleanups in the namei code to help terry in 16-bit character support
some changes to the mount-root code to make it a little more
modular..

NOTE: mounting root off cdrom or NFS MIGHT be broken as I haven't been able
to test those cases..

certainly mounting root of disk still works just fine..
mfs should work but is untested. (tomorrows task)

The low level init stuff includes a total rewrite of init_main.c
to make it possible for new modules to have an init phase by simply
adding an entry to a TEXT_SET (or is it DATA_SET) list. thus a new module can
be added to the kernel without editing any other files other than the
'files' file.
1995-08-28 09:19:25 +00:00
Bruce Evans 4238af7cd2 Don't call VOP_UPDATE() with volatile timestamps. 1995-08-25 19:40:32 +00:00
David Greenman 748df6e8a7 Fixed mfs reboot panic by never returning failure from mfs_start().
Obtained from:	4.4BSD-Lite2
1995-08-20 10:26:00 +00:00
Bruce Evans bf25be48a5 Make everything except the unsupported network sources compile cleanly
with -Wnested-externs.
1995-08-16 16:14:28 +00:00
David Greenman a9e479e2fa Honor -async mount option when doing the inode update.
Obtained from:	4.4BSD-Lite2
1995-08-16 13:16:58 +00:00
David Greenman 628641f8a6 Converted mountlist to a CIRCLEQ.
Partially obtained from: 4.4BSD-Lite2
1995-08-11 11:31:18 +00:00
David Greenman 74ca9fa64f On closer inspection, it turns out that all of the callers of disksort
are already at splbio()...so back out the last change to disksort.
1995-08-07 14:20:27 +00:00
David Greenman 5d210d3fd4 Since buffers can be pulled off of the disk queue at interrupt time and
disksort is called at non-interrupt time and can be actively traversing
the list when that happens, there is a very small window of vulnerability.
Close it by protecting disksort with splbio().
1995-08-07 11:55:32 +00:00
David Greenman 39e68756fb Use bdwrite() rather than brelse(). The cylinder group bitmap modification
is not preserved otherwise.
Note that this is a no-op in FreeBSD, however, as we have doreallocblks
disabled.

Submitted by:	Kirk McKusick
1995-08-07 08:16:32 +00:00
David Greenman a8ce4271e2 Removed redundant call to vm_object_page_clean: this is already handled
by vfs_msync().
1995-08-06 11:59:48 +00:00
David Greenman b6dedae69b Removed redundant call to vm_object_page_clean - this is already done
in vfs_msync().
1995-08-06 11:56:42 +00:00
David Greenman 7221ecc0ba Use the correct flags (IO_SYNC -> B_SYNC) when deciding to do a sync or
async write in the section that changes the filesize. The bug resulted
in the updates always being async.

Obtained from:	4.4BSD-Lite2
1995-08-04 05:49:17 +00:00
David Greenman 4777741358 Removed my special-case hack for VOP_LINK and fixed the problem with the
wrong vp's ops vector being used by changing the VOP_LINK's argument order.
The special-case hack doesn't go far enough and breaks the generic
bypass routine used in some non-leaf filesystems. Pointed out by Kirk
McKusick.
1995-08-01 18:51:02 +00:00
Bruce Evans 28f8db1403 Eliminate sloppy common-style declarations. There should be none left for
the LINT configuation.
1995-07-29 11:44:31 +00:00
David Greenman 8997d94f79 Since ufs_ihashget can block, the lock must be checked for each time
the function returns. Also, moved lock into .bss and made minor cosmetic
changes.

Submitted by:	Bruce Evans
1995-07-21 16:20:20 +00:00
David Greenman 2094ddb6f0 Implement a lock in ffs_vget to prevent a race condition where two processes
try allocate the same inode/vnode, causing a duplicate.

Submitted by:	Matt Dillon, slightly reworked by me.
1995-07-21 03:52:40 +00:00
David Greenman 24a1cce34f NOTE: libkvm, w, ps, 'top', and any other utility which depends on struct
proc or any VM system structure will have to be rebuilt!!!

Much needed overhaul of the VM system. Included in this first round of
changes:

1) Improved pager interfaces: init, alloc, dealloc, getpages, putpages,
   haspage, and sync operations are supported. The haspage interface now
   provides information about clusterability. All pager routines now take
   struct vm_object's instead of "pagers".

2) Improved data structures. In the previous paradigm, there is constant
   confusion caused by pagers being both a data structure ("allocate a
   pager") and a collection of routines. The idea of a pager structure has
   escentially been eliminated. Objects now have types, and this type is
   used to index the appropriate pager. In most cases, items in the pager
   structure were duplicated in the object data structure and thus were
   unnecessary. In the few cases that remained, a un_pager structure union
   was created in the object to contain these items.

3) Because of the cleanup of #1 & #2, a lot of unnecessary layering can now
   be removed. For instance, vm_object_enter(), vm_object_lookup(),
   vm_object_remove(), and the associated object hash list were some of the
   things that were removed.

4) simple_lock's removed. Discussion with several people reveals that the
   SMP locking primitives used in the VM system aren't likely the mechanism
   that we'll be adopting. Even if it were, the locking that was in the code
   was very inadequate and would have to be mostly re-done anyway. The
   locking in a uni-processor kernel was a no-op but went a long way toward
   making the code difficult to read and debug.

5) Places that attempted to kludge-up the fact that we don't have kernel
   thread support have been fixed to reflect the reality that we are really
   dealing with processes, not threads. The VM system didn't have complete
   thread support, so the comments and mis-named routines were just wrong.
   We now use tsleep and wakeup directly in the lock routines, for instance.

6) Where appropriate, the pagers have been improved, especially in the
   pager_alloc routines. Most of the pager_allocs have been rewritten and
   are now faster and easier to maintain.

7) The pagedaemon pageout clustering algorithm has been rewritten and
   now tries harder to output an even number of pages before and after
   the requested page. This is sort of the reverse of the ideal pagein
   algorithm and should provide better overall performance.

8) Unnecessary (incorrect) casts to caddr_t in calls to tsleep & wakeup
   have been removed. Some other unnecessary casts have also been removed.

9) Some almost useless debugging code removed.

10) Terminology of shadow objects vs. backing objects straightened out.
    The fact that the vm_object data structure escentially had this
    backwards really confused things. The use of "shadow" and "backing
    object" throughout the code is now internally consistent and correct
    in the Mach terminology.

11) Several minor bug fixes, including one in the vm daemon that caused
    0 RSS objects to not get purged as intended.

12) A "default pager" has now been created which cleans up the transition
    of objects to the "swap" type. The previous checks throughout the code
    for swp->pg_data != NULL were really ugly. This change also provides
    the rudiments for future backing of "anonymous" memory by something
    other than the swap pager (via the vnode pager, for example), and it
    allows the decision about which of these pagers to use to be made
    dynamically (although will need some additional decision code to do
    this, of course).

13) (dyson) MAP_COPY has been deprecated and the corresponding "copy
    object" code has been removed. MAP_COPY was undocumented and non-
    standard. It was furthermore broken in several ways which caused its
    behavior to degrade to MAP_PRIVATE. Binaries that use MAP_COPY will
    continue to work correctly, but via the slightly different semantics
    of MAP_PRIVATE.

14) (dyson) Sharing maps have been removed. It's marginal usefulness in a
    threads design can be worked around in other ways. Both #12 and #13
    were done to simplify the code and improve readability and maintain-
    ability. (As were most all of these changes)

TODO:

1) Rewrite most of the vnode pager to use VOP_GETPAGES/PUTPAGES. Doing
   this will reduce the vnode pager to a mere fraction of its current size.

2) Rewrite vm_fault and the swap/vnode pagers to use the clustering
   information provided by the new haspage pager interface. This will
   substantially reduce the overhead by eliminating a large number of
   VOP_BMAP() calls. The VOP_BMAP() filesystem interface should be
   improved to provide both a "behind" and "ahead" indication of
   contiguousness.

3) Implement the extended features of pager_haspage in swap_pager_haspage().
   It currently just says 0 pages ahead/behind.

4) Re-implement the swap device (swstrategy) in a more elegant way, perhaps
   via a much more general mechanism that could also be used for disk
   striping of regular filesystems.

5) Do something to improve the architecture of vm_object_collapse(). The
   fact that it makes calls into the swap pager and knows too much about
   how the swap pager operates really bothers me. It also doesn't allow
   for collapsing of non-swap pager objects ("unnamed" objects backed by
   other pagers).
1995-07-13 08:48:48 +00:00
David Greenman aa2cabb958 1) Converted v_vmdata to v_object.
2) Removed unnecessary vm_object_lookup()/pager_cache(object, TRUE) pairs
   after vnode_pager_alloc() calls - the object is already guaranteed to be
   persistent.
3) Removed some gratuitous casts.
1995-06-28 12:01:13 +00:00
David Greenman 9879652657 Fixed VOP_LINK argument order botch. 1995-06-28 07:06:55 +00:00
Rodney W. Grimes 9b2e535452 Remove trailing whitespace. 1995-05-30 08:16:23 +00:00
Poul-Henning Kamp fe3ee28802 Mount MFS as root RW. Remounting doesn't make sense.
Reviewed by:	davidg
1995-05-29 03:27:37 +00:00
David Greenman 347a022fa7 Kill bogus vnode_pager_setsize(). It was being called at the wrong time
and resulted in the object size being too small. This caused bad things
to happen later when the file was mapped.

Reviewed by:	John Dyson
1995-05-28 04:32:23 +00:00
David Greenman 61f5d51062 Changes to fix the following bugs:
1) Files weren't properly synced on filesystems other than UFS. In some
   cases, this lead to lost data. Most likely would be noticed on NFS.
   The fix is to make the VM page sync/object_clean general rather than
   in each filesystem.
2) Mixing regular and mmaped file I/O on NFS was very broken. It caused
   chunks of files to end up as zeroes rather than the intended contents.
   The fix was to fix several race conditions and to kludge up the
   "b_dirtyoff" and "b_dirtyend" that NFS relies upon - paying attention
   to page modifications that occurred via the mmapping.

Reviewed by:	David Greenman
Submitted by:	John Dyson
1995-05-21 21:39:31 +00:00
David Greenman 2976b7f19f NFS diskless operation was broken because swapdev_vp wasn't initialized.
These changes solve the problem in a general way by moving the
initialization out of the individual fs_mountroot's and into swaponvp().

Submitted by:	Poul-Henning Kamp
1995-05-19 03:27:08 +00:00
David Greenman 1469eec81e Fixed incompleteness that would allow dirty filesystems to get mounted
when the single user shell was terminated. These changes disallow mounting
or R/W upgrading filesystems that are dirty unless "-f" (force) option
is used with mount. /etc/rc has been modified to abort the startup if
one or more non-nfs partitions fail to mount.

Reviewed by:	Poul-Henning Kamp, Rod Grimes
1995-05-15 08:39:37 +00:00
David Greenman 9b5bb13bf8 From Bruce Evans:
I ran into another manifestation of the problem reported in PR 211 and
fixed it. Try this:

as non-root:
	cd /tmp; mkdir x y x/z
as root:
	chown root /tmp/x/z
as non-root:
	cd /tmp/x; mv z ../y		# EACCES as expected
as root:
	cd /tmp/x; mv z ../y		# EINVAL NOT as expected

This is because ufs_rename() sets IN_RENAME and fails to clear it.

Reviewed by:	davidg
Submitted by:	bde
1995-05-15 07:31:09 +00:00
Rodney W. Grimes b2b795f07c Fix -Wformat warnings from LINT kernel. 1995-05-11 19:26:53 +00:00
John Dyson f33775afcf Limit filesize to the amount that the VM system can currently handle
(2GB).  If this limit is not imposed, then filesystem corruption will
ensue when files larger than 2GB are created.  This is temporary,
and the underlying limitation will be removed later.
1995-05-01 23:20:24 +00:00
Poul-Henning Kamp 41dffd203c Add a printf so we can see where we get our rootfs from. 1995-04-25 03:39:50 +00:00
John Dyson a4256da5ad Fixed the mmap hang fix previously committed so that it works
with options DIAGNOSTIC, and clear up an additional reference
count problem.
1995-04-25 03:32:37 +00:00
John Dyson e5f751a9b2 Changes to get rid of ufslk2 hangs when doing read/write to/from
mmap regions that are in the same file as the read/write.
1995-04-24 05:13:28 +00:00
David Greenman 5291a9a0ac Make vegetarian and animal rights people happy and use 0xdeadc0de instead
of 0xdeadbeef as the 'spare' value.
1995-04-16 11:25:47 +00:00
David Greenman 81c6e3e558 Handle the "syncing VCHR vnode hang" problem a little differently; just
don't lock the vnode - it doesn't appear to ever be necessary for VCHR
vnode/inodes. This fixes a bug introduced in the previous commit that
caused tty timestamps to act strange (causing 'w' and 'finger' to show
the tty wasn't idle when it may have been for hours).
1995-04-11 04:23:47 +00:00
David Greenman f6b04d2bfb Changes from John Dyson and myself:
Fixed remaining known bugs in the buffer IO and VM system.

vfs_bio.c:
Fixed some race conditions and locking bugs. Improved performance
by removing some (now) unnecessary code and fixing some broken
logic.
Fixed process accounting of # of FS outputs.
Properly handle NFS interrupts (B_EINTR).

(various)
Replaced calls to clrbuf() with calls to an optimized routine
called vfs_bio_clrbuf().

(various FS sync)
Sync out modified vnode_pager backed pages.

ffs_vnops.c:
Do two passes: Sync out file data first, then indirect blocks.

vm_fault.c:
Fixed deadly embrace caused by acquiring locks in the wrong order.

vnode_pager.c:
Changed to use buffer I/O system for writing out modified pages. This
should fix the problem with the modification date previous not getting
updated. Also dramatically simplifies the code. Note that this is
going to change in the future and be implemented via VOP_PUTPAGES().

vm_object.c:
Fixed a pile of bugs related to cleaning (vnode) objects. The performance
of vm_object_page_clean() is terrible when dealing with huge objects,
but this will change when we implement a binary tree to keep the object
pages sorted.

vm_pageout.c:
Fixed broken clustering of pageouts. Fixed race conditions and other
lockup style bugs in the scanning of pages. Improved performance.
1995-04-09 06:03:56 +00:00
Bruce Evans 3aa12267a5 Add and move declarations to fix all of the warnings from `gcc -Wimplicit'
(except in netccitt, netiso and netns) that I didn't notice when I fixed
"all" such warnings before.
1995-03-28 07:58:53 +00:00
David Greenman f57459b632 Removed third arg (vmio) to allocbuf() that was added with the original
merged cache changes, and figure it out based on the B_VMIO buffer flag.
Fixes a problem where delayed write VMIO buffers would sometimes get
recopied into kernel-alloced memory.

Submitted by:	John Dyson
1995-03-26 23:29:13 +00:00
David Greenman edf8a81561 Removed redundant newlines that were in some panic strings. 1995-03-19 14:29:26 +00:00
David Greenman 1b2cfc2645 Backed out change to panic call: As Chris just pointed out to me, panic()
does indeed work like printf(). gdb gets the string untranslated for some
reason.
1995-03-19 13:44:03 +00:00
David Greenman 1e1ece7deb Fix a call to panic: panic doesn't do token substitution on the panic
string.
1995-03-19 09:47:32 +00:00
David Greenman 4e83f749ec Don't sync the inode date changes of character special devices
during the FS sync. The system would appear to hang momentarily
if there was a large backlog of I/O. This is because the vnode
remains locked during the output - preventing normal character
I/O. The problem was exacerbated by the FFS contiguous block
allocation fixes and a semi-broken disksort(). The inode/date
will still be synced during a normal FS dismount and whenever
the inode is changed for other reasons.
1995-03-18 18:03:29 +00:00
David Greenman 0338878131 Woops, add back that #define...it's used later in the file. 1995-03-18 07:06:51 +00:00
David Greenman 9e4817309b Fixed comments and removed b_cylinder #define. 1995-03-18 06:38:04 +00:00
David Greenman 89247e0412 Integrated change from 1.1.5: Fixed broken disksort to sort by pblkno
rather than by cylinder.
1995-03-18 06:32:48 +00:00
Bruce Evans b5e8ce9f12 Add and move declarations to fix all of the warnings from `gcc -Wimplicit'
(except in netccitt, netiso and netns) and most of the warnings from
`gcc -Wnested-externs'.  Fix all the bugs found.  There were no serious
ones.
1995-03-16 18:17:34 +00:00
Bruce Evans ec00834c18 Finish the previous change. The device name got lost in diskerr(). 1995-03-12 08:17:30 +00:00
David Greenman 9a4bf98e66 Removed gratuitous and *extremely* evil setting of OBJ_INTERNAL. This
caused a cascade of problems including kernel memory corruption, file
corruption, system hangs, and panics.
1995-03-11 22:23:14 +00:00
David Greenman 07be9bd45f Increased default minfree to 8%. 1995-03-10 22:18:16 +00:00
David Greenman e23c0ff5a0 The threshold for switching from time-space and space-time is too small
when minfree is 5%...so make it stay at space in this case.

Submitted by:	Kirk McKusick
1995-03-10 22:11:50 +00:00
David Greenman 57677027ac Patch to fix quota panic from Mike Karels:
allow Q_SYNC regardless of "target" uid, we allow it with -1;
fix bug that caused all ops to refer to user quotas, not group.

Submitted by:	Mike Karels
1995-03-10 22:06:39 +00:00
David Greenman 403ef252fa Removed obsolete vtrace() remnants. 1995-03-04 03:24:45 +00:00
David Greenman 22470903a0 Fixes from John Dyson to work around vnode lock hang. Basically, remove
the VOP_BMAP calls, and add one to bdwrite.

Submitted by:	John Dyson
1995-03-03 22:13:16 +00:00
Stefan Eßer 7368f324a8 Don't try to make use of useless rotational position optimisation,
if all free blocks are in the same bucket (i.e. NRPOS == 1).
Else a free block is choosen, possibly from a different cylinder,
even if the block succeeding bpref was free ...

Submitted by:	se
1995-02-27 17:43:57 +00:00
Bruce Evans 30ca037de1 Use dsname() to get consistent names. 1995-02-22 22:46:48 +00:00
Bruce Evans de13c90ff2 Adjust slice names in diskerr() for the rearranged slice numbers. The
mapping from numbers to names is messy for backwards compatibility.
E.g., for driver "sd", unit "0":

slice 0: omit the slice number for compatibility; names are sd0[a-h].
slice 1: omit the partition letter 'c' because the whole disk device
         shouldn't have anything to do with partitions; sd0 is the
         only name.
slices 2-31: subtract 1 from slice number to compensate for the
         compatibility slice 0; names are sd0s[1-30][a-h].
1995-02-16 14:47:38 +00:00
Poul-Henning Kamp d2fc53150b YF fix. 1995-02-14 06:14:28 +00:00
David Greenman efc68ce10f Fixed bmap run-length brokeness.
Use bmap run-length extension when doing clustered paging.

Submitted by:	John Dyson
1995-02-03 06:46:28 +00:00
David Greenman e5501f43a5 Removed some unused/obsolete code.
Submitted by:	John Dyson
1995-01-24 10:02:00 +00:00
David Greenman 0d94caffca These changes embody the support of the fully coherent merged VM buffer cache,
much higher filesystem I/O performance, and much better paging performance. It
represents the culmination of over 6 months of R&D.

The majority of the merged VM/cache work is by John Dyson.

The following highlights the most significant changes. Additionally, there are
(mostly minor) changes to the various filesystem modules (nfs, msdosfs, etc) to
support the new VM/buffer scheme.

vfs_bio.c:
Significant rewrite of most of vfs_bio to support the merged VM buffer cache
scheme.  The scheme is almost fully compatible with the old filesystem
interface.  Significant improvement in the number of opportunities for write
clustering.

vfs_cluster.c, vfs_subr.c
Upgrade and performance enhancements in vfs layer code to support merged
VM/buffer cache.  Fixup of vfs_cluster to eliminate the bogus pagemove stuff.

vm_object.c:
Yet more improvements in the collapse code.  Elimination of some windows that
can cause list corruption.

vm_pageout.c:
Fixed it, it really works better now.  Somehow in 2.0, some "enhancements"
broke the code.  This code has been reworked from the ground-up.

vm_fault.c, vm_page.c, pmap.c, vm_object.c
Support for small-block filesystems with merged VM/buffer cache scheme.

pmap.c vm_map.c
Dynamic kernel VM size, now we dont have to pre-allocate excessive numbers of
kernel PTs.

vm_glue.c
Much simpler and more effective swapping code.  No more gratuitous swapping.

proc.h
Fixed the problem that the p_lock flag was not being cleared on a fork.

swap_pager.c, vnode_pager.c
Removal of old vfs_bio cruft to support the past pseudo-coherency.  Now the
code doesn't need it anymore.

machdep.c
Changes to better support the parameter values for the merged VM/buffer cache
scheme.

machdep.c, kern_exec.c, vm_glue.c
Implemented a seperate submap for temporary exec string space and another one
to contain process upages. This eliminates all map fragmentation problems
that previously existed.

ffs_inode.c, ufs_inode.c, ufs_readwrite.c
Changes for merged VM/buffer cache.  Add "bypass" support for sneaking in on
busy buffers.

Submitted by:	John Dyson and David Greenman
1995-01-09 16:06:02 +00:00
Justin T. Gibbs 61acca9f2f Change panic messges that are ffs_blah functions to say they are ffs not
ufs functions.
1995-01-04 23:48:04 +00:00
Justin T. Gibbs 1a451e33ef LFS stability patches. There is still a problem with directory update
ordering that can prove fatal during large batches of deletes, but this
is much better than it was.  I probably won't be putting much more time
into this until Seltzer releases her new version of LFS which has
fragment support.  This should be availible just before USENIX.
1995-01-04 23:46:34 +00:00
Bruce Evans 59f08b8ba7 Use the same current time throughout ffs_update().
Update some macro names in comments.

Don't use MNT_WAIT for something not related to mounting.
1994-12-27 14:44:42 +00:00
Bruce Evans e4bebee03e Use the same current time throughout ITIMES(). I want all current
timestamps for an atomic operation such as rename() on a local file
system to be identical.

Uniformize yet another idempotency ifdef.  The comment nesting was
bogus.
1994-12-27 13:59:14 +00:00
Bruce Evans 222d875bec Print `slicename' and not a bogus pointer in diskerr() 1994-12-22 04:42:31 +00:00
Bruce Evans fb72042b5c Duplicate readdisklabel() and writedisklabel() and remove DOS stuff from
from the copies to create correct_readdisklabel() and
correct_writedisklabel().

Print the slice number in diskerr() if it is nonzero.
1994-12-16 16:31:23 +00:00
Bruce Evans 3339943545 Submitted by: Kirk McKusick
Allow chown() to return success if the gid isn't changed even if
the gid is not the caller's.  Such gids are normal for files created
in world-writable directories sucj as /tmp.  This "fixes" annoying
error messages for mv'ing files created in /tmp to another file
system.  mv still preserves the foreign gid of /tmp, but now does
it silently.
1994-11-26 19:38:30 +00:00
Justin T. Gibbs 471e5fa096 John Dyson's patches (and a few from me too) to LFS to use a different
buffering scheme and make it more in tune with FreeBSD's vfs_bio
implementation.  The filesystem seems fairly stable, but I wouldn't recommend
it to anyone not willing to experience problems.  This is very green code and
has the limitation that YOU CAN ONLY HAVE ONE LFS PARTITION MOUNTED AT A TIME.

What LFS is good for:

	Non fsynced writes	FASTER THAN FFS
	Large deletions		Increadibly fast

Reads are a little bit slower than FFS right now, but that is a factor of
how under optimized this code is.  LFS should in theory perform at least as
well as FFS under fsync (iozone) type loads, and this is what I'm currently
working on.

Reviewed by:	Justin Gibbs
Submitted by:	John Dyson
Obtained from:
1994-11-17 01:30:53 +00:00
Bruce Evans ad7dee4d66 Remove unused `struct disklabel' (the declarations that used it went away).
Uniformize idempotency ifdef.
1994-11-14 13:50:15 +00:00
Bruce Evans 36633bf49d Undo a previous change. <sys/disklabel.h> was broken, not these files. 1994-11-14 13:22:52 +00:00
Jordan K. Hubbard 94a92413cd From: fredriks@mcs.com (Lars Fredriksen)
...
It turns out that these files do not include <sys/dkbad.h> before
<sys/disklabel.h>.
Submitted by:	fredriks
1994-10-28 12:42:05 +00:00
Jordan K. Hubbard 54c7241bd3 Julian Elischer's disklabel fixes. 1994-10-27 20:45:13 +00:00
David Greenman 901ba606c5 Restrict fs_maxfilesize to 2^40, and check against this in ffs_truncate().
This is part of a bug fix from Kirk McKusick to work around problems in FFS
related to the blkno of a 64bit offset not fitting into an int. Note the
proper solution would be to deal with 64bit block numbers, but doing this
would require sweeping changes; some other day perhaps.

Submitted by:	Marshall Kirk McKusick
1994-10-22 02:27:35 +00:00
Garrett Wollman 091b0456f4 Make my ALLDEVS kernel compile (basically, LINT minus a lot of options).
This involves fixing a few things I broke last time.
1994-10-21 01:19:28 +00:00
Poul-Henning Kamp 1be9232f73 This basically allows you to stick a disklabel on any partition.
For it to be useful, you must stick your disklabel on the partition which
starts where the MBR says FreeBSD lives.  If you don't do that, you might
get a bad day.

Oh, that probably also means that putting swap there is a bad idea...
1994-10-17 02:31:33 +00:00
Andrey A. Chernov ffcef9bdf8 Add back variable declaration removed by wrong previous cleanups 1994-10-15 04:14:23 +00:00
Andrey A. Chernov 2fe5b4cb4e Add back variable declaration removed by wrong prevous cleanups. 1994-10-15 04:08:44 +00:00
Poul-Henning Kamp c1d9efcbb9 Cosmetics. make gcc less noisy. Still some way to go here. 1994-10-10 01:04:55 +00:00
David Greenman 35c10d2239 Got rid of map.h. It's a leftover from the rmap code, and we use rlists.
Changed swapmap into swaplist.
1994-10-09 07:35:18 +00:00
Poul-Henning Kamp 0f954e5d09 POSSIBLE BOGUS CODE found, (related to dos-partitions) in ufs_disksubr.c,
look for CC_WALL.
Cosmetics, a couple of unused vars.
1994-10-08 06:57:29 +00:00
Poul-Henning Kamp c96716023b Cosmetics for gcc -Wall. A couple of unused "int i"'s removed and a couple of
prototypes added.  And the usual () work.
1994-10-08 06:20:06 +00:00
Poul-Henning Kamp 5c0c90e877 Cosmetics. 1994-10-08 01:41:15 +00:00
David Greenman 824789192c Use tsleep() rather than sleep so that 'ps' is more informative about
the wait.
1994-10-06 21:07:04 +00:00
Doug Rabson 9abf4d6ee0 Make NFS ask the filesystems for directory cookies instead of making them
itself.
1994-09-28 16:45:22 +00:00
Poul-Henning Kamp 3810319894 Moved the "relookup" routine into vfs_lookup.c from ufs/ufs/ufs_vnops.c.
Several FS's use this, so it doesn't belong in ufs.  (unionfs, msdosfs and ufs)
1994-09-27 20:33:41 +00:00
David Greenman c770b47d56 Removed unimplemented subr_rmap.c and unused references to it. 1994-09-25 22:31:11 +00:00
Garrett Wollman c9b1d6048d More loadable VFS changes:
- Make a number of filesystems work again when they are statically compiled
  (blush)

- FIFOs are no longer optional; ``options FIFO'' removed from distributed
  config files.
1994-09-22 19:38:41 +00:00
Garrett Wollman 862cdb8eb6 Call ffs ``ufs'' for the benefit of poor, confused user-land programs. 1994-09-22 01:57:27 +00:00
Garrett Wollman c901836c14 Implemented loadable VFS modules, and made most existing filesystems
loadable.  (NFS is a notable exception.)
1994-09-21 03:47:43 +00:00
Bruce Evans 1819efa6e7 Use `1' for a boolean value instead of something irrelevant (MNT_WAIT)
that happens to be nonzero.
1994-09-20 05:53:24 +00:00
David Greenman cde7257454 Eliminated a whole pile of ancient (we're taking 4.3BSD) VM system
related #define constants. Corrected incorrect VM_MAX_KERNEL_ADDRESS.

Reviewed by:	John Dyson
1994-09-12 11:38:31 +00:00
David Greenman 01825ed3fa panic if length is < 0 in ffs_truncate(). 1994-09-02 10:24:55 +00:00
David Greenman 1cdeb653a8 "bogus" fixes from 1.1.5 to work around some cache coherency problems. 1994-08-29 06:09:15 +00:00
Paul Richards 3301cc3c0a Made idempotent
Reviewed by:
Submitted by:
1994-08-21 07:19:45 +00:00
Paul Richards eb9fb78c34 Made idempotent
Reviewed by:
Submitted by:
1994-08-21 07:03:56 +00:00
David Greenman e0e9c42112 Implemented filesystem clean bit via:
machdep.c:
	Changed printf's a little and call vfs_unmountall() if the sync was
	successful.

cd9660_vfsops.c, ffs_vfsops.c, nfs_vfsops.c, lfs_vfsops.c:
	Allow dismount of root FS. It is now disallowed at a higher level.

vfs_conf.c:
	Removed unused rootfs global.

vfs_subr.c:
	Added new routines vfs_unmountall and vfs_unmountroot. Filesystems
	are now dismounted if the machine is properly rebooted.

ffs_vfsops.c:
	Toggle clean bit at the appropriate places. Print warning if an
	unclean FS is mounted.

ffs_vfsops.c, lfs_vfsops.c:
	Fix bug in selecting proper flags for VOP_CLOSE().

vfs_syscalls.c:
	Disallow dismounting root FS via umount syscall.
1994-08-20 16:03:26 +00:00
David Greenman 7b42c960f8 1) cleaned up after Garrett - fixed more redundant declarations, changed
use of timeout_t -> timeout_func_t in aha1542 and aha1742 drivers.
2) fix a bug in the portalfs that was uncovered by better prototyping -
   specifically, the time must be converted from timeval to timespec
   before storing in va_atime.
3) fixed/added some miscellaneous prototypes
1994-08-20 03:49:02 +00:00
Garrett Wollman f23b4c91c4 Fix up some sloppy coding practices:
- Delete redundant declarations.
- Add -Wredundant-declarations to Makefile.i386 so they don't come back.
- Delete sloppy COMMON-style declarations of uninitialized data in
  header files.
- Add a few prototypes.
- Clean up warnings resulting from the above.

NB: ioconf.c will still generate a redundant-declaration warning, which
is unavoidable unless somebody volunteers to make `config' smarter.
1994-08-18 22:36:09 +00:00
David Greenman 92dc7331c9 Made lockf advisory locking code generic (rather than ufs specific), and
use it in NFS. This is required both for diskless support and for POSIX
compliance. Note: the support in NFS is only for the local node.

Submitted by:	based on work originally done by Yuval Yurom
1994-08-08 17:31:01 +00:00
David Greenman 866dba7305 Changed B_AGE policy to work correctly in a world with relatively large
buffer caches. The old policy generally ended up caching nothing.
1994-08-08 09:11:44 +00:00
David Greenman d319b932ae Changed occurrances of "itrunc" to "ffs_truncate" to make Bruce happy. 1994-08-03 08:19:35 +00:00
David Greenman 09ce307fbe Completed (hopefully) the kernel support for old style "fastlinks". 1994-08-02 13:51:05 +00:00
David Greenman 3c4dd3568f Added $Id$ 1994-08-02 07:55:43 +00:00
Rodney W. Grimes 26f9a76710 The big 4.4BSD Lite to FreeBSD 2.0.0 (Development) patch.
Reviewed by:	Rodney W. Grimes
Submitted by:	John Dyson and David Greenman
1994-05-25 09:21:21 +00:00
Rodney W. Grimes df8bae1de4 BSD 4.4 Lite Kernel Sources 1994-05-24 10:09:53 +00:00