Commit Graph

867 Commits

Author SHA1 Message Date
lukem 0635de35a3 Remove KDIR=, since SYS_INCLUDE=symlinks and KDIR are not supported any more. 2002-11-26 23:30:07 +00:00
yamt 42a8b926f9 eliminate i_ino from in-core inode
and use local variable instead.

ok'ed by Frank van der Linden.
2002-11-26 01:23:30 +00:00
thorpej d6f8cc841d Avoid strict-alias warnings. 2002-11-25 01:55:21 +00:00
thorpej b409a344b5 Avoid strict-alias warnings. 2002-11-25 01:44:21 +00:00
yamt 3af39ea015 in lfs_fakebuf, make corresponding buffer busy to avoid
reading blocks that isn't written yet.
it's needed because we'll update metadatas in lfs_updatemeta
before data pointed by them is actually written to disk.

XXX should be solved with fake inode/indirect blocks instead?
2002-11-24 16:39:13 +00:00
yamt 290fa35864 add a XXX comment to lfs_reserve.
* it isn't safe to unlock vp here
 * because we're passing data using inode from namei.
 * (eg. i_offset)
2002-11-24 16:09:50 +00:00
scw 7009056578 Quell an uninitialised variable warning. 2002-11-24 11:09:13 +00:00
yamt eca07565c3 make sure i_lfs_fragsize is initialized.
fix panic "lfs_writefile: more than one fragment!"
PR 18974.
2002-11-24 08:43:26 +00:00
yamt 16a26d41e8 lfs_sync should wait at lfs_writer, not lfs_dirops.
PR 18973.
2002-11-24 08:37:43 +00:00
yamt feacf34c09 lfs_reserve shouldn't block for lfs_unlockvp.
otherwise cleaner deadlocks.
PR 19134.
2002-11-24 08:32:22 +00:00
yamt 37b4f42285 blksize() macro shouldn't used for indirect blocks.
this fixes "getblk: block size invariant failed" panic.
PR 18977.
2002-11-24 08:27:00 +00:00
yamt 7d0ba73802 correct locking for lfs_rmdir. PR 18976. 2002-11-24 08:23:41 +00:00
wiz 29d58d0333 s/sqiud/squid/ in comment, reported by skrueger at europe com. 2002-11-04 16:59:37 +00:00
dbj 1d1cd19e5f use be32toh instead of ntohl, etc. 2002-11-02 19:31:09 +00:00
kristerw 58efa0630e Removed unused variables doclusterread and doclusterwrite. 2002-11-01 21:11:43 +00:00
chs ea6ddab6a8 the work-around in rev. 1.37 (turn off async) wasn't enough to prevent
hangs under heavy load.  so we now apply the more extreme version:
make MFS mounts "sync".  fixes PRs 17128 and 17321.
2002-10-24 16:41:00 +00:00
jdolecek f040fc2e24 ext2fs_remove(): use 'else' to eliminate need for goto (and improve
readibility, even)
2002-10-23 19:52:16 +00:00
jdolecek e0cc03a09b merge kqueue branch into -current
kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

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

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
2002-10-23 09:10:23 +00:00
yamt 8872a5d6af make sure to update the vnode's size even if uiomove failed.
otherwise, softdep states can't be flushed later.

ok'ed by Chuck Silvers. fix PR/16670.
2002-10-18 01:05:52 +00:00
dbj 43395bd5a8 Add support for the Apple UFS variation on ffs
This is the bulk of PR #17345

The general approach is to use a run time deteriminable value
for DIRBLKSIZ.  Additional allowances are included for using
MAXSYMLINKLEN with FS_42INODEFMT and a shift in the cylinder group
cluster summary count array.  Support is added for managing
the Apple UFS volume label.
2002-09-28 20:11:05 +00:00
provos 0f09ed48a5 remove trailing \n in panic(). approved perry. 2002-09-27 15:35:29 +00:00
simonb ad2a80f193 Move a brace that is in the wrong position when changes from FreeBSD
were added in rev 1.51.  This may fix the "N lost blocks" problem some
people have noticed.
Reviewed by fvdl.
2002-09-26 21:35:27 +00:00
jdolecek a120eaa3ea use ufs_balloc_range() rather than local (mostly identical, but with some
bugs) ext2fs variant
2002-09-26 11:06:36 +00:00
thorpej 71404bb533 Don't include <sys/map.h>. 2002-09-25 22:21:01 +00:00
jdolecek e305eb63e8 don't need <sys/conf.h> here 2002-09-22 19:32:54 +00:00
christos 6f3945a88d MNT_GETARGS support 2002-09-21 18:10:34 +00:00
gehenna 77a6b82b27 Merge the gehenna-devsw branch into the trunk.
This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

	device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
  by using this grammer.

- Added the new naming convention.
  The name of the device switch must be <prefix>_[bc]devsw for auto-generation
  of device switch tables.

- The backward compatibility of loading block/character device
  switch by LKM framework is broken. This is necessary to convert
  from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
  We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
  the LKM framework will refer it to assign device major number dynamically.
2002-09-06 13:18:43 +00:00
thorpej 139cdc3125 Make nbuf, nswbuf, and bufpages unsigned. Make all operations on these
variables unsigned, and update places where their values are printed.
2002-08-25 20:21:33 +00:00
itojun 8dd04cdcd7 correct range check, have overflow check, fix type mismatches,
for cmap args and some other calls.  from openbsd
2002-08-03 00:12:48 +00:00
soren 178d83d503 Die, qaddr_t, die! - mnt_data in struct mount is already effectively
a void *, so stop pretending otherwise.
2002-07-30 07:40:07 +00:00
wiz 645df36eff Spell '[Rr]ight' correctly. From Jim Bernard. 2002-07-26 14:11:34 +00:00
hannken 7de36862a8 Rename bufq_init() to bufq_alloc().
Add bufq_free() to remove a buffer queue.
Avoid MALLOC while holding a spinlock.

From Chuck Silvers.
2002-07-21 15:32:17 +00:00
hannken d4c062b4cc Convert to new device buffer queue interface. 2002-07-19 16:26:01 +00:00
perseant 8f30dc2c9b Remove lying comment on SEGM_PROT seglock. 2002-07-11 21:09:00 +00:00
briggs 77f5558791 Fix a printf format warning. 2002-07-07 14:29:06 +00:00
fredette 10d4232908 Fixed a printf argument type. 2002-07-06 15:39:07 +00:00
perseant 32ae84b188 Deal with fragment size changes better. For each fragment that can
exist on an on-disk inode, we keep a record of its size in struct inode,
which is updated when we write the block to disk.  The cleaner routines
thus have ready access to what size is the correct size for this block,
on disk.

