Commit Graph

1161 Commits

Author SHA1 Message Date
christos 6bd1d6d4db Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
2004-04-21 01:05:31 +00:00
yamt aa514117d5 check_dirty: plug a PHOLD leak. from Greg Oster. 2004-04-20 11:52:17 +00:00
dbj dec025329f remove code that attempts to correct superblock location. this
enforces an unnecessary restriction that the superblock be in the
particular expected locations.  Also, the compatibility case is
handled in ffs_oldfscompat_read.
2004-04-18 03:35:16 +00:00
dbj d7c33aeb1e when enabling ffs compatibility in ffs_reload, use
sblockloc that superblock was read from
also note XXX that ffs_reload doesn't handle superblock moving
2004-04-18 03:30:23 +00:00
oster 87d110abfa If we bail out due to an error, we need 'unreserve' the space that
we'd reserved earlier.

Approved by: yamt
2004-03-30 14:50:46 +00:00
dsl cd6c744984 Rework previous so that FS_FLAGS_UPDATED is only looked at for ffsv1 2004-03-27 12:40:46 +00:00
atatat 284a91c3ab Manually attach malloc types when being built as an lkm. 2004-03-27 04:43:43 +00:00
atatat 19af35fd0d Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.
2004-03-24 15:34:46 +00:00
bouyer 35decc6ed6 Fix disclaimer in my copyright. Pointed out by Thomas Klausner. 2004-03-22 19:23:08 +00:00
dsl 221ec38d03 Rework superblock validation logic to make adding validity tests easier.
Ensure that we don't use the first alternate superblock of a ffsv1
filesystem with 64k blocks (it is in the same place as an ffsv2 sb).
Fixes part of PR kern/24809
2004-03-21 18:48:24 +00:00
dsl 57f6eb7ead Change comments - one I wrote earlier wasn't right.
Add a couple of notes about areas of the superblock being reassigned
when ffsv2 was imported.
2004-03-20 17:26:16 +00:00
dsl 11f75824d0 Add a large comment about the balls-up caused by the ffsv2 superblock
not being at 8k - causes all sorts of problems, in particular with
ffsv1 filessytems with 64k blocks, and disks that are reformatted from
ffsv1 to ffsv2 (and v.v.).  see also PR kern/24809
2004-03-20 15:37:12 +00:00
yamt 3e796c5be5 reserve a MAXBSIZE-sized buffer for inodedeps for pagedaemon.
PR/24443.
2004-03-11 11:50:43 +00:00
yamt bfe5a94adc as we always replace whole buf in the case of indirdep,
simply changing b_data is enough.  eliminate M_INDIRDEP.

PR/24443.
2004-03-11 11:48:16 +00:00
dbj 8ad71c85f1 quiet tls. change botched superblock warning to use -b 16 2004-03-11 07:14:12 +00:00
keihan b220964103 s/netbsd.org/NetBSD.org/g 2004-03-10 09:56:59 +00:00
yamt 15c9d33810 calculate data checksum inline. 2004-03-09 07:43:49 +00:00
yamt 81ce5e8cc3 use correct segment size. this fixes memory corruption when using lfsv1. 2004-03-09 06:43:18 +00:00
yamt 25a0a3496e revert ufs_lookup.c rev.1.53 (MNT_ASYNC changes)
it was redundant because our bwrite() knows about MNT_ASYNC.

