Commit Graph

497 Commits

Author SHA1 Message Date
perseant 4446817aca Make sure to unmark B_DELWRI on blocks freed due to truncation to a non-zero
file length.  Should fix PR #s 10551 and 10831.
2000-09-09 03:47:05 +00:00
fvdl ce4bcf47f3 Do not call MALLOC with M_WAITOK while holding the "lock". Thanks to
Ethan Solomita for the reminder.

Mark the parent vnode lock as recursive while flushing pagedeps. XXX.
Should fix kern/10564.
2000-08-15 14:25:08 +00:00
thorpej 7cc27a88c0 Convert namei pathname buffer allocation to use the pool allocator. 2000-08-03 20:41:05 +00:00
thorpej f0dca1ecbe MALLOC()/FREE() are not to be used for variable sized allocations. 2000-08-03 20:29:26 +00:00
mycroft bd58d06c50 Need string.h for memset() prototype. 2000-07-24 00:23:10 +00:00
jdolecek b0fb24279c change the lf_advlock() arguments from
int     lf_advlock __P((struct lockf **,
           off_t, caddr_t, int, struct flock *, int));
to

int     lf_advlock __P((struct vop_advlock_args *, struct lockf **, off_t));

This matches common usage and is also compatible with similar change
in FreeBSD (though they use u_quad_t as last arg).
2000-07-22 15:26:11 +00:00
jdolecek 166a3f16dd ext2fs_reload(), ext2fs_mountfs(): do devvp locking same way as ffs
this has not shown any good or bad effect, but might help narrow
some problems people seen with ext2fs reload (hi Soren!)
2000-07-22 14:49:17 +00:00
thorpej f9ba0345f1 XXX Use of hzto() return value needs to be double-checked here. 2000-07-13 17:35:03 +00:00
perseant 562aaaa063 Fix so non-kernel code will compile (_LKM) 2000-07-06 20:32:06 +00:00
perseant 90b9d9b502 Clean up accounting of lfs_uinodes (dirty but unwritten inodes).
Make lfs_uinodes a signed quantity for debugging purposes, and set it to
zero as fs mount time.

Enclose setting/clearing of the dirty flags (IN_MODIFIED, IN_ACCESSED,
IN_CLEANING) in macros, and use those macros everywhere.  Make
LFS_ITIMES use these macros; updated the ITIMES macro in inode.h to know
about this.  Make ufs_getattr use ITIMES instead of FFS_ITIMES.
2000-07-05 22:25:43 +00:00
jdolecek 84846c5caa kern.maxvnodes (and hence desireddquot) depends more directly on NVNODE than
on NPROC, adjust the hint to tablefull() accordingly
2000-07-05 17:08:14 +00:00
perseant bc303e52cb Fix errors observed while trying to fill the filesystem with yesterday's
fixes:

- Write copies of bfree and avail in the CLEANERINFO block, so the
  cleaner doesn't have to guess which superblock has the current
  information (if indeed any do).

- Tighten up accounting of lfs_avail (more needs to be done).

- When cleansing indirect blocks of UNWRITTEN, make sure not to mark
  them clean, since they'll need to be rewritten later.
2000-07-04 22:30:37 +00:00
mjacob eb17c77233 Add missing second argument to tablefull call. I *think* the added
message makes sense- somebody might want to check it.
2000-07-04 20:31:55 +00:00
perseant eccd5fb47a Fix i_ffs_blocks in fragment extension case where fragment has not yet
been written to disk.
2000-07-03 20:12:42 +00:00
fvdl 7c1d5ec58f Correct typo in previous. 2000-07-03 18:22:10 +00:00
perseant 235a4dd595 i_lfs_effnblks fixes. Put debugging printfs under #ifdef DEBUG_LFS. 2000-07-03 08:20:58 +00:00
perseant ef2da50400 Allow the number of free segments reserved for the cleaner to be
parametrized in the filesystem, defaulting to MIN_FREE_SEGS = 2 but set
to something more reasonable at newfs_lfs time.