Fixed a related bug: if a file with fragments is being cleaned
(fragments being cleaned) at the same time it is being extended beyond
NDADDR blocks, we could write a bogus FINFO record that has a frag in the
middle; when it was cleaned this would give back bogus file data.  Don't
write the indirect blocks in this case, since there is no need.

lfs_fragextend and lfs_truncate no longer require the seglock, but instead
take a shared lock, which the seglock locks exclusively.
2002-07-06 01:30:11 +00:00
scw 881a4dcac0 Cast pointers first to uintptr_t before casting to register_t.
On SH-5, sizeof(register_t) is always 8, even if sizeof(void *) is 4
as is the case when compiling for ILP32.
2002-07-05 13:49:26 +00:00
yamt d566a58b5e fix printf format for DEBUG_LFS. 2002-07-02 19:07:03 +00:00
perseant 0418a2c352 Fix miscalculation in lfs_fits found by Trevin Beattie <trevin@xmission.com>.
Change some of the variable names from "nb", "db" to "fsb" to reflect their
calling conventions.
2002-06-20 22:10:24 +00:00
perseant ae37d9d186 Don't bomb out of lfs_bmapv if the caller is requesting blocks that
live in the current segment.  There's nothing wrong with this, and
it is necessary for the correct operation of the coaleascer.
2002-06-20 20:43:17 +00:00
jdolecek 20644ff75f clear_inodedeps(): use CIRCLEQ_FOREACH() appropriately 2002-06-18 20:24:31 +00:00
perseant ddfb1dbb92 For synchronous writes, keep separate i/o counters for each write, so
processes don't have to wait for one another to finish (e.g., nfsd seems
to be a little happier now, though I haven't measured the difference).
Synchronous checkpoints, however, must always wait for all i/o to finish.

Take the contents of the callback functions and have them run in thread
context instead (aiodoned thread).  lfs_iocount no longer has to be
protected in splbio(), and quite a bit less of the segment construction
loop needs to be in splbio() as well.

If lfs_markv is handed a block that is not the correct size according to
the inode, refuse to process it.  (Formerly it was extended to the "correct"
size.)  This is possibly more prone to deadlock, but less prone to corruption.

lfs_segclean now outright refuses to clean segments that appear to have live
bytes in them.  Again this may be more prone to deadlock but avoids
corruption.

Replace ufsspec_close and ufsfifo_close with LFS equivalents; this means
that no UFS functions need to know about LFS_ITIMES any more.  Remove
the reference from ufs/inode.h.

Tested on i386, test-compiled on alpha.
2002-06-16 00:13:15 +00:00
chs ea4c4a989f allow read-only mounts even if we can't read the last fragment of the fs.
this enables one to recover data from a failing disk (where the read failure
is a hardware problem) while avoiding corrupting the fs further (in the case
where the read failure is due to a misconfiguration).
2002-06-09 16:46:49 +00:00
perseant c13ae45a2a Let lfs_bmapv fill in the bi_size member of the BLOCK_INFO structure,
as well as bi_daddr.  This lets the cleaner have an idea of what the size
of this block was at the time it was written without having to refer to
a segment header (e.g., in the file coalescing case).

Tested on i386.
2002-06-06 00:46:24 +00:00
chs fffb1de109 get the units right when computing a blkno in the ENOSPC path
for allocations involving indirect blocks.
spotted by Trevin Beattie <trevin@xmission.com>.
2002-06-05 05:23:51 +00:00
thorpej 7903aba812 #if 0 a test that is always false (and the XXX comment above it
indicates so).
2002-05-30 18:54:55 +00:00
perseant d67a5bbb21 Fix a couple of instances where reassignbuf() was not done at splbio.
Tested on i386.
2002-05-24 22:13:57 +00:00
perseant 43ca783b4a Back out rev 1.174 of vfs_subr.c, because the splbio() wasn't protecting
enough to be useful, and broadening it so that it did would have meant
that operations possibly requiring synchronous disk activity would have
to be done in splbio().  This clearly was not going to work.

Worked around this in the LFS case by having lfs_cluster_callback put an
extra hold on the vnode before calling biodone(), and taking the hold
off without HOLDRELE's problematic list swapping.  lfs_vunref() will take
care of that---in thread context---on the next write if need be.

Also, ensure that the list walking in lfs_{writevnodes,segunlock,gather}
takes into account the possibility that the list may change
underneath it (possibly because it itself deleted an element).

Tested on i386, test-compiled on alpha.
2002-05-23 23:05:25 +00:00
perseant ec0ca919be Protect v_freelist with splbio(), since HOLDRELE can be called in
interrupt context (through brelvp).  (LFS may be the only subsystem
affected by this problem.)

Tested on i386.
2002-05-20 22:50:57 +00:00
perseant 36efaa3565 use macros from <sys/queue.h> 2002-05-17 21:42:38 +00:00
thorpej 6c1654256e Fix LP64 printf format warning. 2002-05-16 02:23:55 +00:00
perseant 8886b0f4b2 Phase one of my three-phase plan to make LFS play nice with UBC, and bug-fixes
I found while making sure there weren't any new ones.

* Make the write clusters keep track of the buffers whose blocks they contain.
  This should make it possible to (1) write clusters using a page mapping
  instead of malloc, if desired, and (2) schedule blocks for rewriting
  (somewhere else) if a write error occurs.  Code is present to use
  pagemove() to construct the clusters but that is untested and will go away
  anyway in favor of page mapping.
* DEBUG now keeps a log of Ifile writes, so that any lingering instances of
  the "dirty bufs" problem can be properly debugged.
* Keep track of whether the Ifile has been dirtied by various routines that
  can be called by lfs_segwrite, and loop on that until it is clean, for
  a checkpoint.  Checkpoints need to be squeaky clean.
* Warn the user (once) if the Ifile grows larger than is reasonable for their
  buffer cache.  Both lfs_mountfs and lfs_unmount check since the Ifile can
  grow.
* If an inode is not found in a disk block, try rereading the block, under
  the assumption that the block was copied to a cluster and then freed.