ok'ed by Jaromir Dolecek and Chuck Silvers.
2004-03-06 06:54:12 +00:00
uwe 20c14b226b Shut up gcc3 warning that `metalbn' might be used uninitialized.
XXX: The warning is bogus and only triggered on sh3.
2004-02-27 00:19:36 +00:00
oster 19eeec0a9c Add a missing:
pool_destroy(&lfs_dinode_pool);

to lfs_done().

Approved-by: yamt
2004-02-26 22:56:55 +00:00
yamt f9571060ef lfs_putpages: fix a simple_lock mismatch. 2004-02-26 22:41:36 +00:00
wiz 73e1501b98 parameter with two es. From Peter Postma. 2004-02-24 15:22:01 +00:00
jdolecek d06e4401fa make sblock_try[] const 2004-02-22 08:58:03 +00:00
yamt a57f9a6ca5 lfs_update_single: add an assertion. 2004-01-29 12:10:07 +00:00
he 11544aaa71 Let the cast to (long long) for using the result as a printf argument
apply to the whole expression, not just the first factor.
2004-01-28 20:57:15 +00:00
yamt 3e9d8d6772 use bufmem instead of bufpages to make lfs a little less broken. 2004-01-28 10:54:23 +00:00
yamt 09ec20ca66 eliminate tricky usages of VOP_STRATEGY which are (no longer?) necessary. 2004-01-28 10:53:12 +00:00
hannken d6170777cf Fix xxx_strategy() to use the vnode arg instead of bp->b_vp. 2004-01-26 10:39:29 +00:00
hannken 84b45bc333 Fix mfs_strategy() to use the vp argument.
From YAMAMOTO Takashi <yamt@netbsd.org>.
2004-01-26 10:02:31 +00:00
itojun c1675e235e avoid panic on monut_mfs. Greg Oster 2004-01-26 04:25:02 +00:00
hannken 3db4e2acd8 Make VOP_STRATEGY(bp) a real VOP as discussed on tech-kern.
VOP_STRATEGY(bp) is replaced by one of two new functions:

- VOP_STRATEGY(vp, bp)  Call the strategy routine of vp for bp.
- DEV_STRATEGY(bp)      Call the d_strategy routine of bp->b_dev for bp.

DEV_STRATEGY(bp) is used only for block-to-block device situations.
2004-01-25 18:06:48 +00:00
soren 3e41a33af7 With large average filesizes, it was possible to overflow dirsize to zero,
causing a division by zero in ffs_dirpref().

From Barry Bouwsma of Tiengen.
2004-01-13 13:38:18 +00:00
dbj 51134cc5dd change the updating note to say you may need fsck_ffs -b 32 -c 4' 2004-01-12 16:19:19 +00:00
dbj 6202d43b3b add checks for a couple of botched superblock upgrade cases
and report a warning with repair references.
2004-01-12 05:49:03 +00:00
hannken ed68c4e34c Allow vfs_write_suspend() to wait if the file system is already
suspending.

Move vfs_write_suspend() and vfs_write_resume() from kern/vfs_vnops.c
to kern/vfs_subr.c.

Change vnode write gating in ufs/ffs/ffs_softdep.c (from FreeBSD).

When vnodes are throttled in softdep_trackbufs() check for
file system suspension every 10 msecs to avoid a deadlock.
2004-01-10 17:16:38 +00:00
hannken 8308a4868d Split out softdep_flushworklist() from softdep_flushfiles() so that
it can be used to clear the work queue.

Cleanup ffs_sync() which did not synchronously wait when MNT_WAIT
was specified. Clear the work queue when MNT_WAIT is specified.

Result is a clean on-disk file system after ffs_sync(.., MNT_WAIT, ..)

From FreeBSD.
2004-01-10 16:23:36 +00:00
yamt 7266a95907 store a i/o priority hint in struct buf for buffer queue discipline. 2004-01-10 14:39:50 +00:00
dbj 01637061e3 never upgrade the superblock or set FS_FLAGS_UPDATED in fs_old_flags
add compatibility for filesystems created before FFSv2 integration
these patches are from pr port-macppc/23926 and should also fix
problems discussed in pr kern/21404 and pr kern/21283
2004-01-09 19:10:22 +00:00
dbj d7fdf500a8 reintroduce compatbility defines for
fs_headswitch, fs_trkseek, fs_csmask, fs_csshift
fs_postbl, fs_rotbl, cg_blktot, cg_blks, cbtocylno, cbtorpos
2004-01-03 19:18:17 +00:00
dbj ca5ad5d61f explicitly pad struct appleufslabel and use __attribute__((__packed__))
since apple put the 64 bit uuid field on a 4 byte boundary
2004-01-02 06:57:46 +00:00
dbj 23d4eb34b2 add uuid field to apple ufs volume label 2004-01-02 05:08:57 +00:00
dbj 65a136e22d remove incorrect XXX comments I introduced a couple of days ago 2003-12-31 19:33:13 +00:00
dbj ba5b25c952 remove unused cs_numclusters field from struct csum_total
this avoids a potential future bug if it is ever used.
before this fix, fsck_ffs would check and fix this field to be zero
2003-12-31 19:19:39 +00:00
dbj c0000df464 update explanatory comment about NOCSPTRS to reflect that fs_active
is now within that region.
no functional change
2003-12-31 18:53:45 +00:00
dbj 82a1a92247 reorder ffs_sb_swap to reflect actual order in superblock
add comments regarding historical field overlap
no functional change
2003-12-31 18:40:23 +00:00
dbj 4bdc4574c7 add fs_flags to ffs_sb_swap 2003-12-31 18:32:47 +00:00
pk 70f20a1217 Replace the traditional buffer memory management -- based on fixed per buffer
virtual memory reservation and a private pool of memory pages -- by a scheme
based on memory pools.

This allows better utilization of memory because buffers can now be allocated
with a granularity finer than the system's native page size (useful for
filesystems with e.g. 1k or 2k fragment sizes).  It also avoids fragmentation
of virtual to physical memory mappings (due to the former fixed virtual
address reservation) resulting in better utilization of MMU resources on some
platforms.  Finally, the scheme is more flexible by allowing run-time decisions
on the amount of memory to be used for buffers.

On the other hand, the effectiveness of the LRU queue for buffer recycling
may be somewhat reduced compared to the traditional method since, due to the
nature of the pool based memory allocation, the actual least recently used
buffer may release its memory to a pool different from the one needed by a
newly allocated buffer. However, this effect will kick in only if the
system is under memory pressure.
2003-12-30 12:33:13 +00:00
dbj dbba662bc8 fix bugs in ffs_cg_swap for FS_42POSTBLFMT 2003-12-30 03:30:43 +00:00
dbj cd998638bc use symbolic V_SAVE instead of value 1 when invoking vinvalbuf 2003-12-28 00:36:33 +00:00
simonb 740725d725 Fix usage of fifth argument to pool_init(). 2003-12-21 07:53:58 +00:00
yamt 009640868e set VBWAIT when waiting v_numoutput to be drained. 2003-12-17 10:38:39 +00:00
yamt ce11c3ce4e remove a redundant substitution. 2003-12-17 07:14:03 +00:00
yamt 6b95193071 - reduce code duplication.
- use boolean_t where appropriate.
2003-12-16 13:47:48 +00:00
yamt 98e9a8c373 g/c lfs_no_inactive. 2003-12-16 11:45:07 +00:00
atatat 13f8d2ce5f Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al.  Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded.  Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment.  I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 19:38:21 +00:00
yamt 3ea6756a92 use b_private rather than b_saveaddr.
XXX LFS_USE_B_INVAL
2003-12-04 14:57:47 +00:00
dbj d8b416001c clarify comments, especially since ffs_isfreeblock is non-intuitive:
ffs_isblock:
    check if a block is available
      returns true if all the correponding bits in the free map are 1
     returns false if any corresponding bit in the free map is 0
  ffs_isfreeblock:
    check if a block is completely allocated
      returns true if all the corresponding bits in the free map are 0
      returns false if any corresponding bit in the free map is 1
2003-12-02 04:40:43 +00:00
dbj f31a623a56 in ffs_unmount, ignore error returned by VOP_CLOSE(devvp)
this fixes a problem where device close error would cause
unmount to fail but structures to be left partially deallocated
2003-12-01 18:57:07 +00:00
mycroft c714b3b115 Remove part of previous -- there is NO reason for directory allocation to use
arc4random().
2003-11-27 04:52:55 +00:00
yamt 5b12f94dde use FINFOSIZE macro. 2003-11-25 15:14:57 +00:00
thorpej 857f24339f Kernel portion of the fsync_range(2) system call. Written by Bill
Studenmund, and contributed by Wasabi Systems, Inc.
2003-11-15 01:19:38 +00:00
jdolecek ac5e658022 fix uninitialized variable use in previous change (!) 2003-11-08 07:13:57 +00:00
dbj fe70f4f25f only let i_ffs_effnlink diverge from i_nlink if DOINGSOFTDEP 2003-11-08 06:38:10 +00:00
dbj 54309cb4b4 comment out unnecessary IN_CHANGE|IN_UPDATE in lookup
move softdep specific lock release/regrab inside if DOINGSOFTDEP
2003-11-08 06:36:13 +00:00
dbj 7bfaadbc7a always do a full fsync if vp->v_type != VREG
in partial fsync, only use PGO_SYNCIO if FSYNC_WAIT is specified
2003-11-08 06:00:39 +00:00
dbj 2f1fc21f9c fix minor memory leaks in error paths of ffs_mountfs 2003-11-08 05:35:11 +00:00
dbj 5040c1296f protect use of buf's b_flags with b_interlock 2003-11-08 04:39:00 +00:00
dbj 84865d5d4f protect a few uses of buf's b_flags with b_interlock 2003-11-08 04:22:35 +00:00
yamt cc716087b0 - tweak lfs_update_single()'s prototype so that it can be used by
roll-forward code.
- reduce code duplication using the above in update_meta()
  this also fixes fragment accounting.
2003-11-07 17:55:29 +00:00
yamt 71602f6ec9 fix spec vnode aliasing. 2003-11-07 14:52:27 +00:00
yamt b43ed49269 - tell filesize changes to vm when roll-forwarding data blocks.
- handle fragment extension better during roll-forward.
- related assertions.
2003-11-07 14:50:18 +00:00
yamt cd2445d8d3 more assertion about file truncation to zero. 2003-11-07 14:48:28 +00:00
hannken 2ef662a69e Clean up the usage of vn_start_write(). At least one occurence clobbered
previous error conditions.
If "(flags & (V_WAIT|V_PCATCH)) == V_WAIT" the return value is always zero.
Ignore the return value in these cases.

From Darrin B. Jewell.
2003-11-05 10:18:38 +00:00
simonb a2facef339 Remove some assigned-to but otherwise unused variables. 2003-10-30 01:43:08 +00:00
mycroft be505a4f82 Adjust to remove bogus initializer. 2003-10-29 01:25:04 +00:00
lukem 171d653219 Overhaul how `build.sh tools' are used:
*	Rename "config.h" to "nbtool_config.h" and
	HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
	This makes in more obvious in the source when we're using
	tools/compat/config.h versus "standard autoconf" config.h

    *	Consistently move the inclusion of nbtool_config.h to before
    	<sys/cdefs.h> so that the former can provide __RCSID() (et al),
    	and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
	#if HAVE_NBTOOL_CONFIG_H
	#include "nbtool_config.h"
	#endif
