Commit Graph

1161 Commits

Author SHA1 Message Date
dbj c45b4268dc remove diagnostic check for modified inactive inodes in ufs_reclaim
this condition can occur if ufs_inactive experiences failure attempting
to write the inode out.  Instead, have ufs_reclaim always call VOP_UPDATE
which will only write out the inode if there are unflushed changes
2004-10-08 18:43:50 +00:00
thorpej 11afd11faa Add a new VNODE_LOCKDEBUG option, which enables checks in the VOP_*()
calls to ensure that the vnode lock state is as expected when the VOP
call is made.  Modify vnode_if.src to set the expected state according
to the documenting lock table for each VOP.  Modify vnode_if.sh to emit
the checks.

Notes:
- The checks are only performed if the vnode has the VLOCKSWORK bit
  set.  Some file systems (e.g. specfs) don't even bother with vnode
  locks, so of course the checks will fail.
- We can't actually run with VNODE_LOCKDEBUG because there are so many
  vnode locking problems, not the least of which is the "use SHARED for
  VOP_READ()" issue, which screws things up for the entire call chain.

Inspired by similar changes in OpenBSD, but implemented differently.
2004-09-21 03:10:35 +00:00
yamt cc047d3821 um_maxfilesize should be set after
ffs_oldfscompat_read adjusted fs_maxfilesize.
2004-09-19 11:58:29 +00:00
yamt 22399b45d0 change some members of struct buf from long to int.
ride on 2.0H.
2004-09-18 16:40:11 +00:00
skrll f7155e40f6 There's no need to pass a proc value when using UIO_SYSSPACE with
vn_rdwr(9) and uiomove(9).

OK'd by Jason Thorpe
2004-09-17 14:11:20 +00:00
yamt 6f3db818ea ufs_getlbns:
- fix an integer overflow when calculating lbns of indirect blocks.
- remove a redundant calculation of blockcnt.
2004-09-15 09:52:49 +00:00
yamt 77641b98f3 g/c no longer used definition of fs_maxfilesize. 2004-09-10 09:36:05 +00:00
hannken 5816dad45e While creating a snapshot inodes must be freed from the
snapshot, not from the file system.
ffs_freefile() needs explicit "fs" and "devvp" arguments.
2004-08-29 10:13:48 +00:00
mycroft 2070a0c580 Make sure to set IMNT_DTYPE here... 2004-08-16 12:49:55 +00:00
mycroft 84b11bd3be Another piece of FFS_EI flotsam. 2004-08-15 21:53:03 +00:00
mycroft 0d7e3746eb Repair some FFS_EI code for ufsmount changes. 2004-08-15 21:34:14 +00:00
mycroft bb17450999 Don't write out the extra zero pages with PGO_SYNCIO. We start an asynchronous
write anyway, and they will not be freed until that write is finished.
2004-08-15 19:01:16 +00:00
mycroft 4303882b7e Copy the current partial-truncate logic from FFS. In the process, fix a
potential overrun when truncating a fragment.
2004-08-15 17:37:07 +00:00
mycroft a97f7bfcbd Correct the fix for the partial-truncate inefficiency. We still need to zero,
but we only need to sync those pages that are being lopped off, if any.
2004-08-15 17:36:00 +00:00
mycroft f94beb30d4 Fix some formatting glitches. 2004-08-15 16:46:18 +00:00
mycroft f3fbefe76a Minor simplification to some arithmetic. 2004-08-15 16:17:37 +00:00
mycroft 14f6fc2dfb Need to set um_dirblksiz here... 2004-08-15 16:07:08 +00:00
mycroft 45a21b76f0 Fixing age old cruft:
* Rather than using mnt_maxsymlinklen to indicate that a file systems returns
  d_type fields(!), add a new internal flag, IMNT_DTYPE.

Add 3 new elements to ufsmount:
* um_maxsymlinklen, replaces mnt_maxsymlinklen (which never should have existed
  in the first place).
* um_dirblksiz, which tracks the current directory block size, eliminating the
  FS-specific checks littered throughout the code.  This may be used later to
  make the block size variable.
* um_maxfilesize, which is the maximum file size, possibly adjusted lower due
  to implementation issues.

Sync some bug fixes from FFS into ext2fs, particularly:
* ffs_lookup.c 1.21, 1.28, 1.33, 1.48
* ffs_inode.c 1.43, 1.44, 1.45, 1.66, 1.67
* ffs_vnops.c 1.84, 1.85, 1.86

