Jake Burkholder [Sat, 22 Jun 2002 23:55:15 +0000 (23:55 +0000)]
Fix a bug related to marking pages virtually uncacheable due to illegal
dcache aliasing. A page that already had more than 1 mapping of the
same virtual colour would not be correctly uncached.
John Polstra [Sat, 22 Jun 2002 22:35:53 +0000 (22:35 +0000)]
Fix several bugs in the i386 asm statements used to speed up Internet
checksumming. These bugs could possibly cause bad code to be
generated at elevated optimization levels.
First, eliminate the use of preprocessor magic to form the address
fields of asm instructions. It hid the actual addresses being
referenced from the compiler. Without knowledge of all the data
dependencies, the compiler might possibly use optimizations which
would result in incorrect code.
Use "__asm __volatile" rather than "__asm" for instruction sequences
that pass information through the condition codes (the carry bit, in
this case). Without __volatile, the compiler might add unrelated
code between consecutive __asm instructions, modifying the condition
codes. I have seen GCC insert stack pointer adjustments in this
way, for example. Unfortunately, GCC doesn't provide a way to
specify dependencies on the condition codes. You can specify that
they are clobbered, but not that you are going to use them as input.
Finally, simplify the LOAD macro. This macro is used as a poor
man's prefetch. The simpler version gives the compiler more leeway
about just how it performs the prefetch.
Kirk McKusick [Sat, 22 Jun 2002 22:01:13 +0000 (22:01 +0000)]
This patch fixes a size problem with the stat structure for
64-bit architectures that was introduced in the UFS2 code
merge two days ago. The stat structure change that caused
the problem was the addition of the file create time.
Submitted by: Bruce Evans <bde@zeta.org.au>
Sponsored by: DARPA & NAI Labs.
Kirk McKusick [Sat, 22 Jun 2002 21:24:58 +0000 (21:24 +0000)]
This patch fixes a problem whereby filesystems that ran
out of inodes in a cylinder group would fail to check for
free inodes in other cylinder groups. This bug was introduced
in the UFS2 code merge two days ago.
An inode is allocated by calling ffs_valloc which calls
ffs_hashalloc to do the filesystem scan. Ffs_hashalloc
walks around the cylinder groups calling its passed allocator
(ffs_nodealloccg in this case) until the allocator returns a
non-zero result. The bug is that ffs_hashalloc expects the
passed allocator function to return a 64-bit ufs2_daddr_t.
When allocating inodes, it calls ffs_nodealloccg which was
returning a 32-bit ino_t. The ffs_hashalloc code checked
a 64-bit return value and usually found random non-zero bits in
the high 32-bits so decided that the allocation had succeeded
(in this case in the only cylinder group that it checked).
When the result was passed back to ffs_valloc it looked at
only the bottom 32-bits, saw zero and declared the system
out of inodes. But ffs_hashalloc had really only checked
one cylinder group.
The fix is to change ffs_nodealloccg to return 64-bit results.
Sponsored by: DARPA & NAI Labs.
Submitted by: Poul-Henning Kamp <phk@critter.freebsd.dk>
Reviewed by: Maxime Henrion <mux@freebsd.org>
Matthew Dillon [Sat, 22 Jun 2002 19:09:35 +0000 (19:09 +0000)]
Fix a bug in vfs_bio_clrbuf(). The single-page-clrbuf optimization was
improperly clearing more then just the invalid portions of the page. (This
bug is not known to have been triggered by anything).
Alan Cox [Sat, 22 Jun 2002 18:36:51 +0000 (18:36 +0000)]
o Replace mtx_assert(&Giant, MA_OWNED) in dev_pager_alloc()
with the acquisition and release of Giant. (Annotate as MPSAFE.)
o Reorder the sanity checks in dev_pager_alloc() to reduce
the time that Giant is held.
Matthew Dillon [Sat, 22 Jun 2002 18:36:21 +0000 (18:36 +0000)]
The last bits of the alloca -> mmap fix. IA64 and SPARC64 (current only).
Untested (testing request went unanswered), but sparc64 is not expected to
cause problems. IA64 is not expected to cause problems but the patch was
slightly more complex so the possibility exists.
Maxime Henrion [Sat, 22 Jun 2002 18:07:05 +0000 (18:07 +0000)]
o Remove the initialization of unused fields in the struct
uio now that we don't use uiomove() anymore.
o Enforce stricter checks on the length of the iov's in
nmount(2) since we now malloc() them individually and
corrupted iov's could make the kernel crash in malloc()
with "kmem_map too small".
Alan Cox [Sat, 22 Jun 2002 17:47:12 +0000 (17:47 +0000)]
o In vm_map_insert(), replace GIANT_REQUIRED by the acquisition and
release of Giant around the direct manipulation of the vm_object and
the optional call to pmap_object_init_pt().
o In vm_map_findspace(), remove GIANT_REQUIRED. Instead, acquire and
release Giant around the occasional call to pmap_growkernel().
o In vm_map_find(), remove GIANT_REQUIRED.
Luigi Rizzo [Sat, 22 Jun 2002 11:51:02 +0000 (11:51 +0000)]
Remove (almost all) global variables that were used to hold
packet forwarding state ("annotations") during ip processing.
The code is considerably cleaner now.
The variables removed by this change are:
ip_divert_cookie used by divert sockets
ip_fw_fwd_addr used for transparent ip redirection
last_pkt used by dynamic pipes in dummynet
Removal of the first two has been done by carrying the annotations
into volatile structs prepended to the mbuf chains, and adding
appropriate code to add/remove annotations in the routines which
make use of them, i.e. ip_input(), ip_output(), tcp_input(),
bdg_forward(), ether_demux(), ether_output_frame(), div_output().
On passing, remove a bug in divert handling of fragmented packet.
Now it is the fragment at offset 0 which sets the divert status of
the whole packet, whereas formerly it was the last incoming fragment
to decide.
Removal of last_pkt required a change in the interface of ip_fw_chk()
and dummynet_io(). On passing, use the same mechanism for dummynet
annotations and for divert/forward annotations.
option IPFIREWALL_FORWARD is effectively useless, the code to
implement it is very small and is now in by default to avoid the
obfuscation of conditionally compiled code.
NOTES:
* there is at least one global variable left, sro_fwd, in ip_output().
I am not sure if/how this can be removed.
* I have deliberately avoided gratuitous style changes in this commit
to avoid cluttering the diffs. Minor stule cleanup will likely be
necessary
* this commit only focused on the IP layer. I am sure there is a
number of global variables used in the TCP and maybe UDP stack.
* despite the number of files touched, there are absolutely no API's
or data structures changed by this commit (except the interfaces of
ip_fw_chk() and dummynet_io(), which are internal anyways), so
an MFC is quite safe and unintrusive (and desirable, given the
improved readability of the code).
Luigi Rizzo [Sat, 22 Jun 2002 11:29:08 +0000 (11:29 +0000)]
Define an mbuf type, MT_TAG, used for volatile annotations
prepended to mbuf chains in the network stack.
Reuse a previoulsy unused value to avoid changes in other
data structures.
Juli Mallett [Sat, 22 Jun 2002 10:44:47 +0000 (10:44 +0000)]
Replace the SWAP(var0,var1) macro with SWAP(type,var0,var1) and use it as
is appropriate to avoid using typeof/__typeof__. It is worth noting that
SWAP() is only ever used to swap pointer values so 'void *' assumptions would
have been acceptable, but I'd gladly pay you tuesday for a cheeseburger^W
cleaner interface today.
Alan Cox [Sat, 22 Jun 2002 07:54:42 +0000 (07:54 +0000)]
o Remove GIANT_REQUIRED from phys_pager_alloc(). If handle isn't NULL,
acquire and release Giant. If handle is NULL, Giant isn't needed.
o Annotate phys_pager_alloc() and phys_pager_dealloc() as MPSAFE.
Alan Cox [Sat, 22 Jun 2002 07:28:06 +0000 (07:28 +0000)]
o Replace GIANT_REQUIRED in vnode_pager_alloc() by the acquisition and
release of Giant. (Annotate as MPSAFE.)
o Also, in vnode_pager_alloc(), remove an unnecessary re-initialization
of struct vm_object::flags and move a statement that is duplicated
in both branches of an if-else.
Robert Watson [Sat, 22 Jun 2002 01:49:03 +0000 (01:49 +0000)]
Make it clear that this applies only to UFS1 file systems, as UFS2 will
have native extended attributes rather than stacked extended attributes.
While I'm at it, make sure UFS_EXTATTR is not spelt FFS_EXTATTR.
Sponsored by: DARPA, NAI Labs
Obtained from: TrustedBSD Project
Tim J. Robbins [Sat, 22 Jun 2002 01:42:26 +0000 (01:42 +0000)]
Don't store newlines at the end of each line in the hold/pattern spaces,
instead add the newline when the pattern space is printed. Make the `G' and
`H' commands add a newline to the space before the data, remove bogus
addition of newline from `x' command.
David E. O'Brien [Fri, 21 Jun 2002 19:24:12 +0000 (19:24 +0000)]
Clarify revision 1.14:
Gcc 3.1's -O0 and -O1 actually optimized alignment for space, but we feel
it should optimize alignment for time like Gcc 2.95 used to. Optimization
for space should give 1-byte alignment on i386's, but doesn't quite.
David E. O'Brien [Fri, 21 Jun 2002 19:05:20 +0000 (19:05 +0000)]
We need to link with libiberty.a before libreadline.so. Both supply
xmalloc() and xrealloc() and the mixed usage of xmalloc in some .c's from
libiberty.a and other .c's from libreadline.so produces an unusable binary
on the Alpha.
While I am here, preventatively move other libs in the link order.
David E. O'Brien [Fri, 21 Jun 2002 18:21:30 +0000 (18:21 +0000)]
cc -O0 and -O1 didn't do the easy optimization of alignment for space.
Instead it attempted to do the easy optimization of alignment for time,
which should be to 1-byte alignment on i386's.
Also do some markup fixes to recently-added items so that they don't
try to use entities for manpages that have been removed, in the spirit
of rev. 1.359.
Juli Mallett [Fri, 21 Jun 2002 10:56:44 +0000 (10:56 +0000)]
Clean up hex() and octal() to return and work with unsigned integers since
they scan values of unsigned types, and since they do not need otherwise,
have them take const char * arguments.
Mark Murray [Fri, 21 Jun 2002 10:14:57 +0000 (10:14 +0000)]
Modernise this code by rounding up the usual suspects: register keyword,
consts, ANSIfication of functions, proper use of __FBSDID() and so on.
This commit is non-functional from a code-execution perspective, but
pr(1) now compiles WARNS=6 clean.
Bruce Evans [Fri, 21 Jun 2002 09:57:34 +0000 (09:57 +0000)]
Don't say that an umounted filesystem is required for -n. An unmounted
filesystem is no more or less required for -n than for any other option.
The previous commit clarified the actual requirement.
Tim J. Robbins [Fri, 21 Jun 2002 07:08:34 +0000 (07:08 +0000)]
Newline characters should not participate in line comparisons. Only apparent
when -s is used or the last line of the file is missing a newline.
Noticed by the textutils test suite.
Kirk McKusick [Fri, 21 Jun 2002 06:18:05 +0000 (06:18 +0000)]
This commit adds basic support for the UFS2 filesystem. The UFS2
filesystem expands the inode to 256 bytes to make space for 64-bit
block pointers. It also adds a file-creation time field, an ability
to use jumbo blocks per inode to allow extent like pointer density,
and space for extended attributes (up to twice the filesystem block
size worth of attributes, e.g., on a 16K filesystem, there is space
for 32K of attributes). UFS2 fully supports and runs existing UFS1
filesystems. New filesystems built using newfs can be built in either
UFS1 or UFS2 format using the -O option. In this commit UFS1 is
the default format, so if you want to build UFS2 format filesystems,
you must specify -O 2. This default will be changed to UFS2 when
UFS2 proves itself to be stable. In this commit the boot code for
reading UFS2 filesystems is not compiled (see /sys/boot/common/ufsread.c)
as there is insufficient space in the boot block. Once the size of the
boot block is increased, this code can be defined.
Things to note: the definition of SBSIZE has changed to SBLOCKSIZE.
The header file <ufs/ufs/dinode.h> must be included before
<ufs/ffs/fs.h> so as to get the definitions of ufs2_daddr_t and
ufs_lbn_t.
Still TODO:
Verify that the first level bootstraps work for all the architectures.
Convert the utility ffsinfo to understand UFS2 and test growfs.
Add support for the extended attribute storage. Update soft updates
to ensure integrity of extended attribute storage. Switch the
current extended attribute interfaces to use the extended attribute
storage. Add the extent like functionality (framework is there,
but is currently never used).
Sponsored by: DARPA & NAI Labs.
Reviewed by: Poul-Henning Kamp <phk@freebsd.org>