to the top of the source files (for the general case).
2003-10-27 00:12:41 +00:00
kleink cceefb77ec Remove the present incarnation of FSYNC_DATAONLY use from ffs_fsync() and
ffs_full_fsync(); while it is supposed to hint that the update of _file_
metadata (as in timestamps et al.) may be omitted it doesn't mean the
same for _filesystem_ metadata.
2003-10-25 19:52:21 +00:00
christos 372f57e757 Fix uninitialized variable warnings. 2003-10-25 18:26:46 +00:00
fvdl c6019338cd Correct preempt() calls. 2003-10-21 00:39:03 +00:00
yamt 4e9f921204 be more strict about sa->vp.
(make sure the last lfs_updatemata in lfs_putpages takes effect.)
2003-10-18 15:52:42 +00:00
simonb c25af55e8c Remove assigned-to but otherwise unused variable. 2003-10-18 04:03:22 +00:00
yamt 818ef92da6 add comments and tweak code a little for readability.
(no behaviour changes)
2003-10-17 14:20:12 +00:00
hannken a3a898ff0f Add the gating of system calls that cause modifications to the underlying
file system.
The function vfs_write_suspend stops all new write operations to a file
system, allows any file system modifying system calls already in progress
to complete, then sync's the file system to disk and returns. The
function vfs_write_resume allows the suspended write operations to
complete.

