Commit Graph

1495 Commits

Author SHA1 Message Date
hannken d556dc98b0 Fscow_run(): add a flag "bool data_valid" to note still valid data.
Buffers run through copy-on-write are marked B_COWDONE.  This condition
is valid until the buffer has run through bwrite() and gets cleared from
biodone().

Welcome to 4.99.39.

Reviewed by: YAMAMOTO Takashi <yamt@netbsd.org>
2007-12-02 13:56:15 +00:00
tsutsui 581d311161 Use e2fs_first_dblock in superblock to read/write group descriptor blocks. 2007-12-01 16:57:26 +00:00
pooka 61e8303e9d Remove the "struct lwp *" argument from all VFS and VOP interfaces.
The general trend is to remove it from all kernel interfaces and
this is a start.  In case the calling lwp is desired, curlwp should
be used.

quick consensus on tech-kern
2007-11-26 19:01:26 +00:00
tsutsui e2199739d6 Misc cosmetics. 2007-11-26 15:46:48 +00:00
tsutsui da1f43d88f Account e2fs_reserved_ngdb blocks accordingly in ext2fs_statvfs(). 2007-11-26 15:41:03 +00:00
dholland 9c31b45f5e Change the fs_clean member of the ffs superblock to be unsigned
(uint8_t instead of int8_t) - this prevents an ugly sign-extension
printing bug as well as formally undefined behavior when you mount an
unclean fs enough times.

From (my own) PR kern/28134; I've been carrying this patch for three
years, long enough to forget about it, and it's had no ill effects in
that time.

reviewed: pooka
2007-11-23 18:00:46 +00:00
pooka 2b2c7bcc21 Update comments: ufs_{rename,mkdir,rmdir} haven't been system calls
since 4.3BSD.
2007-11-23 14:18:01 +00:00
yamt a3dbd70683 lfs_mountroot: use vfs_destroy. 2007-11-22 10:51:44 +00:00
tsutsui d1112c275c Misc cosmetics. 2007-11-17 08:51:51 +00:00
tsutsui b95d1c0be7 Some KNF and cosmetics. 2007-11-17 08:34:38 +00:00
tsutsui bf39da4423 Also bswap recently added e2fs_reserved_ngdb in e2fs_sb_bswap(). 2007-11-17 03:43:18 +00:00
tsutsui 0192f3ddfc Add some definitions for resizefs features. 2007-11-15 12:59:17 +00:00
tsutsui bed6c72507 - add some more constant definitions
- add some comments
- typo and some cosmetics
2007-11-13 13:50:18 +00:00
rmind f499d5e662 Use PRI_BIO for kthreads instead of PINOD. Fixes a missed case of priority
inversion, which caused LFS to fire some assertions.

Reported by Kurt Schreiner on <current-users>.
2007-11-10 18:53:57 +00:00
ad d18c6ca4de Merge from vmlocking:
- pool_cache changes.
- Debugger/procfs locking fixes.
- Other minor changes.
2007-11-07 00:23:13 +00:00
hannken 75bdfc0dac Avoid doing bawrite to initialize inode block while holding cylinder
group block buffer busy.  If filesystem has any active snapshots, bawrite
can come back trying to allocate new snapshot data block from the same
cylinder group and cause deadlock.

From FreeBSD Rev. 1.117
2007-11-01 06:31:59 +00:00
hannken df70316e3f Ffs_blkfree() and ffs_freefile() take a devvp that may be a regular file whencalled from snapshot creation. Be sure to use the right mount.
Ok: Andrew Doran <ad@netbsd.org>
2007-10-18 17:39:04 +00:00
ad fd7e1bf0d1 Sync with ffs: fix ufs_ihashlock / ufs_hash_lock deadlock.
From Sverre Froyen.
2007-10-17 17:34:25 +00:00
ad 4c92a21547 Remove LOCK_ASSERT(!simple_lock_held(&foo)); 2007-10-11 19:53:37 +00:00
ad f103d731ed Fix DEBUG builds. 2007-10-10 22:38:00 +00:00
ad 7dad9f7391 Merge from vmlocking:
- Split vnode::v_flag into three fields, depending on field locking.
- simple_lock -> kmutex in a few places.
- Fix some simple locking problems.
2007-10-10 20:42:20 +00:00
ad 5c3b2b3f2d Merge ffs locking & brelse changes from the vmlocking branch. 2007-10-08 18:01:27 +00:00
hannken 3856acafe2 Update the file system copy-on-write handler.
- Instead of hooking the handler on the specdev of a mounted file system
  hook directly on the `struct mount'.

- Rename from `vn_cow_*' to `fscow_*' and move to `kern/vfs_trans.c'.  Use
  `mount_*specific' instead of clobbering `struct mount' or `struct specinfo'.

- Replace the hand-made reader/writer lock with a krwlock.

- Keep `vn_cow_*' functions and mark as obsolete.