Clean up some crappy pointer frobnication.
2004-08-15 07:19:54 +00:00
mycroft c09a793e93 Push atime/mtime updates even further -- into the reclaim path, so they happen
rarely in the normal case.  (Note: This happens at reboot/shutdown time because
all file systems are unmounted.)

Also, for IN_MODIFY, use IN_ACCESSED, not IN_MODIFIED; otherwise "ls -l" of
your device node or FIFO would cause the time stamps to get written too
quickly.
2004-08-14 14:32:04 +00:00
mycroft 5d31d187f3 Partially fix a performance problem in the partial-truncate case. We were
doing synchronous writes unnecessarily in a couple of places.  Now it's 1
write per truncate in my test case rather than 3.  :-P
2004-08-14 02:26:57 +00:00
mycroft 14ae52970e There is no need to do a synchronous write when truncating a short symlink. 2004-08-14 01:32:02 +00:00
mycroft 9f8efecd46 In the indirect block unwind case, we only need to do the synchronous writes
of the inode in the softdep case.  XXX This is really a deficiency in softdep.
2004-08-14 01:30:56 +00:00
mycroft bc25b30608 Add a new flag, IN_MODIFY. This is like IN_UPDATE|IN_CHANGE, but unlike
setting those flags, it does not cause the inode to be written in the periodic
sync.  This is used for writes to special files (devices and named pipes) and
FIFOs.

Do not preemptively sync updates to access times and modification times.  They
are now updated in the inode only opportunistically, or when the file or device
is closed.  (Really, it should be delayed beyond close, but this is enough to
help substantially with device nodes.)