From FreeBSD with slight modifications.

Approved by: Frank van der Linden <fvdl@netbsd.org>
2003-10-15 11:28:59 +00:00
dbj fe7c786886 add mnt_iflag field to struct mount for internal flags
mv MNT_GONE, MNT_UNMOUNT and MNT_WANTRDWR to this field
additonally add mnt_writeopcountupper and mnt_writeopcountlower fields
in preparation for pending write suspension support work
bump kernel version to 1.6ZD
2003-10-14 14:02:56 +00:00
yamt 1fb76f9bad add a prototype of check_segsum(). 2003-10-14 13:51:51 +00:00
yamt d457c892fa when roll-forwarding, check segment serial numbers correctly. 2003-10-14 13:46:30 +00:00
yamt 73e762ca69 add a missing fsbtodb() to read a correct block for roll-forwarding. 2003-10-14 12:52:28 +00:00
yamt 1508246f38 remove a redundant definition of LFS_MAX_ACTIVE. 2003-10-14 12:51:31 +00:00
thorpej f7840303a1 Whitespace nits. 2003-10-13 17:07:55 +00:00
yamt dd4d591157 - a comment.
- bcopy -> memcpy
- increase 'p' only when needed.
2003-10-08 15:07:25 +00:00
bouyer 7b066791c8 Remove references to University of California from my copyright notices. 2003-10-05 17:48:49 +00:00
yamt 4ce4892712 assertions. 2003-10-03 15:35:54 +00:00
yamt 33feb8e686 reassignbuf() when lfs_writeseg() takes away B_DELWRI. 2003-10-03 15:35:03 +00:00
yamt 656ff745cf when inactivating segments, compare segment numbers correctly. 2003-10-03 13:02:54 +00:00
dbj 5c09d20130 Declare fs_old_flags and fs_flags as unsigned.
This fixes a bug introduced in revision 1.120 of ffs_vfsops dated 2003/09/13
which results in fs_flags having a value of 0x7fffff00 when a superblock
is updated to use the new layout.
Discussed in http://mail-index.netbsd.org/tech-kern/2003/09/28/0003.html
2003-09-29 20:34:23 +00:00
yamt 0dc0c83b61 remove redundant prototypes. 2003-09-29 15:12:08 +00:00
enami b50653d8aa In ffs_sbupdate(), swap the sblock after ffs_oldfscompat_write() is
applied rather than the original.
2003-09-25 23:39:17 +00:00
yamt 61d5d4362b fix a bug of lfs.
genfs_getpages() can read in more blocks than it should due to faked filesize
of lfs_gop_size().  it's a security problem and it makes gcc3 "internal error"

to fix this,
- in genfs_getpages(), always calculate diskeof and memeof separately
  so that filesystems (in this case, lfs) can use different strategies
  for them.
- introduce GOP_SIZE_MEM flag and use it to request in-core filesize.
  (it was an intention of GOP_SIZE_READ,
  but after the above change _READ is not a straightforward name)