* Protect WRITEINPROG() with splbio() to fix a hang in lfs_update.
2002-05-14 20:03:53 +00:00
mycroft 1523c4c12f In ufs_mkdir(), write the data block *before* updating the inode with the
block pointer, to prevent "DIRECTORY CORRUPTED" errors from fsck(8).
Note: The behavior in the softdep case is unchanged, but needs to be fixed.
2002-05-14 17:37:52 +00:00
matt fed7110558 Commit out code that's no longer used. 2002-05-14 02:46:22 +00:00
matt 0cb85bc7b9 Eliminate commons. 2002-05-12 23:06:27 +00:00
enami b86c56a0b6 Add comment that getblk() in ufs_bmaparray() returns an error only if
we are pagedaemon.
2002-05-11 12:23:53 +00:00
chs e926e6ec99 use the correct size when zeroing an array. 2002-05-05 17:01:41 +00:00
chs dcc6963777 for softdep vnodes, always write together the pages for any block that
might have a dependency , since the accounting doesn't work otherwise.
fixes PRs 15364 16336 16448.
2002-05-05 17:00:06 +00:00
perseant 76d2795556 Make exported LFSes not panic on the first file create. 2002-04-27 01:00:46 +00:00
thorpej 37dc008ca3 Cleanup how file system configuration information is declared, grouping
related information together, with the file system code itself.

This is just low-hanging fruit -- more to come.
2002-04-16 23:14:05 +00:00
mycroft fd303c4dc5 Add a special case for nrpos=1 to cbtorpos(). This massively reduces CPU usage
by newfs(8) -- and fsck_ffs(8) on a relatively empty file system.  There is
still one divide left in the inner loops, to calculate cylno values.
2002-04-10 14:31:07 +00:00
mycroft afc5d40400 Use blkstofrags() and fragstoblks(). Use &(NBBY-1) rather than %NBBY.
Switch off of fs_fragshift rather than fs_frag (generates better jump tables).
2002-04-10 08:05:11 +00:00
mycroft 0a9b835878 Use fsbtodb() rather than multiplying by NSPF(). 2002-04-10 07:46:10 +00:00
enami 89cf6e2727 Hold an extra reference if updating and args.fspec == NULL. 2002-04-01 07:51:58 +00:00
christos e356d686bb Fixes from enami:
- If VOP_ACCESS fails when updating mount, we will vrele() twice.

- The check for update-only flags in mp->mnt_flag when not updating
  case is bogus.  If we really want to check, we need to see flags in
  ufs_args, but I'm not sure if it is really necessary.

- The credential passed to ffs_reload was credential of when looking
  up mount point, but now it is credential of when looking up device
  node.  Anyway, it may be current process's credential.
2002-04-01 01:52:44 +00:00
christos 919d9f5617 PR/16136: Chris Jepeway: Bogus entry in /etc/fstab can panic kernel. 2002-03-31 20:53:25 +00:00
chs fe10bac175 if the size argument to write(2) is 0, do not modify the file in any way,
including updating timestamps.  required for standards conformance.
2002-03-25 02:23:55 +00:00
chs 0f2018fc31 in lfs_write(), flush and invalidate any page cache pages in the range
that we're about to modify.  this weak attempt at coherency is enough
to make some applications (eg. "tail -f") happy, so it's worth having.
2002-03-22 03:57:35 +00:00
wiz 358ed3f6d4 Fix a typo, a KNF-nit, and simplify a printf format string. 2002-03-18 13:38:52 +00:00
chs 79c365e60e don't do any flush-behind for async mounts.
this matches the traditional behaviour.
2002-03-17 23:58:09 +00:00
chs c1d184702f when mounting a filesystem, read the last block in the filesystem
to verify that the device is at least as big as the superblock claims
the filesystem is supposed to be, and if it's not then fail the mount.
this should help reduce the type of confusion reported in PR 13228.
2002-03-17 00:02:34 +00:00
thorpej a180cee23b Pool deals fairly well with physical memory shortage, but it doesn't
deal with shortages of the VM maps where the backing pages are mapped
(usually kmem_map).  Try to deal with this:

* Group all information about the backend allocator for a pool in a
  separate structure.  The pool references this structure, rather than
  the individual fields.
* Change the pool_init() API accordingly, and adjust all callers.
* Link all pools using the same backend allocator on a list.
* The backend allocator is responsible for waiting for physical memory
  to become available, but will still fail if it cannot callocate KVA
  space for the pages.  If this happens, carefully drain all pools using
  the same backend allocator, so that some KVA space can be freed.
* Change pool_reclaim() to indicate if it actually succeeded in freeing
  some pages, and use that information to make draining easier and more
  efficient.
* Get rid of PR_URGENT.  There was only one use of it, and it could be
  dealt with by the caller.

From art@openbsd.org.
2002-03-08 20:48:27 +00:00
simonb 9a942a34e0 Don't use local extern declarations for the mountroot variable or
declare local prototypes for nfs_mountroot() or md_root_setconf().
2002-03-04 02:25:21 +00:00
pooka 360cafaddb Don't add fs->fs_pendingblocks to f_bavail twice. It's already included
in f_bfree, which is added to f_bavail.

Fixes problem with statfs reporting too much free space for filesystems
which have files pending to be freed by softdeps.
2002-02-28 21:59:23 +00:00
enami 70ca5d5195 Record some page cache related information into ubchist. 2002-02-22 08:23:16 +00:00
wiz c809c3243b Fix two problems with softdep_typenames (missing entry, wrong boundary check).
Okayed by fvdl.
2002-02-14 00:49:56 +00:00
perseant f41358613c Include the space taken by inodes in the count made by lfs_check();
make VOP_SETATTR call lfs_check.  This prevents large numbers of inode
changes (say, at the end of tar(1)) from filling the buffer cache.
2002-02-11 02:47:29 +00:00
chs 94cfc87907 bring in the change from FreeBSD's rev. 1.107 of this file:
date: 2002/02/07 00:54:32;  author: mckusick;  state: Exp;  lines: +10 -7
  Occationally deleted files would hang around for hours or days
  without being reclaimed. This bug was introduced in revision 1.95
  dealing with filenames placed in newly allocated directory blocks,
  thus is not present in 4.X systems. The bug is triggered when a
  new entry is made in a directory after the data block containing
  the original new entry has been written, but before the inode
  that references the data block has been written.

  Submitted by:   Bill Fenner <fenner@research.att.com>