- Welcome to NetBSD 4.99.32 - `struct specinfo' changed size.

Reviewed by: Jason Thorpe <thorpej@netbsd.org>
2007-10-07 13:38:53 +00:00
pooka 1b732f2a39 avoid variable size stack allocations 2007-09-25 15:13:14 +00:00
pooka a51616225d BLKSIZE is always the same as blksize these days, so get rid of it. 2007-09-24 16:50:58 +00:00
pooka 094e51ae36 Fix comment inaccurate from prehistoric times: default MINFREE is 5, not 10 2007-09-24 16:20:50 +00:00
rumble 0ae0a486c7 Avoid stack allocation of large dirent structures in foo_readdir(). 2007-09-24 00:42:12 +00:00
pooka b2c6279cb7 include sys/mount.h for export_args30 2007-09-10 23:47:23 +00:00
pooka 3f3cac88a3 Make bioops a pointer and point it to the softdeps struct in softdep
init.  Decouples "options SOFTDEP" from the main kernel and ffs code.
2007-09-01 23:40:21 +00:00
hannken 5657bcacb9 Modify ffs_lock() to take care for changed v_vnlock. Snapshots do not need
transferlockers() anymore.

From FreeBSD ffs_vnops.c Rev. 1.159

Reviewed by: YAMAMOTO Takashi <yamt@netbsd.org>
2007-08-21 09:27:33 +00:00
hannken f43278a84f - Use a mutex to protect snapinfo.
- Move the snapshot lock to snapinfo.
- ffs_snapblkfree(),ffs_copyonwrite(): replace lockmgr() with VOP_LOCK().
2007-08-18 10:11:01 +00:00
hannken 7d3c830b7c Expunge traces of unlinked snapshot files when making a new snapshot.
From FreeBSD Rev. 1.123
2007-08-18 09:48:33 +00:00
hannken d56e8d1456 Move the fstrans-aware lock vnops from ufs to ffs. Other ufs file systems
do not need them.

Ride on 4.99.28
2007-08-09 09:22:34 +00:00
pooka 3de9f5d391 Instead of having lfs muck directly about with vnode free lists,
introduce vrele2(), which allows to release vnodes the way lfs
sometimes wants it:
  + without calling inactive
  + inserting the vnode at the head of the freelist (this is a very
    questionable optimization that isn't even enabled by default,
    but I went along with the same semantics for now)
2007-08-09 08:51:21 +00:00
hannken 70cc392f1e Move snapshot per-mount data from struct ufsmount to mount specific data.
No functional changes.

Welcome to 4.99.28  (struct ufsmount changed size)
2007-08-09 07:34:27 +00:00
pooka 95bedce095 include assumed headers 2007-08-02 12:53:30 +00:00
pooka 8d1f899239 * nuke the nameidata parameter from VFS_MOUNT(). Nobody on tech-kern
knew what it was supposed to be used for and wrstuden gave a go-ahead
* while rototilling, convert file systems which went easily to
  use VFS_PROTOS() instead of manually prototyping the methods
2007-07-31 21:14:15 +00:00
hannken a508ec1750 - Replace the freelist with a pool. Current code never freed its dquot's.
- Always call dqsync() with dq locked.
- Add some assertions to verify the lock held.
- Serialize quotaon()/quotaoff(), dqhashmtx becomes dqlock.  From ad@

Reviewed by: Andrew Doran <ad@netbsd.org>
2007-07-31 09:29:52 +00:00
ad a0d1fd8d0c It's not a good idea for device drivers to modify b_flags, as they don't
need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.
2007-07-29 13:31:07 +00:00
yamt 662e7a9e40 use ubc_uiomove for read as well. 2007-07-27 10:00:42 +00:00
yamt 3822af7031 ubc_uiomove: add an "advice" argument rather than using UVM_ADV_RANDOM blindly. 2007-07-27 09:50:36 +00:00
pooka 1ce406a846 Change unused fflags parameter in VOP_MMAP to prot and pass in
desired vm protection.
2007-07-27 08:26:38 +00:00
pooka d9970c8066 Use eopnotsupp() instead of vfs_stdsuspendctl() and retire the latter. 2007-07-26 22:57:36 +00:00
pooka 2189caca89 comment police: DIRBLKSIZE would be too chatty and therefore the
macro is known as DIRBLKSIZ
2007-07-23 14:58:04 +00:00
ad f92f123709 Workaround the ufs_haslock/ufs_ihash_lock deadlock. From a patch
posted by Blair Sadewitz.
2007-07-23 09:05:02 +00:00
rumble 17b8c7717a Add missing RCSID. 2007-07-22 21:12:27 +00:00
christos 407114c830 make this compile again 2007-07-22 03:40:59 +00:00
ad 744a92f0f8 Don't depend on uvm_extern.h pulling in proc.h. 2007-07-21 19:06:20 +00:00
pooka 9137aeda4b In sync, skip over vnodes based on if they are clean rather than
if they have pages.
2007-07-20 16:46:43 +00:00
hannken 8169dcee9d Update and add locking to ufs_quota:
- Replace DQ_LOCK/DQ_WANT/sleep/wakeup with a mutex `dq_interlock'.  Use this
  mutex to protect all quota values and flags.