And the most amusing part:
Trickle sync was broken on both FFS and ext2fs, in different ways.  In FFS, the
periodic call to VFS_SYNC(MNT_LAZY) was still causing all file data to be
synced.  In ext2fs, it was causing the metadata to *not* be synced.  We now
only call VOP_UPDATE() on the node if we're doing MNT_LAZY.  I've confirmed
that we do in fact trickle correctly now.
2004-08-14 01:08:02 +00:00
dbj cf1784812c remove incorrect casts that limit some uses of daddr_t to 31 bits
this fixes problems using ffs2 with more than 2^31 sectors (~1tb)
2004-07-24 15:02:32 +00:00
pk a7c40722d8 Call inittodr() from main(). Let file system code set the recorded `last
update' time (if any) through the new function setrootfstime().
2004-07-05 07:28:45 +00:00
hannken 8b477ad955 When we expunge an unreferenced file from a snapshot its size may be zero. 2004-06-30 18:42:17 +00:00
hannken 7a5be5a9ff - Add flag L_COWINPROGRESS to struct lwp to avoid recursion when
doing copy-on-write.

- Change VFS_SNAPSHOT() to return the snapshot vnode locked.

- Make the IO path for copy-on-write and snapshot-read more lightweight.
  Avoids deadlocks where vn_rdwr(...READ...) has a shared lock and needs
  to copy-on-write.
  Avoids deadlocks/panics where to clean pages the copy-on-write needs
  to allocate pages for its VOP_PUTPAGES().

L_COWINPROGRESS part approved by: Jason R. Thorpe <thorpej@netbsd.org>
2004-06-20 18:55:58 +00:00
hannken 2c825e5573 Use a pool for struct direct instead of kernel stack.
Reduces the kernel stack usage by 264 bytes.

Approved by: Jason R. Thorpe <thorpej@netbsd.org>
2004-06-20 18:25:49 +00:00
hannken 78a89b12b6 Use one daddr_t XXXblks[NDADDR + NIADDR] instead of two.
No functional changes. Reduces kernel stack usage by 120 bytes.

Approved by: Jason R. Thorpe <thorpej@netbsd.org>
2004-06-20 18:23:30 +00:00
he 94319b09bc Need to forward-declare "struct timespec" because the new ffs_snapshot()
function declaration refers to it.  Fixes build problem of sbin/badsect
for the vax target, which still uses gcc 2.95.3.
2004-06-04 07:43:56 +00:00
hannken 7b03a4b40c Once all block address modifications are done invalidate and
free all pages from the snapshot vnode.
2004-05-31 13:28:53 +00:00
yamt 2209153ea4 lfs_gop_write: assert that ifile never come here. 2004-05-30 20:45:44 +00:00
hannken 55db9c1eb7 Fixup last commit. fs->fs_active must be initialized. 2004-05-27 17:04:52 +00:00
hannken 712c432a06 Don't use VTOI(vp)->i_flags to test for snapshot devices. Will not work
for non-UFS file systems. Test for VBLK vnode instead.
2004-05-26 20:33:10 +00:00
hannken d63a5c8e01 Make it compile without option FFS_EI. 2004-05-26 11:17:39 +00:00
hannken 8c21bc6224 Add ffs internal snapshots. Written by Marshall Kirk McKusick for FreeBSD.
- Not enabled by default. Needs kernel option FFS_SNAPSHOT.
- Change parameters of ffs_blkfree.
- Let the copy-on-write functions return an error so spec_strategy
    may fail if the copy-on-write fails.
- Change genfs_*lock*() to use vp->v_vnlock instead of &vp->v_lock.
- Add flag B_METAONLY to VOP_BALLOC to return indirect block buffer.
- Add a function ffs_checkfreefile needed for snapshot creation.
- Add special handling of snapshot files:
    Snapshots may not be opened for writing and the attributes are read-only.
    Use the mtime as the time this snapshot was taken.
    Deny mtime updates for snapshot files.
- Add function transferlockers to transfer any waiting processes from
  one lock to another.
- Add vfsop VFS_SNAPSHOT to take a snapshot and make it accessible through
  a vnode.
- Add snapshot support to ls, fsck_ffs and dump.

Welcome to 2.0F.

Approved by: Jason R. Thorpe <thorpej@netbsd.org>
2004-05-25 14:54:55 +00:00
atatat 53c625655c Sysctl descriptions under vfs subtree 2004-05-25 04:44:43 +00:00
kleink 25709a1d3a POSIX: Permit a process without the appropriate privilege to change a
file's group ID to its effective gid, in addition to the presently
permitted set of supplementary gids.

From Mark Davies in PR standards/25401.
2004-05-22 23:24:23 +00:00
atatat 10a7ba9ef6 Tweak sysctl setup functions (the macros, actually) for use in lkms,
and tweak lkminit_*.c (where applicable) to call them, and to call
sysctl_teardown() when being unloaded.

This consists of (1) making setup functions not be static when being
compiled as lkms (change to sys/sysctl.h), (2) making prototypes
visible for the various setup functions in header files (changes to
various header files), and (3) making simple "load" and "unload"
functions in the actual lkminit stuff.

linux_sysctl.c also needs its root exposed (ie, made not static) for
this (when built as an lkm).
2004-05-20 06:34:24 +00:00
atatat 1d3a6a329e Explicitly call pool_init() (and pool_destroy()) when being built as
an _LKM.

This adds pools to the list of things that lkms must do manually
because they're set up with link sets.  Not that there's anything
wrong with link sets, but that we need to try harder to remember that
lkms are second class citizens.  Of a sort.
2004-05-20 05:39:34 +00:00
yamt 58912348a7 lfs_cluster_aiodone: turn an invariant condition into an assertion. 2004-05-19 11:29:32 +00:00
wiz 8cd26a6026 Fix typo in error message, reported by Piotr Meyer in PR 25418. 2004-05-02 06:59:20 +00:00
jrf fc97fd571a First pass for some caddr_t removal and changes to get rid of it where we
no longer use and/or need it

	- removed casts from unionfs, deadfs and fdesc
	  (there are more to hunt down still)
	- changed vfs_quotactl args argumet from caddr_t to void *
	- changed vfs_quotactl structures/callers to reflect the api change

Compiled fine and ran for about a day. Approved/reviewed by
christos@netbsd.org and gimpy@netbsd.org.
2004-04-27 17:37:30 +00:00
simonb b09560304e Unwrap a not-too-long line. 2004-04-26 01:40:40 +00:00
dbj 9a0dfd8c28 remove botched superblock upgrade warnings.
there are now alternate non-kernel checks and fixes for this problem.
relevent prs include:
bin/17910 kern/21283 kern/21404 port-macppc/23925 port-macppc/23926
install/25138
2004-04-25 21:02:26 +00:00
simonb b5d0e6bf06 Initialise (most) pools from a link set instead of explicit calls
to pool_init.  Untouched pools are ones that either in arch-specific
code, or aren't initialiased during initial system startup.

 Convert struct session, ucred and lockf to pools.
2004-04-25 16:42:40 +00:00
yamt 54b5826d2c lfs_statvfs: report f_frsize correctly. 2004-04-22 10:45:56 +00:00
yamt 2b17bf3d63 check_dirty: fix another PHOLD leak. ("goto top" path) 2004-04-22 10:45:00 +00:00
christos 0b9201b140 similar fix to enami's in the fstypename field. Not really needed, but better
safe than sorry.
2004-04-21 12:00:36 +00:00
enami d92f7ed982 Don't copy past the end of destination array boundary; the size of source
array changed due to recent statvfs change.
2004-04-21 07:58:02 +00:00
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