Note the number of blocks that have been scheduled for writing but which
are not yet on disk in an inode extension, i_lfs_effnblks.  Move
i_ffs_effnlink out of the ffs extension and onto the main inode, since
it's used all over the shared code and the lfs extension would clobber
it.

At inode write time, indirect blocks and inode-held blocks of inodes
that have i_lfs_effnblks != i_ffs_blocks are cleansed of UNWRITTEN disk
addresses, so that these never make it to disk.
2000-07-03 01:45:46 +00:00
perseant db557257e5 Move SET_ENDOP after vrele to avoid deactivating vnode twice, if
SET_ENDOP triggers a write.
2000-07-01 19:03:57 +00:00
fvdl fa78158b15 Rearrange code around getnewvnode as was already done for ffs, to avoid
locking against oneself because getnewvnode recycles a softdep-using vnode.
2000-06-30 20:45:38 +00:00
mrg 419501093a remove include of <vm/vm.h> and <uvm/uvm_extern.h> 2000-06-28 14:16:37 +00:00
mrg 91cc436b9e <vm/vm.h> -> <uvm/uvm_extern.h> 2000-06-28 14:11:33 +00:00
fvdl d09958adad Due to popular demand, change vinsheadfree to ungetnewvnode to make
the name clearer. No functional change.
2000-06-27 23:51:22 +00:00
fvdl bba2403203 In ffs_vget, do not hold ufs_haslock across the call to getnewvnode.
We may sleep in it, or even recurse, with softdeps. Instead, grab
the lock later, but check if noone else has beaten us to the VFS_VGET
operation, and if so, roll back getnewvnode using vinsheadfree, and
just return.
2000-06-27 23:39:17 +00:00
perseant 39b86955ed Fixes associated with filling an LFS:
Change the space computation to appear to change the size of the *disk*
rather than the *bytes used* when more segment summaries and inode
blocks are written.  Try to estimate the amount of space that these will
take up when more files are written, so the disk size doesn't change too
much.

Regularize error returns from lfs_valloc, lfs_balloc, lfs_truncate: they
now fail entirely, rather than succeeding half-way and leaving the fs in
an inconsistent state.

Rewrite lfs_truncate, mostly stealing from ffs_truncate.  The old
lfs_truncate had difficulty truncating a large file to a non-zero size
(indirect blocks were not handled appropriately).

Unmark VDIROP on fvp after ufs_remove, ufs_rmdir, so these can be
reclaimed immediately: this vnode would not be written to disk again
anyway if the removal succeeded, and if it failed, no directory
operation occurred.

ufs_makeinode and ufs_mkdir now remove IN_ADIROP on error.
2000-06-27 20:57:11 +00:00
perseant d8584d7769 From John Evans <jevans@cray.com>: use datosn() to convert to segment
number, when remarking the current segment ACTIVE.  See PR #10463.
2000-06-27 20:00:03 +00:00
pk 88b0328aca We shouldn't be defining DEBUG and DIAGNOSTIC on our own; these may have
unwanted side-effects in the header files. For now, do the internal
#defines after including the headers.
2000-06-27 16:46:54 +00:00
perseant 9235101232 fix my own typo, grr.... 2000-06-22 18:46:57 +00:00
perseant fd451352d9 Read i_ffs_gen from the version number in the Ifile during lfs_valloc,
instead of keeping it always == 1.  (The ifile version number is
increased on vfree.)  May address PR #7213, but I haven't been able to
test thoroughly enough to say for sure.
2000-06-22 18:31:49 +00:00
perseant 973ddee4e5 Update lfs_vunref for the fact that now a vnode can be locked with no
references (locked for VOP_INACTIVE at the end of vrele) and it's okay.
Check the return value of lfs_vref where appropriate.
Fixes PR #s 10285 and 10352.
2000-06-22 18:11:45 +00:00
fvdl 45b3f2405a Moved here from gnu/sys/ufs/ffs 2000-06-22 16:13:41 +00:00
fvdl 77b2bcbe07 Copyright changed. 2000-06-22 15:23:05 +00:00
perseant da29133e76 make it compile (fix typo) 2000-06-16 05:45:14 +00:00
matt 1b5bc7ce61 ignore the softdep flags when mounting and there's no softdep in the kernel. 2000-06-16 00:30:15 +00:00
fvdl 4f11634756 Allow MNT_SOFTDEP to be passed in via the mount(2) system call, do not
require it to be set via tunefs(8). Silently ignore it when doing
an update mount of a writeable filesystem, the FFS/softdep code isn't ready
for this yet.
2000-06-15 22:35:37 +00:00
sommerfeld c4ae18d047 Bitbucket MFS I/O after vfs_shutdown has started.. 2000-06-11 03:09:55 +00:00
perseant 4be4b8ad47 Don't try to inactivate dirop vnodes that are still in the middle of
their dirop.
2000-06-06 22:56:54 +00:00
perseant 9139045320 Protect inode free list with seglock, instead of separate lock, so that
the head of the inode free list (on the superblock) always matches the
rest of the free list (in the ifile).