This should fix NetBSD PR 15531.
2002-02-10 18:06:03 +00:00
lukem caa29fae38 #undef DIRBLKSIZ before #define-ing it 2002-02-06 15:44:49 +00:00
perseant 8ded9a2c7d Correct free list tail pointer, when adding blocks of new inodes to v2
filesystems.  Should fix PR #14408.
2002-02-04 03:32:16 +00:00
chs eecf9e208a fix PR 15299 by making MFS filesystems not be "async".
in the longer term, MFS needs to be made a lot more VM-friendly.
2002-02-03 03:51:57 +00:00
tv 880a2cf970 These sources are pulled into makefs(8), so we need config.h and protection
for __KERNEL_RCSID().
2002-01-31 19:19:22 +00:00
tv 5d28098c5b Revert previous. This is actually being done a better way. 2002-01-31 19:18:18 +00:00
tv 8ec192426e For makefs, only include <machine/bswap.h> if it exists. 2002-01-31 19:17:02 +00:00
tv af3dca1ea8 #undef MAXNAMLEN before defining it; this lets ufs/ufs/dir.h be used
properly on non-NetBSD hosts with makefs(8).
2002-01-31 19:16:34 +00:00
chs 1b454dbb4f fix an error case. 2002-01-26 08:32:05 +00:00
enami ac35ac58f5 - For CIRCLEQ, comparing the loop variable against NULL doesn't make sense.
- Minor KNF while I'm here.

# This doesn't fix real problems though.
2002-01-18 00:30:03 +00:00
enami 9ad4436bc2 Fix typo which prevents diagnostic test from working. 2002-01-16 08:33:12 +00:00
lukem 25ca00a979 Only pull in <sys/systm.h> #ifdef _KERNEL, since it's a kernel only header.
In the ! _KERNEL case, provide own prototype for panic() instead.
2002-01-09 23:51:00 +00:00
lukem 202e920175 revert part of rev 1.14 - #include <ufs/ufs/dinode.h> - because that
makes it MUCH more difficult to reference this file stand-alone.
2002-01-07 15:25:22 +00:00
thorpej fdb5b56e5f Do not compare an integer to NULL. 2001-12-31 21:37:22 +00:00
fvdl a833eaf1fe XXXX temporary measure: in the case of a softdep 'unmount pending error',
do not mark the filesystem clean, as this will mean that one or more
     files were likely not completely removed (will show up as unconnected
     in fsck). Prevents filesystems from being marked clean while they're
     not until this problem has been figured out.
2001-12-30 15:46:53 +00:00
fvdl d0f7c6fb96 Use softdep_change_linkcnt to note that the inode mode was set to 0.
From FreeBSD.
2001-12-27 01:48:38 +00:00
fvdl c9218f8686 The softdep code sometimes use vfs_vget .. vput. For removals, these
would result in a vop_inactive call for the vnode each time, resulting
in vinvalbuf->fsync. The original softdep code avoided the fsync
in vinvalbuf by not calling it if there were no dirty blocks. This
was changed in NetBSD. Also, flush_inodedeps was changed to mark
the inode as modified so that it would do an inode update and flush the
last one. This combination basically caused a sync write for each removed
file in an rm -rf (showing up delayed from the syncer a lot of the time).