- Protect the hashtable with a mutex.
- Never update quotas for the quota files on the same file system.  Prevents
  a deadlock when dqsync() has to change the  quota file's size (PR #13942).

Reviewed by:	Andrew Doran <ad@netbsd.org>
		Bill Stouder-Studenmund <wrstuden@netbsd.org>
2007-07-19 09:33:04 +00:00
christos c9d7b911ee Eliminate MFSNAMELEN 2007-07-17 21:26:41 +00:00
christos 785c01892b eliminate MFSNAMELEN 2007-07-17 21:20:43 +00:00
pooka e24b0872a4 Make set_statvfs_info() take a parameter for the vfs name instead
of always retrieving it from mp->mnt_op->vfs_name

christos ok
2007-07-17 11:19:31 +00:00
pooka 395899ddd0 When allocating blocks, check minfree before asking kauth about
suser.  The latter has unknown cost and rarely needs to be called.
2007-07-16 14:26:08 +00:00
pooka c77565e2a3 include quota.h to score definitions used by this header 2007-07-16 13:55:51 +00:00
rmind 20bbb87e34 Implementation of per-CPU work-queues support for workqueue(9) interface.
WQ_PERCPU flag for workqueue and additional argument for workqueue_enqueue()
to assign a CPU might be used. Notes:
 - For now, the list is used for workqueue_queue, which is non-optimal,
   and will be changed with array, where index would be CPU ID.
 - The data structures should be changed to be cache-friendly.

Reviewed by: <yamt>, <tech-kern>
2007-07-12 20:39:56 +00:00
dsl 2721ab6c7b Change the VFS_MOUNT() interface so that the 'data' buffer passed to the
fs code is a kernel buffer, pass though the length of the buffer as well.
Since the length of the userspace buffer isn'it (yet) passed through the mount
system call, add a field to the vfsops structure containing the default length.
Split sys_mount() for calls from compat code.
Ride one of the recent kernel version changes - old fs LKMs will load, but
sys_mount() will reject any attempt to use them.
2007-07-12 19:35:32 +00:00
hannken a8c44dfbf5 ffs_snapshot_mount: No persistent snapshots on an Apple UFS file system.
From Thor Lancelot Simon <tls@netbsd.org>
2007-07-12 09:30:04 +00:00
perseant 9a05fc1f4a Move the "vp = NULL" assignment after the code that requires vp != NULL.
Reported by Chris Ross on current-users.
2007-07-10 23:06:24 +00:00
hannken af689d2468 Restore the special lkt_held handling for softdep_disk_write_complete().
No more panics 'worklist_remove: lock not held' on DEBUG kernels.