after this, no one uses GOP_SIZE_{READ,WRITE} anymore but leave them for now.
2003-09-24 10:22:53 +00:00
yamt 67a5559821 cleanup IN_ADIROP/VDIROP handling a little. 2003-09-23 05:26:49 +00:00
yamt e2fbe9d54d remove unnecessary externs of lfs_do_flush. 2003-09-23 05:26:12 +00:00
jdolecek d07d321142 if mounted ASYNC, use delayed writes for metadata, which improves performance
of these operations significantly
based on FreeBSD ufs_lookup.c rev. 1.8, by John Dyson
2003-09-20 21:05:53 +00:00
yamt 17f9466183 some comments 2003-09-20 17:51:55 +00:00
enami 69615345e2 Fix a recently introduced bug which prevents csum totals being copied
when an old ffs filesytem is first mounted (as a result, df reports disk
full on old ffs filesystem or mfs created by old binary).  Problem first
noticed by onoe san.
2003-09-17 02:24:33 +00:00
yamt 7bd2f524bc indent. 2003-09-15 15:08:09 +00:00
bouyer ff7554f54c make sure to not get flags which are for internal use only from the on-disk
superblock.
Proposed in http://mail-index.netbsd.org/tech-kern/2003/09/06/0005.html
2003-09-13 14:09:15 +00:00
bouyer 5e33ea894e Commit changes proposed in
http://mail-index.netbsd.org/tech-kern/2003/09/06/0001.html
http://mail-index.netbsd.org/tech-kern/2003/09/06/0006.html
to avoid compat problems with old ffsv1 by reuse of the old FS_SWAPPED
value for FS_FLAGS_UPDATED, and use of new, larger fields:
- Don't use FS_FLAGS_UPDATED to see if we need to update new fields from
  old fields in ffsv1 case.