If called from vinvalbuf (FSYNC_RECLAIM), and there were no dirty blocks
or pages to begin with, still do everything as normal, so that possible dirty
blocks in transit to disk are properly waited for, etc, but don't pass
UPDATE_WAIT to VOP_UPDATE, since there is no need for it in that case.
2001-12-27 01:44:59 +00:00
fvdl 2b5fe12a98 Pull over one missed fix from FreeBSD wrt. running out of quota. Also
reshuffle some code a bit to make it look more similar (no functional
change).
2001-12-27 01:29:05 +00:00
fvdl 08f29df58c As pointed out by mycroft and reflected in the comment, update the
directory inode before creating the new entry (not the freshly alloced
directory which isn't linked anywhere yet).
2001-12-23 16:16:59 +00:00
fvdl 983d322c7c Fix botch in my original softdep code merge: remove redundant (and
synchronous to boot) VOP_UPDATE call.
2001-12-23 14:00:21 +00:00
fvdl f1db177e10 Fix from FreeBSD that I missed: speed up handling of short-lived
files a bit.
2001-12-23 11:54:46 +00:00
chs 2ddcad30f6 process the delayed-free queue more often. 2001-12-23 08:53:46 +00:00
fvdl 68728c0901 ffs_reload may be called after an old fsck has run, and the pending*
fields may not be zero. Just reset them silently, it's not an error.
2001-12-19 15:20:19 +00:00
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 0d70d731c2 use the new compatibility routines to allow mmap() to work
(in the same non-coherent fashion that it worked pre-UBC)
until someone has time to do it the right way.
2001-12-18 07:51:16 +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 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
chs a4f1bc813a pick up changes from ufs_balloc_range(). 2001-11-30 07:06:19 +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 a106161b5a add spaces for KNF. confirmed to produce identical objects. 2001-11-23 21:44:25 +00:00
chs 3f9a8628df we need to hold the pageq lock while calling uvm_page_unbusy() on
pages that uvm_page_unbusy() will free.
2001-11-22 02:42:37 +00:00
lukem 4a269de9a1 fix compile error noted by itojun in [kern/14638] 2001-11-19 11:56:50 +00:00
lukem 5b0ef8ec1a be consistent and cache UFS_*NEEDSWAP results in more functions 2001-11-19 07:00:21 +00:00
simonb f809eb7333 Set `flags' before being used in the WRITE() function. 2001-11-17 07:22:34 +00:00
lukem 2ee0a3f232 move code to calculate size of direct for a given namlen to separate
DIRECTSIZ() macro, and use this to implement a (now shorter) DIRSIZ().
inspired by freebsd
2001-11-16 16:09:17 +00:00
lukem 2565646230 don't need <sys/types.h> when including <sys/param.h> 2001-11-15 09:47:59 +00:00
chs 4b4425d13b some callers of ufs_bmaparray() in LFS depend on *nump being set to 0 for
direct blocks, so restore that behaviour.
2001-11-13 06:23:17 +00:00
chs dc4cf974e0 track some changes in the ufs code:
update UVM's notion of the file size in *_write() rather than
*_balloc().
2001-11-10 17:48:02 +00:00
chs c237f81065 update to track ufs_bmap.c:
don't call ufs_getlbns() for direct blocks.
2001-11-10 17:46:23 +00:00
chs 9f52e62b73 fix the previous change: use the correct test for a block number
referring to a direct block.
2001-11-10 07:11:00 +00:00
chs 81625d675b the previous fix (in rev. 1.26) for hangs when the filesystem is full
was wrong, so fix it right this time.  undo the previous change and
instead, replace the troublesome VOP_FSYNC()s with code that just flushes
the particular indirect blocks that we allocated.  this resolves the
softdeps for those blocks.  then we can change the pointer for
the first indirect block we allocated to zero, write that, and finally
invalidate all the indirect blocks we've touched.  also, wait until
after we finish all this before freeing any blocks we allocated.
fixes PRs 14413 and 14423.
2001-11-08 05:27:25 +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
chs 0de5f1ba39 only call ufs_getlbns() for blocks which involve indirects, and assert
that this is so.  use a shift instead of a multiply in one place.
2001-11-08 05:00:51 +00:00
chs f57fce8e9e call VOP_PUTPAGES() directly for vnodes instead of
going through the UVM pager "put" vector.
2001-11-08 04:51:05 +00:00
lukem 6ff2f2f438 add RCSID. (note; this file gets #included) 2001-11-08 02:42:31 +00:00
lukem ec6245465a add RCSID 2001-11-08 02:39:06 +00:00
simonb c56d879335 Remove some variables that are set but never used. 2001-11-06 07:11:29 +00:00
simonb 915441c64b Use the sector size from the partition info, not a hard-coded value. 2001-11-06 07:09:39 +00:00
simonb ecf09baab6 Remove a variable that is set but never used. 2001-11-06 07:08:09 +00:00
simonb bb57e2c53c Remove some bogus checks for unsigned variables < 0. 2001-11-06 06:59:05 +00:00
simonb 6129c87d2e Remove superfluous semicolon. 2001-11-06 06:40:44 +00:00
lukem b3b9740195 add __KERNEL_RCSID() 2001-10-30 01:11:53 +00:00
lukem 80ac606906 ffs_sb_swap() fixes:
- calculate the offset and length of the postbl before byteswapping.
  problem noted by der Mouse.
- use offsetof() to determine # of fields to calculate in initial
  loop, rather than hard-coding in `52 fields'
- improve comments.
2001-10-29 11:26:35 +00:00
lukem 6f39841c03 - pull in ufsmount.h after inode.h, because the latter pulls in
quota.h which the former needs, and this makes the usage consistent
  with other files anyway
- expand the details in a few panic strings
2001-10-26 06:37:55 +00:00
lukem 99147a7648 remove #include <ufs/ufs/quota.h> where it was just to appease
<ufs/ufs/inode.h>, since the latter now includes the former.  leave the former
in source that obviously uses specific bits of it (for completeness.)
2001-10-26 05:56:06 +00:00
lukem d0dc904dae this needs <ufs/ufs/quota.h>, so pull it in 2001-10-26 05:46:57 +00:00
lukem a9439165d0 rename inclusion protection define from _QUOTA_ to _UFS_UFS_QUOTA_H_ 2001-10-26 05:44:29 +00:00
chs a2e3e57398 initialize the vnode's copy of the size in lfs_ialloc(). 2001-10-14 19:06:16 +00:00
chs eaa7f39f23 in ufs_balloc_range(), if we extend a fragment and need to write the
fragment synchronously, update the vnode's size before doing the flush.
otherwise we might only write part of the data and cause softdep's
accounting to get out of sync.  fixes PR 14201.
many thanks to enami for figuring out what was going on.
2001-10-10 06:37:53 +00:00
chs 8b8f98cdbe don't do any flush-behind for async mounts.
this matches the traditional behaviour.
2001-10-03 05:02:46 +00:00
chs d4406ff8c9 in ffs_balloc(), clean up page cache state to avoid hangs when we
get ENOSPC. as a result of this, we now skip some of the normal cleanup
in ufs_balloc_range() in the error case.
2001-09-30 02:54:42 +00:00
chs 9f02fbe7a7 process one block at a time even when we're using the write fast path
that avoids zeroing pages.  this avoids a mess when we get ENOSPC and
softdeps are enabled.
2001-09-30 02:50:35 +00:00
chs 80373b7e54 don't depend on other headers to include sys/proc.h for us. 2001-09-28 11:59:51 +00:00
chs 299934b2ed handle allocation errors in truncate-up case. 2001-09-28 11:43:23 +00:00
chs d288111138 undo the part of the previous revision about skipping
the put if there are no pages, that seems to cause some problem.
fix another problem with missing an splx(), spotted by enami.
2001-09-26 06:20:50 +00:00
chs e8be8c6351 be sure to call the pager put with page-aligned offsets.
spotted by Nathan Williams.

while I'm here, move an splbio() so that we don't return without
splx()ing it if there's an error, and don't bother calling the
pager put if the vnode has no pages.
2001-09-26 05:25:03 +00:00
chs a29a7b1934 when creating a symlink, set the vnode's copy of the size also. 2001-09-23 05:28:23 +00:00
chs 520b477a5a check early for reads beyond EOF. 2001-09-22 22:44:08 +00:00
sommerfeld 181c4513dc Add fifo_putpages() placebo so that the vnode's uobj is unlocked. 2001-09-22 22:35:18 +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
lukem 9c5c77ae54 - ffs_blkpref() changes:
- don't both updating fs->fs_cgrotor, since it's actually not used in
	  the kernel. from Manuel Bouyer in [kern/3389]
	- when examining cylinder groups from startcg to startcg-1 (wrapping
	  at fs->fs_ncg), there's no need to check startcg at the end as well
	  as the start...
- highlight in the struct fs declaration that fs_cgrotor is UNUSED
2001-09-19 01:38:16 +00:00
chs 9699742484 make LFS work again. 2001-09-16 13:57:56 +00:00
jdolecek 68aacb8f70 add softdep_reinitialize() stub 2001-09-16 13:51:45 +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 5d3eefe245 use pools for allocating most softdep datastructures. since we want to
allocate memory from kernel_map but some of the objects are freed from
interrupt context, we put objects on a queue instead of freeing them
immediately.  then in softdep_process_worklist() (which is called at
least once per second from the syncer), we process that queue and
free all the objects.  allocating from kernel_map instead of from kmem_map
allows us to have a much larger number of softdeps pending even in
configurations where kmem_map is relatively small.
2001-09-15 16:33:53 +00:00
chs adf5d360a7 add a new VFS op, vfs_reinit, which is called when desiredvnodes is
adjusted via sysctl.  file systems that have hash tables which are
sized based on the value of this variable now resize those hash tables
using the new value.  the max number of FFS softdeps is also recalculated.

convert various file systems to use the <sys/queue.h> macros for
their hash tables.
2001-09-15 16:12:54 +00:00
lukem 5c2ee5861d Incorporate the enhanced ffs_dirpref() by Grigoriy Orlov, as found in
FreeBSD (three commits; the initial work, man page updates, and a fix
to ffs_reload()), with the following differences:
- Be consistent between newfs(8) and tunefs(8) as to the options which
  set and control the tuning parameters for this work (avgfilesize & avgfpdir)
- Use u_int16_t instead of u_int8_t to keep track of the number of
  contiguous directories (suggested by Chuck Silvers)
- Work within our FFS_EI framework
- Ensure that fs->fs_maxclusters and fs->fs_contigdirs don't point to
  the same area of memory

The new algorithm has a marked performance increase, especially when
performing tasks such as untarring pkgsrc.tar.gz, etc.

The original FreeBSD commit messages are attached:

=====
mckusick    2001/04/10 01:39:00 PDT
  Directory layout preference improvements from Grigoriy Orlov <gluk@ptci.ru>.
  His description of the problem and solution follow. My own tests show
  speedups on typical filesystem intensive workloads of 5% to 12% which
  is very impressive considering the small amount of code change involved.

  ------

    One day I noticed that some file operations run much faster on
  small file systems then on big ones. I've looked at the ffs
  algorithms, thought about them, and redesigned the dirpref algorithm.

    First I want to describe the results of my tests. These results are old
  and I have improved the algorithm after these tests were done. Nevertheless
  they show how big the perfomance speedup may be. I have done two file/directory
  intensive tests on a two OpenBSD systems with old and new dirpref algorithm.
  The first test is "tar -xzf ports.tar.gz", the second is "rm -rf ports".
  The ports.tar.gz file is the ports collection from the OpenBSD 2.8 release.
  It contains 6596 directories and 13868 files. The test systems are:

  1. Celeron-450, 128Mb, two IDE drives, the system at wd0, file system for
     test is at wd1. Size of test file system is 8 Gb, number of cg=991,
     size of cg is 8m, block size = 8k, fragment size = 1k OpenBSD-current
     from Dec 2000 with BUFCACHEPERCENT=35

  2. PIII-600, 128Mb, two IBM DTLA-307045 IDE drives at i815e, the system
     at wd0, file system for test is at wd1. Size of test file system is 40 Gb,
     number of cg=5324, size of cg is 8m, block size = 8k, fragment size = 1k
     OpenBSD-current from Dec 2000 with BUFCACHEPERCENT=50

  You can get more info about the test systems and methods at:
  http://www.ptci.ru/gluk/dirpref/old/dirpref.html

                                Test Results

               tar -xzf ports.tar.gz               rm -rf ports
    mode  old dirpref new dirpref speedup old dirprefnew dirpref speedup
                               First system
   normal     667         472      1.41       477        331       1.44
   async      285         144      1.98       130         14       9.29
   sync       768         616      1.25       477        334       1.43
   softdep    413         252      1.64       241         38       6.34
                               Second system
   normal     329         81       4.06       263.5       93.5     2.81
   async      302         25.7    11.75       112          2.26   49.56
   sync       281         57.0     4.93       263         90.5     2.9
   softdep    341         40.6     8.4        284          4.76   59.66

  "old dirpref" and "new dirpref" columns give a test time in seconds.
  speedup - speed increasement in times, ie. old dirpref / new dirpref.

  ------

  Algorithm description

  The old dirpref algorithm is described in comments:

  /*
   * Find a cylinder to place a directory.
   *
   * The policy implemented by this algorithm is to select from
   * among those cylinder groups with above the average number of
   * free inodes, the one with the smallest number of directories.
   */

  A new directory is allocated in a different cylinder groups than its
  parent directory resulting in a directory tree that is spreaded across
  all the cylinder groups. This spreading out results in a non-optimal
  access to the directories and files. When we have a small filesystem
  it is not a problem but when the filesystem is big then perfomance
  degradation becomes very apparent.

  What I mean by a big file system ?

    1. A big filesystem is a filesystem which occupy 20-30 or more percent
       of total drive space, i.e. first and last cylinder are physically
       located relatively far from each other.
    2. It has a relatively large number of cylinder groups, for example
       more cylinder groups than 50% of the buffers in the buffer cache.

  The first results in long access times, while the second results in
  many buffers being used by metadata operations. Such operations use
  cylinder group blocks and on-disk inode blocks. The cylinder group
  block (fs->fs_cblkno) contains struct cg, inode and block bit maps.
  It is 2k in size for the default filesystem parameters. If new and
  parent directories are located in different cylinder groups then the
  system performs more input/output operations and uses more buffers.
  On filesystems with many cylinder groups, lots of cache buffers are
  used for metadata operations.

  My solution for this problem is very simple. I allocate many directories
  in one cylinder group. I also do some things, so that the new allocation
  method does not cause excessive fragmentation and all directory inodes
  will not be located at a location far from its file's inodes and data.
  The algorithm is:
  /*
   * Find a cylinder group to place a directory.
   *
   * The policy implemented by this algorithm is to allocate a
   * directory inode in the same cylinder group as its parent
   * directory, but also to reserve space for its files inodes
   * and data. Restrict the number of directories which may be
   * allocated one after another in the same cylinder group
   * without intervening allocation of files.
   *
   * If we allocate a first level directory then force allocation
   * in another cylinder group.
   */

    My early versions of dirpref give me a good results for a wide range of
  file operations and different filesystem capacities except one case:
  those applications that create their entire directory structure first
  and only later fill this structure with files.

    My solution for such and similar cases is to limit a number of
  directories which may be created one after another in the same cylinder
  group without intervening file creations. For this purpose, I allocate
  an array of counters at mount time. This array is linked to the superblock
  fs->fs_contigdirs[cg]. Each time a directory is created the counter
  increases and each time a file is created the counter decreases. A 60Gb
  filesystem with 8mb/cg requires 10kb of memory for the counters array.

    The maxcontigdirs is a maximum number of directories which may be created
  without an intervening file creation. I found in my tests that the best
  performance occurs when I restrict the number of directories in one cylinder
  group such that all its files may be located in the same cylinder group.
  There may be some deterioration in performance if all the file inodes
  are in the same cylinder group as its containing directory, but their
  data partially resides in a different cylinder group. The maxcontigdirs
  value is calculated to try to prevent this condition. Since there is
  no way to know how many files and directories will be allocated later
  I added two optimization parameters in superblock/tunefs. They are:

          int32_t  fs_avgfilesize;   /* expected average file size */
          int32_t  fs_avgfpdir;      /* expected # of files per directory */

  These parameters have reasonable defaults but may be tweeked for special
  uses of a filesystem. They are only necessary in rare cases like better
  tuning a filesystem being used to store a squid cache.

  I have been using this algorithm for about 3 months. I have done
  a lot of testing on filesystems with different capacities, average
  filesize, average number of files per directory, and so on. I think
  this algorithm has no negative impact on filesystem perfomance. It
  works better than the default one in all cases. The new dirpref
  will greatly improve untarring/removing/coping of big directories,
  decrease load on cvs servers and much more. The new dirpref doesn't
  speedup a compilation process, but also doesn't slow it down.

  Obtained from:	Grigoriy Orlov <gluk@ptci.ru>
=====

=====
iedowse     2001/04/23 17:37:17 PDT
  Pre-dirpref versions of fsck may zero out the new superblock fields
  fs_contigdirs, fs_avgfilesize and fs_avgfpdir. This could cause
  panics if these fields were zeroed while a filesystem was mounted
  read-only, and then remounted read-write.

  Add code to ffs_reload() which copies the fs_contigdirs pointer
  from the previous superblock, and reinitialises fs_avgf* if necessary.

  Reviewed by:	mckusick
=====

=====
nik         2001/04/10 03:36:44 PDT
  Add information about the new options to newfs and tunefs which set the
  expected average file size and number of files per directory.  Could do
  with some fleshing out.
=====
2001-09-06 02:16:00 +00:00
lukem c50eb8cc85 deprecate fs_fscktime; we never used it.
in an effort to maintain compatibility with freebsd/openbsd/whatever,
i'm attempting to get the superblock format in sync, and freebsd uses
the int32_t at this position for `fs_pendinginodes'.

if we ever decide to implement fscktime functionality, we'll:
a) make sure to liaise with the other projects to reserve the same
   spare field
b) actually implement the code this time ...

(this is also preparing us for other changes, like the new dirpref code)
2001-09-03 14:52:17 +00:00
lukem e3ba61f9f3 Incorporate fix by iedowse @ FreeBSD to allow disks with large numbers of
cylinder groups to work correctly, with minor modifications by me to work
with our FFS_EI code.  From the FreeBSD commit message:

	The ffs superblock includes a 128-byte region for use by temporary
	in-core pointers to summary information. An array in this region
	(fs_csp) could overflow on filesystems with a very large number of
	cylinder groups (~16000 on i386 with 8k blocks). When this happens,
	other fields in the superblock get corrupted, and fsck refuses to
	check the filesystem.

	Solve this problem by replacing the fs_csp array in 'struct fs'
	with a single pointer, and add padding to keep the length of the
	128-byte region fixed. Update the kernel and userland utilities
	to use just this single pointer.

	With this change, the kernel no longer makes use of the superblock
	fields 'fs_csshift' and 'fs_csmask'. Add a comment to newfs/mkfs.c
	to indicate that these fields must be calculated for compatibility
	with older kernels.

	Reviewed by:    mckusick
2001-09-02 01:58:30 +00:00
lukem 563fb2d03f no need to cast arg to lblktosize() any more 2001-08-31 03:38:45 +00:00
lukem 2bfd8a2678 More fixes from FreeBSD (with changes):
- Cast blk argument to lblktosize() to (off_t), to prevent 32 bit overflow.
  whilst almost every use in ffs used this for small blknos, there are
  potential issues, and it's safer this way.  (as discussed with chuq)
- Use 64bit (off_t) math to calculate if we have hit our freespace() limit.
  Necessary for coherent results on filesystems bigger than 0.5Tb.
- Use lblktosize() in blksize() and dblksize(), to make it obvious what's
  happening
- Remove sblksize() - nothing uses it
2001-08-31 03:15:45 +00:00
lukem 0cf1d74c5b be consistent when casting arg to lblktosize() in UVM_PAGE_TRKOWN debug code 2001-08-30 15:17:28 +00:00
lukem c56418af73 some improvements from freebsd/openbsd
- replace the unused fs_headswitch and fs_trkseek with fs_id[2], bringing
  our struct fs closer to that in freebsd & openbsd (& solaris FWIW)
- dumpfs: improve warning message when cpc == 0
2001-08-30 14:37:25 +00:00
lukem c535133897 - minor whitespace and comments cleanup
- replace "filesystem" with "file system"
- fix spelo (from freebsd)
2001-08-30 08:31:25 +00:00
chs 1de4b3e2e0 min() -> MIN() (on general principles) 2001-08-30 03:55:42 +00:00
chs eccd469cf7 min() -> MIN() 2001-08-30 03:47:53 +00:00
wiz 251b3464be heirarchy -> hierarchy 2001-08-24 10:24:45 +00:00
chs cb3b720183 disable mmap() for LFS until it is fixed. 2001-08-24 06:42:46 +00:00
wiz 1e378c4c12 precede, not preceed. 2001-08-20 12:00:46 +00:00
chs f0af9f581b add getpages/putpages entries for spec vnodes. 2001-08-17 05:54:36 +00:00
lukem 1b81d6353d remove third argument (`int ns') from ffs_sb_swap(), and let ffs_sb_swap()
determine the endianness of the `struct fs *o' superblock from o->fs_magic
and set needswap as necessary, rather than trusting the caller to get
it right.  invariably, almost every caller of ffs_sb_swap() was calling it
with ns set to the wrong value for ns anyway!
ansi KNF ffs_bswap.c declarations whilst here.

this fixes all sorts of problems when trying to use other-endian file systems,
notably the kernel trying to access memory *way* off, possibly corrupting or
panicing, and userland programs SEGVing and/or corrupting things (e.g,
"fsck_ffs -B"  to swap a file system endianness).

whilst the previous rev of ffs_bswap.c (1.10, 2000/12/23) made this problem
worse, i suspect that the problem was always there and previous versions
just happened not to trash things at the wrong time.

FFS_EI should now be a lot more stable.
2001-08-17 02:18:46 +00:00
lukem ed54fa2d76 correctly cast arguments to scanc() 2001-08-09 08:16:42 +00:00
lukem 1a2d5cf412 be consistent and use "u_char" instead of "unsigned char" 2001-08-09 08:15:26 +00:00
lukem a73aa816f3 get argument name correct in comment describing vop_balloc_args 2001-08-08 08:36:36 +00:00
jdolecek 58ed62e500 Constraint 'blkcnt' of lfs_markv() syscall by 64KB. Reviewed by
Konrad Schroder <perseant@NetBSD.org>.
2001-08-03 06:02:42 +00:00
lukem 3cd4afc9e3 - multiple include protection
- pull in <ufs/ufs/dinode.h> for ufs_daddr_t
- mark a few fields as being "UNUSED" (because they are)
2001-07-27 01:28:06 +00:00
lukem c358141302 multiple include protection 2001-07-27 01:24:54 +00:00
jdolecek bd21ec5d2e lfs_writeseg(): make el_size a size_t (cosmetic only, no functional change) 2001-07-26 20:20:15 +00:00
lukem 714cac851d if printing the value of fs_clean, say 'fs_clean' instead of 'fs_flags' ... 2001-07-26 07:58:55 +00:00
lukem fcf7f6cd06 fix spelo 2001-07-26 07:55:54 +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
perseant 4e3fced95b Merge the short-lived perseant-lfsv2 branch into the trunk.
Kernels and tools understand both v1 and v2 filesystems; newfs_lfs
generates v2 by default.  Changes for the v2 layout include:

- Segments of non-PO2 size and arbitrary block offset, so these can be
  matched to convenient physical characteristics of the partition (e.g.,
  stripe or track size and offset).

- Address by fragment instead of by disk sector, paving the way for
  non-512-byte-sector devices.  In theory fragments can be as large
  as you like, though in reality they must be smaller than MAXBSIZE in size.

- Use serial number and filesystem identifier to ensure that roll-forward
  doesn't get old data and think it's new.  Roll-forward is enabled for
  v2 filesystems, though not for v1 filesystems by default.

- The inode free list is now a tailq, paving the way for undelete (undelete
  is not yet implemented, but can be without further non-backwards-compatible
  changes to disk structures).

- Inode atime information is kept in the Ifile, instead of on the inode;
  that is, the inode is never written *just* because atime was changed.
  Because of this the inodes remain near the file data on the disk, rather
  than wandering all over as the disk is read repeatedly.  This speeds up
  repeated reads by a small but noticeable amount.

Other changes of note include:

- The ifile written by newfs_lfs can now be of arbitrary length, it is no
  longer restricted to a single indirect block.

- Fixed an old bug where ctime was changed every time a vnode was created.
  I need to look more closely to make sure that the times are only updated
  during write(2) and friends, not after-the-fact during a segment write,
  and certainly not by the cleaner.
2001-07-13 20:30:18 +00:00
toshii 4866f1a22b Fix typo. s/extention/extension/ 2001-07-05 08:38:24 +00:00
chs c31ab668df in ext2fs_balloc_range(), clear PG_RDONLY on pages which now have backing store. 2001-07-04 21:16:01 +00:00
chs 2a7b0d97d6 in ufs_balloc_range(), clear PG_RDONLY on pages which now have backing store.
fixes PR 13353.
2001-07-04 21:08:48 +00:00
wiz f3f6c5b675 `accessible' only has one `a'. 2001-06-19 12:52:20 +00:00
mrg 804019f100 only include "fs_lfs.h" if _KERNEL_OPT. 2001-06-05 09:19:33 +00:00
chs d8bbc51566 fix an error case for quotas. 2001-06-03 16:49:07 +00:00
mrg 67afbd6270 use _KERNEL_OPT 2001-05-30 11:57:16 +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
enami c17241f92a Don't flush possibilly relocated file system block if write is done
asynchronously.  They will be flushed later when necessary and flushing
now makes sequential write access very slow.
2001-04-18 03:48:23 +00:00
thorpej 5b35dc8136 When unmounting a file system, acquire the syncer_lock before
vfs_busy'ing just before the dounmount() call.  This is to avoid
sleeping with the mountlist_slock held -- but we must acquire
syncer_lock before vfs_busy because the syncer itself uses
syncer_lock -> vfs_busy locking order.
2001-04-16 22:41:09 +00:00
chs 331bd97cbd work around a problem with sync writes vs. softdeps. 2001-03-26 06:47:34 +00:00
fvdl ad5dcb280f Same change as in the UFS code: unlock vnode before setting v_op
to spec_vnode_ops. From Bill Studenmund.
2001-03-23 21:10:48 +00:00
fvdl 509b0d01a5 Do an explicit VOP_UNLOCK in ufs_vinit before setting v_op to
spec_vnode_ops_p. Workaround for a lock leak. Problem tracked
down by der Mouse.
2001-03-23 12:15:34 +00:00
sommerfeld d02dde9937 Change ffs_dirpref() to pay attention to the amount of available free
space before deciding which cylinder group should contain a new directory
inode.

Fixes kern/11983; works around some, but not all, of the side effects
of kern/11989.

Tested by me for well over a month on my laptop; preliminary versions of
the fix were tested by Frank van der Linden and Herb Peyerl.
2001-03-13 21:16:23 +00:00
chs 060e70db41 min() -> MIN(), max() -> MAX().
fixes more problems with file offsets > 4GB.
2001-02-27 04:37:44 +00:00
chs dfd2654fd2 min() -> MIN(), max() -> MAX().
fixes more problems with file offsets > 4GB.
2001-02-27 02:55:40 +00:00
fvdl 418264a670 Some bugfixes from rev 1.33 and 1.34 of this file in FreeBSD (some
in effect cosmetic). Original FreeBSD commit messages:

==
date: 2000/03/15 07:18:15;  author: mckusick;  state: Exp;  lines: +4 -4
Bug fixes for currently harmless bugs that could rise to bite
the unwary if the code were called in slightly different ways.

[...]

2) In ufs_lookup() there is an off-by-one error in the test that checks
if dp->i_diroff is outside the range of the the current directory size.
This is completely harmless, since the following while-loop condition
'dp->i_offset < endsearch' is never met, so the code immediately
does a second pass starting at dp->i_offset = 0.

3) Again in ufs_lookup(), the condition in a sanity check is wrong
for directories that are longer than one block. This bug means that
the sanity check is only effective for small directories.

Submitted by:   Ian Dowse <iedowse@maths.tcd.ie>

==

date: 2000/03/09 18:54:59;  author: dillon;  state: Exp;  lines: +2 -2
branches:  1.33.2;
    In the 'found' case for ufs_lookup() the underlying bp's data was
    being accessed after the bp had been releaed.  A simple move of the
    brelse() solves the problem.

Approved by: jkh
Submitted by:  Ian Dowse <iedowse@maths.tcd.ie>

==
2001-02-26 20:25:11 +00:00
lukem 5694890732 convert to ANSI KNF 2001-02-26 18:09:20 +00:00
lukem ae86fc2df2 some KNF 2001-02-26 17:12:08 +00:00
cgd 4dddddfe62 fix bug (pointed out as sequence point violation warning with current-ish gcc)
caused by use of makedev(major,minor++).  makedev() now (since 32-bit
dev_t conversion) evaluates its second argument twice.
2001-02-24 00:05:22 +00:00