Protect lfs_fragextend with seglock, to prevent the segment byte count
fudging from making its way to disk.

Don't try to inactivate dirop vnodes that are still in the middle of
their dirop (may address PR#10285).
2000-06-06 20:19:14 +00:00
fredb ef3785c36a Make this build. (Balance parenthesis. 2000-05-31 03:37:34 +00:00
perseant 61861bace5 update for IN_ACCESSED changes 2000-05-31 01:40:01 +00:00
mycroft 719d6db0e2 Adjust where IN_MODIFIED and IN_ACCESSED are cleared (as in the FFS code). 2000-05-30 19:09:44 +00:00
mycroft 70ac5e4326 Back out previous kluge. 2000-05-30 17:40:12 +00:00
mycroft 64f5a574a7 In ffs_update():
* Move the clearing of IN_MODIFIED and IN_ACCESSED later, so they are not
  cleared if the bread() failed.
* Explicitly set waitfor to 0 in the softdep case, if IN_MODIFIED is not
  set (mirroring the bwrite()/bdwrite() decision).
2000-05-30 17:23:52 +00:00
fvdl f0112539bd Mark an inode as changed after a rename. It wasn't before in the softdep
case, which created inodes with dependencies, but no IN_* flag set,
so the dependencies were never flushed (after the waitfor check in
ffs_update was removed).
2000-05-30 15:22:12 +00:00
perseant ae7e580ebd Don't try to "correct" accounting for fragments being extended but which
have never been written to disk.
2000-05-30 04:08:41 +00:00
mycroft 4db674fa50 According to Frank, buffers with dependencies *are* left on v_dirtyblks, so
remove the FSYNC_RECLAIM check and force them to be flushed.
2000-05-29 18:53:35 +00:00
mycroft ced05c5744 Pull in IN_ACCESSED changes and some MNT_LAZY `bug fixes' from FFS to EXT2FS. 2000-05-29 18:41:07 +00:00
mycroft 33ec489188 Pull in IN_ACCESSED changes and some MNT_LAZY `bug fixes' from FFS. 2000-05-29 18:34:36 +00:00
mycroft edfd1e6f32 Use LIST_{FIRST,NEXT,EMPTY}(). 2000-05-29 18:28:48 +00:00
mycroft d747ada9c2 Add a new inode flags called IN_ACCESSED. This used in place of IN_MODIFIED
to record that the atime was updated.  In ffs_update(), we only do synchronous
writes if something *other* than the atime was changed.
2000-05-29 18:04:30 +00:00
mycroft 941524439a Never call softdep_sync_metadata() in the FSYNC_RECLAIM case. Any pending
blocks are detached from the vnode at this point.  When the dependencies are
broken to enable writing the blocks, the vnode will be regenerated.  (The only
reason we sync buffers in this case is that they have to be detached from the
vnode.)
2000-05-29 17:19:20 +00:00
mycroft c47adf55e0 In ffs_fsync(), remove the FSYNC_RECLAIM special case, so that it properly
waits for pending buffers, and doesn't throw away time stamp updates.
2000-05-29 17:12:06 +00:00
mycroft ccf1cf4b69 MNT_WAIT -> FSYNC_WAIT 2000-05-29 16:28:27 +00:00
mycroft dad58e313b Pull in indirect block unwind code from FFS. 2000-05-28 08:44:32 +00:00
mycroft 1ea529f6df DTRT when unwinding multiple levels. 2000-05-28 08:31:41 +00:00
mycroft 4fc7b946c2 When unwinding a failed allocation, make sure to nuke the unwound block from
the vnode's block list.  This fixes `itrunc3' panics (at least in some cases;
further testing is needed) and prevents further lossage later on.
2000-05-28 08:15:40 +00:00
mycroft 4656dfd24f Add a new function to remove extra buffers when truncating a file. This is
more generic than the vinvalbuf(V_SAVEMETA) case, avoiding synchronous
operations when truncating to a non-zero length.
2000-05-28 04:13:56 +00:00
thorpej 21fc65e1a8 sleep() -> tsleep() 2000-05-27 04:52:27 +00:00
perseant 29f616cebe Prevent dirops from getting around lfs_check and wedging the buffer cache.
All the dirop vnops now mark the inodes with a new flag, IN_ADIROP, which
is removed as soon as the dirop is done (as opposed to VDIROP which stays
until the file is written).  To address one issue raised in PR#9357.
2000-05-27 00:19:52 +00:00
thorpej 7b6dd5a1c9 In chkdq(), check for NOCRED. Should fix port-alpha/10147. 2000-05-20 03:25:14 +00:00
thorpej 5026e056e2 Back out previous change; there is something Seriously Wrong. 2000-05-19 20:42:20 +00:00
thorpej f636538446 NULL != 0 2000-05-19 04:34:39 +00:00
thorpej dd494c1a6c Redo the way MFS does I/O to the server's address space. Instead of
queueing up buffers and awakening the MFS server process to do the I/O,
we do the I/O to the server process's address space directly using
facilities provided by UVM.

This makes it possible for buffers attempting to flush out while the
MFS is being unmounted to actually do the I/O, where before it would
fail if the server process wasn't in the MFS idle loop (i.e. had been
signaled and was attempting to exit).

Should fix kern/10122 (I can no longer reproduce the problem described
in the PR when running with these changes), and any number of other
MFS-related complaints made by people over time.
2000-05-16 17:20:23 +00:00
thorpej 6d7f14dc5d Record the proc directly, not the pid, of the MFS server process,
and nuke the spare fields in the mfsnode.
2000-05-16 00:24:08 +00:00
bouyer 1900598507 Sync copyrigth notice. 2000-05-15 08:51:55 +00:00
perseant f0728fdce1 Change the sementics of the last parameter from a boolean ("waitfor") to
a set of flags ("flags").  Two flags are defined, UPDATE_WAIT and
UPDATE_DIROP.

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

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

Closes PR#8996.
2000-05-13 23:43:06 +00:00
perseant bcbb008f63 stop vnode reference leak introduced in patch to PR#9994 2000-05-10 16:47:01 +00:00
perseant 737dec82d6 Change the way LFS does block accounting, from trying to infer from the
buffer cache flags, to marking the inode and/or indirect blocks with a
special disk address UNWRITTEN==-2 when a block is accounted for.  (This
address is never written to disk, but only used in-core.  This is essentially
the same method of block accounting as on the UBC branch, where the buffer
headers don't exist.)  Make sure that truncation is handled properly,
especially in the case of holey files.

Fixes PR#9994.
2000-05-05 20:59:20 +00:00
perseant 37f567639c Test whether the filesystem is an LFS before trying to read the alternate
superblock (whose disk address is stored in the primary superblock).  Also,
refuse to mount a filesystem whose superblocks overlap or where the alt.
superblock has a lower disk address than the primary superblock.

Solves PR#10001.
2000-04-29 00:23:00 +00:00
perseant 4ea5a53003 get rid of unused variable aflags 2000-04-24 19:07:16 +00:00
perseant eedb742e6e Fix problems outlined in PR#9926:
- lfs_truncate extends the file if called with length > i_ffs_size;
    - lfs_truncate errors out if called with length < 0;
	- lfs_balloc block accounting corrected for the case of blocks read
	  into the cache before they exist on disk;
	- mp->mnt_stat.f_iosize is initialized in lfs_mountfs.
2000-04-23 21:10:26 +00:00
jdolecek c78399fc88 Add a new sysctl variable vfs.ffs.log_changeopt - if this is true,
an optimalization strategy change is logged into syslog. Default
is 0 (to not log). This replaces the recent not quite "right"
change to only log the change if kernel is compiled with DEBUG.
2000-04-04 09:23:20 +00:00
augustss 169ac5b3c1 Remove register declarations. 2000-03-30 12:41:09 +00:00
simonb e4f5c09322 Delete redundant decls of fifo_vnodeop_p - it's in <miscfs/fifofs/fifo.h>.
Don't need <sys/conf.h> here.
2000-03-30 02:49:11 +00:00
simonb c2e5560a03 Delete redundant decls of rootvp - it's in <sys/systm.h>.
Delete redundant decl of ffs_sbupdate() - it's in <ufs/ffs/ffs_extern.h>.
2000-03-30 02:48:22 +00:00
jdolecek a6cb6fe4ee Log the optimization changes only if DEBUG. Fixes kern/9697 2000-03-29 08:46:57 +00:00
simonb bd11640b2c Remove redundant decl of rootvp - it's in <sys/systm.h>. 2000-03-29 04:03:08 +00:00
simonb 0fd09c8496 Don't need to include <sys/conf.h> here. 2000-03-29 03:43:33 +00:00
thorpej fa7d868ade Small cosmetic change. 2000-03-22 01:03:33 +00:00
fvdl 512503c606 If we're reclaiming, and there are no dirty blocks, just return. 2000-03-17 01:26:52 +00:00
jdolecek 67d0de97b6 Change ufs_init() to keep global count of how many times it was called.
Resources are initialized still just once (on first call).

Add ufs_done(), which takes care of freeing all resources allocated in
ufs_init(). The resources are freed only when last user of the code exits.
2000-03-16 18:26:49 +00:00
jdolecek 03efc0b2b7 Add new VFS op routine - vfs_done and call it on filesystem detach
in vfs_detach(). vfs_done may free global filesystem's resources,
typically those allocated in respective filesystem's init function.
Needed so those filesystems which went in via LKM have a chance to
clean after themselves before unloading.

For each leaf filesystem, add appropriate vfs_done routine.

Also remember how many times ffs_init() was called and do
the appropriate initialization on first call only. In ffs_done(),
destroy the resources when called by the last user of ffs code.
Change mfs to call ffs_init()/ffs_done() appropriately.
2000-03-16 18:20:06 +00:00
jdolecek 89015c4648 Add new VFS op routine - vfs_done and call it on filesystem detach
in vfs_detach(). vfs_done may free global filesystem's resources,
typically those allocated in respective filesystem's init function.
Needed so those filesystems which went in via LKM have a chance to
clean after themselves before unloading. This fixes random panics
when LKM for filesystem using pools was loaded and unloaded several
times.

For each leaf filesystem, add appropriate vfs_done routine.
2000-03-16 18:08:17 +00:00
fvdl 1c78f3708b Inititalize the fs variable struct a little earlier to avoid referencing
a bad pointer in a printf. Problem reported by Krister Walfridsson.
2000-03-16 10:37:00 +00:00
fvdl e3dbad5a3c Revert this back to 2 revisions ago, these checks are done higher up now. 2000-03-15 16:31:52 +00:00
fvdl 563d336e44 Don't immediately return in ffs_fsync if there appears to be no data
to flush if it's a vnode on a softdep filesystem. softdep_sync_metadata
may still need to do some work.
2000-03-14 13:06:29 +00:00
soren 95054da1a1 Fix doubled 'the's in comments. 2000-03-13 23:52:25 +00:00
bouyer 31a775880b lfs_truncate: handle synlinks with length > maxsymlink_len as regular files.
For symlinks > 60 chars we were bzero'ing part of (struct inode) past the
actual inode struct, corrupting memory following the current (struct inode)
resuling in a 'panic: pool_get(lfsinopl): free list modified' later.
This could also be the cause of random panics. With this fix LFS seems to be
useable for me now.
2000-03-12 01:45:01 +00:00
perseant 61fa9e1409 Move vinvalbuf's check for dirty blocks into ffs_fsync, to ensure that
mode and ownership bits are flushed to disk before the vnode is
reclaimed.

The check, introduced in the softdep merge, assumes that if no blocks
are dirty, no file data *or metadata* needs to be flushed to disk.  This
is true of ffs, but is not true of lfs, and may not be true of other
filesystems.

Tested by myself and Bill Squier <groo@cs.stevens-tech.edu>.
2000-03-11 05:00:18 +00:00
fvdl 89670eb646 Fix a bug introduced in Lite2 with block allocation and full disk
conditions. Reported by Ian Dowse <iedowse@maths.tcd.ie>, based
on patch in FreeBSD reviewed by Kirk McKusick.
2000-02-25 19:58:25 +00:00
wiz 1515bd47fc remove obsoleted #if defined(UVM) 2000-02-20 06:34:46 +00:00
fvdl fe39281ea4 Fixes to the softdep code from Ethan Solomita <ethan@geocast.com>.
* Fix buffer ordering when it has dependencies.
* Alleviate memory problems.
* Deal with some recursive vnode locks (sigh).
* Fix other bugs.
2000-02-14 22:00:21 +00:00
bouyer 425e99ac00 Check that we can handle the inode size before mounting the fs, and correct
a return value.
2000-01-31 11:34:55 +00:00
bouyer be4a409b30 Correct (minor) bogons in filetype option support, and add support
for sparse_super option
2000-01-28 16:00:23 +00:00
bouyer 5fb6bc4e18 First cut at ext2fs rev 1 support (as of mke2fs 1.18): supports the filetype
option read/write and the sparse option read-only.
2000-01-26 16:21:31 +00:00
thorpej 0b0aecffd6 Update for sys/buf.h/disksort_*() changes. 2000-01-21 23:43:10 +00:00
perseant dac789be22 Changes to stabilize LFS. The first two of these should also apply to the
1.4 branch.

* Use a separate per-fs lock, instead of ufs_hashlock, to protect the Inode
  free list.  This seems to prevent the "lockmgr: %d, not exclusive lock holder
  %d, unlocking" message I was mis-attributing last night to an unlocked vnode
  being passed to vrele.

* Change calling semantics of lfs_ifind, to give better error reporting:
  If fed a struct buf, it can report the block number of the offending inode
  block as well as the inode number.

* Back out rev 1.10 of lfs_subr.c, since the replacement code was slightly
  uglier while being functionally identical.

* Make lfs_vunref use the same free list convention as vrele/vput, so that
  vget does not remove vnodes from a hash list they are not on.
2000-01-19 00:03:04 +00:00
bouyer 3c680c00ab Handle pre-FS_42POSTBLFMT. I now can mount an Ultrix file system on my
sparc without panic.
2000-01-18 18:41:29 +00:00
perseant bfde45e89f Make sure that vnodes are locked when inactivated (e.g. by the cleaner) 2000-01-16 09:15:51 +00:00
perseant 86b0e2dc16 Fix a problem in my changes of Dec 14th, that prevents removed vnodes
from being inactivated under some conditions.  Removed vnodes are now
inactivated when the VDIROP flag is cleared, and to prevent block
accounting problems this clearing has been postponed until
lfs_segunlock.
2000-01-16 05:56:14 +00:00
perseant a38b519087 correct typo (reference uninitialized variable) 2000-01-16 04:57:08 +00:00