- when writing back the superblock, copy back the flags to the old location
  if only old flags are set (FS_FLAGS_UPDATED won't be set in this case)
  in ffsv1 case.
2003-09-13 13:47:04 +00:00
christos 136f9cd821 PR/15397: Jason Thorpe: directory operations on pathnames that refer to
directories and have trailing slashes should succeed. Ok'd by kjk.
Fix provided by enami.
2003-09-11 17:33:42 +00:00
yamt f80b24474d g/c CHECK_COPYIN. 2003-09-10 11:09:11 +00:00
yamt 753a6151b9 comments on lfs_issequential_hole. 2003-09-07 21:00:36 +00:00
yamt 4868f89aae buffer cache mp locks. 2003-09-07 11:55:43 +00:00
yamt d20e923a9c - raise spl to bio in lfs_countlocked() rather than having callers to do so.
- buffer cache MP locks.
- assert B_CALL buffers are not on the free queue.
2003-09-07 11:53:57 +00:00
yamt 4a78faea0f - buffer cache MP locks.
- avoid changing buffer state on the free queue.
2003-09-07 11:47:07 +00:00
yamt 3ed90e8152 use LFS_DEBUG_COUNTLOCKED macro. 2003-09-07 11:44:22 +00:00
itojun 761c22ff58 use arc4random instead of random (mask with INT32_MAX to avoid getting
negative numbers unexpectedly).
2003-09-05 21:58:35 +00:00
yamt 01e41ddfe3 don't call LFS_DEBUG_COUNTLOCKED after bread().
lfs_countlocked doesn't count buffers that isn't on the freelist.
2003-09-04 12:28:53 +00:00
dsl 92c5eba410 Split CGSIZE definition so it can be used with 64bit fpg values.
Split cg_start so magic can be done in libsa when it is known that the
filesystem isn't UFS2.
2003-08-21 14:41:00 +00:00
dsl 72fa43211e gcc for sparc seems to barf at 'int_var * 0x100000000ull' so do
'(uint64_t)(uint)int_var << 32' even though it generates twice as many
instructions on i386!
2003-08-16 07:04:17 +00:00
dsl 8d9878ecb4 Remove only (last?) use of SETHIGH and SETLOW before gcc starts warning
about the odd construct.  Also fixes kern/6525.
2003-08-10 09:54:06 +00:00
dsl 5638922967 Stop panic if 'mknod xxx b 0 0' done on a full filesystem.
panics in ffs_full_fsync because v_specmountpoint requires that the NULL
v_specinfo be followed.
Tidy up in the same order in all error paths so compiler can merge the
code sequences.

Fixes PR kern/22419
2003-08-09 19:02:53 +00:00
agc aad01611e7 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22364, verified by myself.
2003-08-07 16:26:28 +00:00
pk 918bf35fad Pass the inode flags to set as an argument to ufs_dirrewrite().
Use it to restore the behaviour of not updating the modified time of a
directory that moves to a new parent.
2003-08-05 15:45:48 +00:00
yamt bdbaf98d1e using normal bufcache buffer for cluster buffer head. 2003-07-30 13:36:40 +00:00
yamt 1bc98d3c14 - check EROFS earlier in lfs_markv.
- remove wrong error recovery code (fake buffers are never on bufqueue)
  and put a comment instead.
2003-07-30 12:38:53 +00:00
yamt 3bded40734 remove an unused definition of LFS_VREF_THRESHOLD. 2003-07-30 12:34:00 +00:00
yamt 4573bf3772 yield cpu in directory entry search loop in ufs_lookup().
this loop can take a bit long time with large buffer cache.
2003-07-23 13:56:53 +00:00
yamt bddddad951 KNF. 2003-07-23 13:53:51 +00:00
yamt d7aa0312b2 add parenthesis missed in rev.1.127. 2003-07-23 13:46:57 +00:00
yamt 9d61ee54c4 whitespace 2003-07-23 13:44:55 +00:00
yamt f4fc192872 add KASSERTs in lfs_issequential_hole. 2003-07-23 13:38:18 +00:00
yamt 3433c3992e cast UFS1 on-disk block pointers to int32_t before assign it to daddr_t.
it's needed for LFS because UNWRITTEN is a negative number.
2003-07-23 13:36:17 +00:00
yamt 2ba5ae7ea6 more MP locks. 2003-07-12 16:19:00 +00:00
yamt 12ad26b293 - wrap long lines.
- remove a mysterious blank line.
2003-07-12 16:17:52 +00:00
yamt 3852db2096 - protect global resource counts with lfs_subsys_lock.
- clean up scattered externs a little.
2003-07-12 16:17:06 +00:00
yamt 3f84a2d3a1 a comment. 2003-07-02 14:07:16 +00:00
yamt eb4e09d59f use queue.h macros. 2003-07-02 13:43:02 +00:00
yamt 82659031f4 use VFSTOUFS macro. 2003-07-02 13:41:38 +00:00
yamt 102c8a6a74 - add a new functions, lfs_writer_enter/leave, and use them instead of
duplicated code fragments.
- add an assertion.
2003-07-02 13:40:51 +00:00
yamt f3506a9599 drain dirops before aqcuiring seglock. otherwise it might deadlocks.
PR/20676 (Karl Knutsson)
2003-07-02 13:39:03 +00:00
fvdl d5aece61d6 Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
2003-06-29 22:28:00 +00:00
thorpej a06b275edc Undo part of the ktrace/lwp changes. In particular:
* Remove the "lwp *" argument that was added to vget().  Turns out
  that nothing actually used it!
* Remove the "lwp *" arguments that were added to VFS_ROOT(), VFS_VGET(),
  and VFS_FHTOVP(); all they did was pass it to vget() (which, as noted
  above, didn't use it).
* Remove all of the "lwp *" arguments to internal functions that were added
  just to appease the above.
2003-06-29 18:43:21 +00:00
enami bfbd2cd3ab Add forward declaration of struct lwp instead of struct proc. Sort those
while I'm here.
2003-06-29 05:43:56 +00:00
bouyer 75208caf18 Adapt for struct proc* -> struct lwp* changes. 2003-06-28 22:53:35 +00:00
darrenr 960df3c8d1 Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records.  The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
2003-06-28 14:20:43 +00:00
fvdl 67c9fa950a OS X still seems to use the old nrpos field in the superblock, and gets
unhappy after NetBSD wrote an Apple UFS filesystem. Just set it to 0
in this case.
2003-06-12 18:50:43 +00:00
fvdl d9f47e809c free the ext2fs dinode struct in ext2fs_reclaim. From Ted Unangst. 2003-05-26 21:22:19 +00:00
yamt ab2238cfad make is_sequential a callback in order to achieve better lfs write clustering.
since lfs always rewrite blocks into the new segment,
current on-disk place of the block doesn't affect to write clustering.

ok'ed by Konrad Schroder.
2003-05-18 12:59:05 +00:00
nakayama a6d8c9185d Avoid comparison is always false warning in gcc 3.3 w/ 64-bit size_t. 2003-05-17 01:44:39 +00:00
kristerw 07936511f0 The C language does not permit statements of the form
(X ? Y : Z) = 0;
even though gcc handles this by a stupid extension.

Transform these to correct C.

Approved by fvdl.
2003-05-15 20:25:31 +00:00
ragge 97fa6ef77b Add a missing ifdef DDB. 2003-05-07 18:49:29 +00:00
gmcgarry 835240b191 Print pid on error. From Greg A. Woods in PR#17393. 2003-05-04 01:52:18 +00:00
christos 7a96f65456 make sure we update fs_fsmnt. 2003-05-03 16:24:35 +00:00
perseant e18585deb2 Correct arguments to check_dirty, ensuring that all pages in a block are
written if any of them are dirty.  Pointed out by yamt.
2003-05-02 01:47:39 +00:00
perseant 100c8f971f Restrict the run of cluster blocks to on-disk contiguous blocks (back out
part of rev 1.115), to avoid writing over holes.  This is the lesser of two
evils, to be replaced soon.
2003-04-29 17:45:11 +00:00
yamt 3f3b3242de constify 'mastertemplate'. 2003-04-29 07:45:23 +00:00
yamt 982fbc7db4 add an assertion. 2003-04-29 07:44:04 +00:00
yamt b4d5e11ffe fix a comment. 2003-04-27 06:47:45 +00:00
yamt c2b802ff24 fix b_interlock lock/unlock mismatches. 2003-04-27 06:46:38 +00:00
perseant b691ba8a71 Don't change update time on block write; lets e.g. "tar xp" work properly. 2003-04-27 04:18:29 +00:00
fvdl 94e92b1bb3 Assign the right linkcount when renaming a directory. 2003-04-25 23:12:33 +00:00
gmcgarry 0645f99b01 More ufs2 merge fall-out. Pass the correct pointer to the dinode
for clearing.  Fixes PR#21241.
2003-04-24 08:05:35 +00:00
perseant ef3c60764c Make LFS work better (though still not "well") as an NFS-exported
filesystem (and other things that needed to be fixed before the tests
would complete), to wit:

* Include the fs ident in the filehandle; improve stale filehandle checks.

* Change definition of blksize() to use the on-dinode size instead of
  the inode's i_size, so that fsck_lfs will work properly again.

* Use b_interlock in lfs_vtruncbuf.

* Postpone dirop reclamation until after the seglock has been released,
  so that lfs_truncate is not called with the segment lock held.

* Don't loop in lfs_fsync(), just write everything and wait.

* Be more careful about the interlock/uobjlock in lfs_putpages: when we
  lose this lock, we have to resynchronize dirtiness of pages in each
  block.

* Be sure to always write indirect blocks and update metadata in
  lfs_putpages; fixes a bug that caused blocks to be accounted to the
  wrong segment.
2003-04-23 07:20:37 +00:00
tls 85c8cfb533 Correct use of MAXBSIZE where MAXPHYS was intended. This is a necessary
first step towards per-device MAXPHYS, and has the beneficial side effect
of allowing clustering to MAXPHYS even on systems that need to run with
a reduced MAXBSIZE to get more metadata buffers.
2003-04-23 00:55:17 +00:00
christos d864ba0136 fix lkm malloc lossage. 2003-04-22 17:14:12 +00:00
christos db7b52084a choose the smaller size of the two strings when memcpy'ing them. A better
fix would be to strncpy and null terminate? From enami.
2003-04-22 13:18:52 +00:00
christos a94b10edf1 PR/2996: Greg Oster: Fix comment to match reality. Names are padded to
four bytes, but the bytes are not null.
2003-04-19 22:02:39 +00:00
fvdl 0545901d27 configdirs was changed to an array of u_int8_t, so don't compare values
to 65535.
2003-04-17 09:32:43 +00:00
christos 80ecd573c0 PR/1796: John Kohl: statfs misbehaves under chrooted environments.
- Under chroot it displays only the visible filesystems with appropriate paths.
- The statfs f_mntonname gets adjusted to contain the real path from root.
- While was there, fixed a bug in ext2fs, locking problems with vfs_getfsstat(),
  and factored out some of the vfsop statfs() code to copy_statfs_info(). This
  fixes the problem where some filesystems forgot to set fsid.
- Made coda look more like a normal fs.
2003-04-16 21:44:18 +00:00
yamt aa51f25824 ufs_rwXX: cast to unsigned even without FFS_EI to avoid
possible nasty signed vs unsigned problems.
2003-04-16 14:27:03 +00:00
yamt 1963d34b78 use bswap32 and bswap64 correctly.
(fs_pendingblocks and fs_pendinginodes)
2003-04-16 14:20:25 +00:00
fvdl d0152b0231 ffs_reclaim may be called while the dinode pointer in the inode structure
is still NULL (in the case of an error in ffs_vget). Check for this
condition before doing a pool_put.
2003-04-16 07:38:25 +00:00
fvdl ba400f9233 Don't cache buffers used when finding the superblock, it can lead to
seeing bogus data for the first cg with certain block/frag sizes.
From enami tsugutomo.
2003-04-12 10:35:58 +00:00
fvdl 9e0b0abaa7 Use variables for some cg accesses; makes things more readable and more
similar to FreeBSD. No functional change.
2003-04-12 10:33:17 +00:00
fvdl 4cdcaab92d Remove diagnostic ufs_vinit check, this isn't quite the right place for it;
it'll be reinstated elsewhere.
2003-04-11 14:13:28 +00:00
fvdl 64f0bf8882 Adjust diagnostic check for bad mode field; only the VNON case should
matter. From Enami.
2003-04-11 10:36:33 +00:00
enami b0715b0b82 Make ffs_cg_swap() works even if same chunk is passed as new and old cg.
This is necessary to prevent newfs from dumping core when it is asked to
create a UFS1 file system of non-native endian.
2003-04-11 10:20:35 +00:00
fvdl bf82cd91c6 Add diagnostic check to ufs_vinit in order to catch bad mode fields in
inodes early.
2003-04-10 20:22:04 +00:00
fvdl 63ab1add00 Initialize the 'mirror' i_flags fiels in struct inode to 0. 2003-04-10 20:03:40 +00:00
fvdl 2758e6ad60 Remove some leftover diagnostic checks. 2003-04-10 20:02:36 +00:00
simonb 761de7345c '#if 0' out a variable that is currently only used in other '#if 0'd out
code.
2003-04-10 04:15:38 +00:00
thorpej 24a4b8faa6 Use PAGE_SIZE rather than NBPG. 2003-04-09 00:28:28 +00:00
fvdl 85d5aca005 Actually get an ext2fs_dinode structure from the pool before using it. 2003-04-05 14:01:56 +00:00
fvdl 4f33a6f2e1 * Use the old and new time fields in the superblock as well as a few others
to determine if this filesystem was mounted by an older kernel after
  having been mounted by a newer one, to avoid some summary mismatches.
* Reinstate support for 4.2 cylinder groups (read-only, as it was before).
2003-04-05 13:37:36 +00:00
he f8cf57f9b0 Remember to prefix the manually-swapped FS magic numbers with 0x. 2003-04-05 11:12:42 +00:00
drochner 42b749318f adapt to struct inode change (in UVMHIST code) 2003-04-04 13:39:58 +00:00
fvdl 7847218fc1 FreeBSD revision 1.135:
When removing the last item from a non-empty worklist, the worklist
tail pointer must be updated.
2003-04-03 19:28:07 +00:00
fvdl 7d31e8f0d9 Avoid truncation of values in some macros that shift 64 bit values.
From FreeBSD.
2003-04-03 16:07:09 +00:00
he a1cf02e789 In the inode, i_din.e2fs_din is now a pointer, so there is no longer
a need to take the address here.
2003-04-02 22:38:22 +00:00
fvdl 42614ed3f3 Add support for UFS2. UFS2 is an enhanced FFS, adding support for
64 bit block pointers, extended attribute storage, and a few
other things.

This commit does not yet include the code to manipulate the extended
storage (for e.g. ACLs), this will be done later.

Originally written by Kirk McKusick and Network Associates Laboratories for
FreeBSD.
2003-04-02 10:39:19 +00:00
yamt 0296b9ddb2 add assertions and a debug check. 2003-04-01 14:58:43 +00:00
yamt 418bd96252 lfs_strategy is used only for read. 2003-04-01 14:31:50 +00:00
fvdl e80c0648b1 The modified flag must be cleared before the last sbupdate call in
unmount, because ffs_flushfiles or softdep_flushfiles may have
modified the filesystem (despite VFS_SYNC having been called first).
2003-03-31 21:02:12 +00:00
fvdl 691b2fa7db The checkpoint loop always used (multiples of) lfs_sepb as the number
of segments to mark. However, this may be much more than lfs_nseg.

Originally this wasn't a big problem, since only the structures in the
diskblock were changed, but nowadays there's a mirror of the segflags
in the in-core superblock. This problem caused the code to walk
way past the end of that allocated area, causing memory corruption
in other kernel structures. So, use lfs_nseg as the maximum, as it should be.

While here, simplify the loop; it had become an obfuscated piece of
code overtime.
2003-03-28 22:39:42 +00:00
perseant 3f7016035a Add a sleeper count, to prevent the cleaner from panicing the kernel
when the filesystem is unmounted, relocking the Ifile when its lock is
draining.  (We can't use vfs_busy() since the process is sleeping for a
good long time.)  Clean up / organize lfs.h, while I'm here.

In lfs_update_single, assert that disk addresses are either negative, or
are still positive when converted to int32_t, to prevent recurrence of a
negative/positive block problem.
2003-03-28 08:03:38 +00:00
perseant 17bba97d2e Unlock ifile inode during streamlined VOP_INACTIVE. 2003-03-22 21:31:41 +00:00
dsl bd99e3429d Use 'void *' instead of 'caddr_t' in prototypes of VOP_IOCTL, VOP_FCNTL
and VOP_ADVLOCK, delete casts from callers (and some to copyin/out).
2003-03-21 23:11:19 +00:00
fvdl 543510a84d LFS likes to store negative values in the dinode block pointers, so
make sure to cast the value back to int32_t after it was changed
by ufs_rw32, before passing it to blkptrtodb.
2003-03-21 15:46:32 +00:00
perseant 78dff1cfa3 KNF (space after keywords). 2003-03-21 06:26:36 +00:00
perseant a37f4cf7ec Use VONWORKLST as a heuristic for vnode emptiness, rather than exhaustively
checking the memq.

Take greater care not to dirty the Ifile vnode when unmounting the filesystem.
This should fix a "(vp->v_flag & VONWORKLST) == 0" assertion panic in vgonel
that could occur when unmounting.

Do not allow the Ifile to be mapped for writing.
2003-03-21 06:16:53 +00:00
yamt e8d83a0b17 make this compilable with DIAGNOSTIC and without DEBUG.
fix PR 20827 from FUKAUMI Naoki.
2003-03-21 06:09:08 +00:00