Ok Andrew Doran <ad@netbsd.org>
2007-07-10 10:47:07 +00:00
hannken 149abfc10f Move `struct dquot' and its supporting functions from quota.h to ufs_quota.c.
- Make quota-internal functions static.
- Clean up declarations in quota.h and ufs_extern.h.  quota.h now has the
  description of quota criterions, on-disk structure, user-kernel interface and
  declaration of init/done functions.  All ufs quota related function
  prototypes go to ufs_extern.h.
- New functions ufsquota_init() and ufsquota_free() create or destroy the
  quota fields of `struct inode'.
- chkdq() and chkiq() always update the quota fields of `struct inode' first.
- Only ufs_access() explicitely calls getinoquota().

No objections on tech-kern@
2007-07-10 09:50:07 +00:00
ad e8f24929ec Fix build with DEBUG. 2007-07-09 22:52:14 +00:00
ad 7e7fac7f09 Fix merge botch. 2007-07-09 22:44:07 +00:00
ad c63e04d3bd We got LWPs years ago.. 2007-07-09 22:02:00 +00:00
ad 88ab7da936 Merge some of the less invasive changes from the vmlocking branch:
- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
2007-07-09 20:51:58 +00:00
pooka 835b0326c5 Using POOL_INIT here makes no sense, since file systems always have
an init method.  So get rid of it and #ifdef _LKM and just always
init in the init method.  Give malloc types the same treatment.
Makes file systems nicer to work with in linksetless environments
and fixes a few LKM discrepancies.
2007-06-30 09:37:53 +00:00
pooka e01e324216 remove redundant KASSERTs 2007-06-29 15:34:59 +00:00
hannken bed04c995a If a quota-enabled file system has 65536 active vnodes for one uid
the reference counter of the corresponding struct dquot will overflow.

Change the type of the reference counter from u_int16_t to u_int32_t and
add an assertion to check for overflow.

Observed and tested by Edgar Fuß.

Welcome to 4.99.21 (struct dquot and therefore struct inode changed layout)
2007-06-23 14:56:09 +00:00
yamt 7225d589de remove a duplicated definition of FFS_ITIMES. 2007-06-07 05:34:48 +00:00
yamt da51d139a4 improve post-ubc file overwrite performance in common cases.
ie. when it's safe, actually overwrite blocks rather than doing
read-modify-write.

also fixes PR/33152 and PR/36303.
2007-06-05 12:31:30 +00:00
tsutsui cd07663368 Fix inconsistent changes in rev 1.153 and 1.154:
Adjust fs->fs_maxfilesize instead of ump->um_maxfilesize
in ffs_oldfscompat_read() because the latter is overrided
by the former after ffs_oldfscompat_read() returned.

Fixes EFBIG errors on read(2) and "exec /sbin/init: error 8"
problem on mac68k after mountroot() on old 4.3BSD UFS created
by the Mkfs tool for MacOS (reported and confirmed on port-mac68k).
2007-05-29 11:30:17 +00:00
ad 1ae6657a7b Fix lock order inversion between vnode locks and ufs_hashlock. Addresses
kern/36331 (MP deadlock between ufs_ihashget() and VOP_LOOKUP()) for ffs,
other file systems to follow. Reported by perseant@, debugged by Sverre
Froyen, patch posted/tested by Blair Sadewitz.
2007-05-28 23:42:56 +00:00
hannken 64b7e5637e Fstrans_start() always returns zero, so change its type to void. 2007-05-17 07:26:21 +00:00
perseant 9234ba6fd8 Change references to SEGM_W_DIROPS to SEGM_CKP, and replace the logic that
formerly used SEGM_W_DIROPS in lfs_segwrite() appropriately.  This prevents
a problem in which processes could get stuck in "buffers" sleep forever.
2007-05-16 19:11:37 +00:00
tnn 4407197569 Add missing underscore to wchan name. 2007-05-15 14:35:29 +00:00
yamt d4bb61958b flush_inodedep_deps: fix access after free. PR/29724. 2007-05-07 11:13:01 +00:00
perseant 6a87e08daa Get rid of our own private copy of genfs_putpages, having adapted the real
genfs_putpages to suit our purposes.
2007-04-24 22:47:56 +00:00
yamt 337d052ee1 hold proclist_mutex when calling psignal(). 2007-04-19 11:05:14 +00:00
perseant 0549fd6148 Add/change a couple of comments about locking restrictions. 2007-04-18 00:50:06 +00:00
perseant 0d8a7af5d6 Remember to write dirops when the vnode we are trying to flush is a dirop. 2007-04-18 00:49:33 +00:00
perseant 72507061e4 Fix another locking protocol error in lfs_fsync(). 2007-04-17 20:30:28 +00:00
perseant 43d50ff956 Fix MP locking protocol violations introduced in my previous commit. 2007-04-17 06:49:40 +00:00
perseant 9be0ebd9da Install a new sysctl, vfs.lfs.ignore_lazy_sync, which causes LFS to ignore
the "smooth" syncer, as if vfs.sync.*delay = 0, but only for LFS.  The
default is "on", i.e., ignore lazy sync.

Reduce the amount of polling/busy-waiting done by lfs_putpages().  To
accomplish this, copied genfs_putpages() and modified it to indicate which
page it was that caused it to return with EDEADLK.  fsync()/fdatasync()
should no longer ever fail with EAGAIN, and should not consume huge
quantities of cpu.

Also, try to make dirops less likely to be written as the result of a
VOP_PUTPAGES(), while ensuring that they are written regularly.
2007-04-17 01:16:46 +00:00
pooka bc8224a1b3 fix comment: struct fid is in fstypes.h now 2007-04-09 12:21:24 +00:00
hannken fc6776f366 Remove now obsolete vn_start_write() and vn_finished_write() and
corresponding flags.

Revert softdep_trackbufs() to its state before vn_start_write() was added.

Remove from struct mount now unneeded flags IMNT_SUSPEND* and
members mnt_writeopcountupper, mnt_writeopcountlower and mnt_leaf.

Welcome to 4.99.17
2007-04-08 11:20:42 +00:00
hannken 11601689e7 Remove calls to now obsolete vn_start_write() and vn_finished_write(). 2007-04-07 14:21:52 +00:00
perseant b196644e3b correct comment for lfs_putpages 2007-04-05 17:44:18 +00:00
ad 4b1d78c00e Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.
2007-03-13 02:11:28 +00:00
ad 59d979c5f1 Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.
2007-03-12 18:18:22 +00:00
christos 53524e44ef Kill caddr_t; there will be some MI fallout, but it will be fixed shortly. 2007-03-04 05:59:00 +00:00
ad b89010bfa3 Destroy the hash locks on final unmount. 2007-02-27 16:11:51 +00:00
perseant d1d9b558a7 Reverse the order of searching the vnode list in lfs_writevnodes(). This
should speed up e.g. "chown -R" on LFS filesystems; e.g. it shows a 100%
increase in the 'seq_stat' column of bonnie++.
2007-02-23 23:16:03 +00:00
thorpej b3667ada6d TRUE -> true, FALSE -> false 2007-02-22 06:05:00 +00:00
thorpej 712239e366 Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.
2007-02-21 22:59:35 +00:00
pooka 5b38c61dd4 tyop in comment, fix it 2007-02-20 18:03:03 +00:00
pooka 7016942297 In readdir, in case cookies was already allocated but is later free'd
due to an error, reset value of cookies to NULL to avoid confusing
callers.

should fix kern/35728
2007-02-20 16:45:58 +00:00
ad adbb9ec2fa Call genfs_node_destroy() where appropriate. 2007-02-20 16:21:03 +00:00
ad d266042a07 Release ufs_hashlock before calling ungetnewvnode(). 2007-02-18 14:26:52 +00:00
pavel 934634a18c Change the process/lwp flags seen by userland via sysctl back to the
P_*/L_* naming convention, and rename the in-kernel flags to avoid
conflict. (P_ -> PK_, L_ -> LW_ ). Add back the (now unused) LSDEAD
constant.

Restores source compatibility with pre-newlock2 tools like ps or top.

Reviewed by Andrew Doran.
2007-02-17 22:31:36 +00:00
hannken 198beb0314 Make fstrans(9) the default helper for file system suspension.
Replaces the now obsolete vn_start_write()/vn_finished_write().
2007-02-16 17:23:53 +00:00