Home | History | Annotate | Download | only in ffs
History log of /src/sys/ufs/ffs/ffs_vnops.c
RevisionDateAuthorComments
 1.138  14-Dec-2021  chs ffs: support extattrs (and thus ACLs) on fifos.
 1.137  18-Jul-2021  dholland Abolish all the silly indirection macros for initializing vnode ops tables.

These are things of the form #define foofs_op genfs_op, or #define
foofs_op genfs_eopnotsupp, or similar. They serve no purpose besides
obfuscation, and have gotten cutpasted all over everywhere.
 1.136  18-Jul-2021  dholland Use macros for the canned parts of device and fifo vnode op tables.

Add GENFS_SPECOP_ENTRIES and GENFS_FIFOOP_ENTRIES macros that contain
the portion of the vnode ops table declaration that is
(conservatively) the same in every fs. Use these in every fs that
supports devices and/or fifos with separate ops tables.

Note that ptyfs works differently (it has one type of vnode with
open-coded dispatch to the specfs code, which I haven't changed in
this commit) and rump/librump/rumpvfs/rumpfs.c has an indirect dynamic
dispatch that already does more or less the same thing, which I also
haven't changed.

Also note that this anticipates a few bits in the next changeset here
and there, and adds missing but unreachable calls in some cases (e.g.
most fses weren't defining whiteout on devices and fifos, but it isn't
reachable there), and it changes parsepath on devices and fifos to
genfs_badop from genfs_parsepath (but it's not reachable there
either).

It appears that devices in kernfs were missing kqfilter, so it's
possible that if you try to use kqueue on /kern/rootdev that it'll
explode.

And finally note that the ops declaration tables aren't
order-dependent. (Other than vop_default_desc has to come first.)
Otherwise this wouldn't work.
 1.135  14-Jul-2021  christos Hook up ffsext_strategy to fifos. Pointed out by dholland@
 1.134  29-Jun-2021  dholland - Add a new vnode op: VOP_PARSEPATH.
- Move namei_getcomponent to genfs_vnops.c and call it genfs_parsepath.
- Add a parsepath entry to every vnode ops table.

VOP_PARSEPATH takes a directory vnode to be searched and a complete
following path and chooses how much of that path to consume. To begin
with, all parsepath calls are genfs_parsepath, which locates the first
'/' as always.

Note that the call doesn't take the whole struct componentname, only
the string. The other bits of struct componentname should not be
needed and there's no reason to cause potential complications by
exposing them.
 1.133  05-Sep-2020  riastradh branches: 1.133.6;
Round of uvm.h cleanup.

The poorly named uvm.h is generally supposed to be for uvm-internal
users only.

- Narrow it to files that actually need it -- mostly files that need
to query whether curlwp is the pagedaemon, which should maybe be
exposed by an external header.

- Use uvm_extern.h where feasible and uvm_*.h for things not exposed
by it. We should split up uvm_extern.h but this will serve for now
to reduce the uvm.h dependencies.

- Use uvm_stat.h and #ifdef UVMHIST uvm.h for files that use
UVMHIST(ubchist), since ubchist is declared in uvm.h but the
reference evaporates if UVMHIST is not defined, so we reduce header
file dependencies.

- Make uvm_device.h and uvm_swap.h independently includable while
here.

ok chs@
 1.132  16-May-2020  christos Add ACL support for FFS. From FreeBSD.
 1.131  18-Apr-2020  christos Extended attribute support for ffsv2, from FreeBSD.
 1.130  23-Feb-2020  ad branches: 1.130.4;
UVM locking changes, proposed on tech-kern:

- Change the lock on uvm_object, vm_amap and vm_anon to be a RW lock.
- Break v_interlock and vmobjlock apart. v_interlock remains a mutex.
- Do partial PV list locking in the x86 pmap. Others to follow later.
 1.129  26-May-2017  riastradh branches: 1.129.10; 1.129.16;
Make VOP_RECLAIM do the last unlock of the vnode.

VOP_RECLAIM naturally has exclusive access to the vnode, so having it
locked on entry is not strictly necessary -- but it means if there
are any final operations that must be done on the vnode, such as
ffs_update, requiring exclusive access to it, we can now kassert that
the vnode is locked in those operations.

We can't just have the caller release the last lock because some file
systems don't use genfs_lock, and require the vnode to remain valid
for VOP_UNLOCK to work, notably unionfs.
 1.128  02-Mar-2017  christos ifdef reduction
 1.127  01-Mar-2017  hannken Make compile again without "options WAPBL".

From John D. Baker via current-users@, slightly modified by me.
 1.126  01-Mar-2017  hannken Remove now redundant calls to fstrans_start()/fstrans_done().
 1.125  25-Jul-2014  dholland branches: 1.125.4; 1.125.8; 1.125.12;
Add VOP_FALLOCATE and VOP_FDISCARD to every vnode ops table I can
find.

The filesystem ones all call genfs_eopnotsupp - right now I am only
implementing the plumbing and we can implement fallocate and/or
fdiscard for files later.

The device ones call spec_fallocate (which is also genfs_eopnotsupp)
and spec_fdiscard, which dispatches to the device-level op.

The fifo ones all call vn_fifo_bypass, which also ends up being
EOPNOTSUPP.
 1.124  24-Mar-2014  hannken branches: 1.124.2;
- Make VI_XLOCK, VI_CLEAN and VI_LOCKSHARE private to kern/vfs_*.c.
- Make vwait() static.
- Add vdead_check() to check a vnode for being or becoming dead.

Discussed on tech-kern.

Welcome to 6.99.38
 1.123  23-Jun-2013  dholland branches: 1.123.2;
Stick ffs_, ext2_, chfs_, filecore_, cd9660_, or mfs_ in front of
the following symbols so as to disambiguate fully. (Christos already
did the lfs ones.)

lblkno
lblktosize
lfragtosize
numfrags
blkroundup
fragroundup
 1.122  22-Jan-2013  dholland Stuff UFS_ in front of a few of ufs's symbols to reduce namespace
pollution. Specifically:
ROOTINO -> UFS_ROOTINO
WINO -> UFS_WINO
NXADDR -> UFS_NXADDR
NDADDR -> UFS_NDADDR
NIADDR -> UFS_NIADDR
MAXSYMLINKLEN -> UFS_MAXSYMLINKLEN
MAXSYMLINKLEN_UFS[12] -> UFS[12]_MAXSYMLINKLEN (for consistency)

Sort out ext2fs's misuse of NDADDR and NIADDR; fortunately, these have
the same values in ext2fs and ffs.

No functional change intended.
 1.121  29-Apr-2012  chs branches: 1.121.2;
change vflushbuf() to take the full FSYNC_* flags.
translate FSYNC_LAZY into PGO_LAZY for VOP_PUTPAGES() so that
genfs_do_io() can set the appropriate io priority for the I/O.
this is the first part of addressing PR 46325.
 1.120  27-Jun-2011  manu branches: 1.120.2; 1.120.6; 1.120.8;
Implement extended attribute listing for UFS1.

Modify lsextattr(8) so that it does not expect each attribute name to be
prefixed by its length. This enable extattr_list_(file|link|fd) to
return a buffer matching its documentation. This also makes the interface
similar to what Linux and FUSE do, which is nice for interoperability.

Note that since we had no EA implementation supporting listing, we do
not break anything.
 1.119  12-Jun-2011  rmind Welcome to 5.99.53! Merge rmind-uvmplock branch:

- Reorganize locking in UVM and provide extra serialisation for pmap(9).
New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
kernel-lock on some ports). Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.
 1.118  27-Apr-2011  hannken branches: 1.118.2;
Cleanup ffs fsync and make devices on wapbl enabled file systems work here:

- Replace the ugly sync loop in ffs_full_fsync() and ffs_vfs_fsync() with
vflushbuf(). This loop is a relic of softdeps and not needed anymore.

- Add ffs_spec_fsync() for device nodes on ffs file systems that calls
spec_fsync() like all other file systems do and then updates the ctime.

Discussed on tech-kern.

Should fix PRs:
PR #41192 wapbl diagnostic panic during cgdconfig
PR #41977 kernel diagnostic assertion "rw_lock_held(&wl->wl_rwlock)" failed
PR #42149 wapbl locking panic if watching DVD
PR #42551 Lockdebug assert in wapbl when running zpool
 1.117  15-Apr-2011  hannken ffs_fsync: no need for wapbl_vptomp() here -- vnode is always VREG.
 1.116  12-Aug-2010  hannken branches: 1.116.2;
ffs_reclaim: don't free an already free inode. This may happen when
ffs_fhtovp() gets a free inode and releases it.
 1.115  28-Jul-2010  hannken ext2fs,ffs: free on disk inodes in the reclaim routine.
Remove now unneeded vnode flag VI_FREEING.

Welcome to 5.99.38.

Ok: Andrew Doran <ad@netbsd.org>
 1.114  29-Mar-2010  pooka Stop exposing fifofs internals and leave only fifo_vnodeop_p visible.
 1.113  04-Nov-2009  hannken branches: 1.113.2; 1.113.4;
Now that softdep has left the tree the only place needing the ffs_lock()
hack is ffs_sync().

- Use the generic lock operations for ffs.
- Change ffs_sync() to omit the vnode lock while suspending.

Reviewed by: Antti Kantee <pooka@netbsd.org>
 1.112  29-Mar-2009  ad fsync:

- atime updates were not being synced.

ffs_sync:

- In some cases the sync vnode was acting like now dead /usr/sbin/update.
It was examining vnodes that it should have ignored.

- It would find dirty inodes and try to flush them. Often ffs_fsync()
cheerfully ignored the flush request due to the fsync bug. Such inodes
remained dirty and were repeatedly re-examined by the syncer until
vnode reclaim or system shutdown.

- We were marking our place in the per-mount vnode list even though in
most cases there was not flush to perform. While not a bug, this wasted
CPU cycles because a TAILQ_NEXT would have sufficed.
 1.111  22-Feb-2009  ad PR kern/26878 FFSv2 + softdep = livelock (no free ram)
PR kern/16942 panic with softdep and quotas
PR kern/19565 panic: softdep_write_inodeblock: indirect pointer #1 mismatch
PR kern/26274 softdep panic: allocdirect_merge: ...
PR kern/26374 Long delay before non-root users can write to softdep partitions
PR kern/28621 1.6.x "vp != NULL" panic in ffs_softdep.c:4653 while unmounting a softdep (+quota) filesystem
PR kern/29513 FFS+Softdep panic with unfsck-able file-corruption
PR kern/31544 The ffs softdep code appears to fail to write dirty bits to disk
PR kern/31981 stopping scsi disk can cause panic (softdep)
PR kern/32116 kernel panic in softdep (assertion failure)
PR kern/32532 softdep_trackbufs deadlock
PR kern/37191 softdep: locking against myself
PR kern/40474 Kernel panic after remounting raid root with softdep

Retire softdep, pass 2. As discussed and later formally announced on the
mailing lists.
 1.110  22-Feb-2009  ad PR kern/39564 wapbl performance issues with disk cache flushing
PR kern/40361 WAPBL locking panic in -current
PR kern/40361 WAPBL locking panic in -current
PR kern/40470 WAPBL corrupts ext2fs
PR kern/40562 busy loop in ffs_sync when unmounting a file system
PR kern/40525 panic: ffs_valloc: dup alloc

- A fix for an issue that can lead to "ffs_valloc: dup" due to dirty cg
buffers being invalidated. Problem discovered and patch by dholland@.

- If the syncer fails to lazily sync a vnode due to lock contention,
retry 1 second later instead of 30 seconds later.

- Flush inode atime updates every ~10 seconds (this makes most sense with
logging). Presently they didn't hit the disk for read-only files or
devices until the file system was unmounted. It would be better to trickle
the updates out but that would require more extensive changes.

- Fix issues with file system corruption, busy looping and other nasty
problems when logging and non-logging file systems are intermixed,
with one being the root file system.

- For logging, do not flush metadata on an inode-at-a-time basis if the sync
has been requested by ioflush. Previously, we could try hundreds of log
sync operations a second due to inode update activity, causing the syncer
to fall behind and metadata updates to be serialized across the entire
file system. Instead, burst out metadata and log flushes at a minimum
interval of every 10 seconds on an active file system (happens more often
if the log becomes full). Note this does not change the operation of
fsync() etc.

- With the flush issue fixed, re-enable concurrent metadata updates in
vfs_wapbl.c.
 1.109  01-Feb-2009  ad branches: 1.109.2;
PR kern/40469 5.0_BETA/amd64 INSTALL kernel panics when installing on log-enabled filesystems
PR kern/40470 WAPBL corrupts ext2fs

Don't touch inodes at all unless VOP_FSYNC(). Might fix the ext2fs problem,
I am not sure.
 1.108  28-Dec-2008  christos Don't try to ffs_update VT_NON vnodes
 1.107  22-Dec-2008  ad Add a comment.
 1.106  22-Dec-2008  ad PR kern/40246 current panics when removing swap devices

Someone was smoking crack when they decided to unconditionally OR FSYNC_VFS
into the flags for block devices.
 1.105  21-Dec-2008  ad PR kern/40210 5.0 BETA WAPBL related crash
 1.104  10-Oct-2008  hannken branches: 1.104.2; 1.104.4;
Break a deadlock where one thread has a wapbl transaction, calls VOP_GETPAGES
and wants to busy a page while another thread calls VOP_PUTPAGES on the same
vnode, takes pages busy and wants to start a wapbl transaction.

Reviewed by: Jason Thorpe <thorpej@netbsd.org>
 1.103  22-Aug-2008  hannken Add snapshot support for logging ffs file systems.

- Add UFS_WAPBL_BEGIN() / UFS_WAPBL_END() where needed.

- Expunge WAPBL log inodes from snapshots.

- Ffs_copyonwrite() and ffs_snapblkfree() must run inside a WAPBL transaction.

- Add ffs_gop_write() as a wrapper around genfs_gop_write() that makes sure
genfs_gop_write() gets always called inside a WAPBL transaction.

- Add VOP_PUTPAGES() flag PGO_JOURNALLOCKED to tag calls to VOP_PUTPAGES()
inside a WAPBL transaction.

Reviewed by: Simon Burge <simonb@netbsd.org>, Greg Oster <oster@netbsd.org>

PGO_JOURNALLOCKED / ffs_gop_write() part presented on tech-kern@.
 1.102  12-Aug-2008  hannken Deny read/write access to snapshot vnodes. We use fss(4) to read from
snapshots. With this policy in place:

- Separate the snapshot vnode lock from the snapshot common lock.
Snapshots no longer need recursive vnode locks.

- Use a mutex (si_snaplock) to serialize creation, deletion, reading and
writing of snapshots.

- Move ffs_read() for snapshots into ffs_snapshot.c.

Reviewed by: Jason Thorpe <thorpej@netbsd.org>

While here change ffs_copyonwrite() to fail requests from pagedaemon that need
to copy-on-write.
 1.101  31-Jul-2008  oster Make MSDOS filesystems work again after WAPBL merge. Fixes a quite
repeatable panic in fstrans_getstate() found while searching for a
different USB bug. Also makes the code somewhat more readable.

Patch from Juergen Hannken-Illjes with a small rearrangement from me.

Approved by: hannken
 1.100  31-Jul-2008  simonb Merge the simonb-wapbl branch. From the original branch commit:

Add Wasabi System's WAPBL (Write Ahead Physical Block Logging)
journaling code. Originally written by Darrin B. Jewell while
at Wasabi and updated to -current by Antti Kantee, Andy Doran,
Greg Oster and Simon Burge.

OK'd by core@, releng@.
 1.99  29-Apr-2008  ad branches: 1.99.2; 1.99.4; 1.99.6;
PR kern/38057 ffs makes assuptions about devvp file system
PR kern/33406 softdeps get stuck in endless loop

Introduce VFS_FSYNC() and call it when syncing a block device, if it
has a mounted file system.
 1.98  30-Jan-2008  ad branches: 1.98.6; 1.98.8; 1.98.10;
Replace struct lock on vnodes with a simpler lock object built on
krwlock_t. This is a step towards removing lockmgr and simplifying
vnode locking. Discussed on tech-kern.
 1.97  25-Jan-2008  ad Remove VOP_LEASE. Discussed on tech-kern.
 1.96  09-Jan-2008  ad Go back to freeing on disk inodes in the inactive routine. It would be
better not to do this, but it rules out potential side effects with softdep.
 1.95  03-Jan-2008  ad Use pool_cache.
 1.94  02-Jan-2008  ad Merge vmlocking2 to head.
 1.93  26-Nov-2007  pooka branches: 1.93.2; 1.93.6;
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
 1.92  10-Oct-2007  ad branches: 1.92.4;
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.
 1.91  21-Aug-2007  hannken branches: 1.91.2; 1.91.4;
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>
 1.90  09-Aug-2007  hannken Move the fstrans-aware lock vnops from ufs to ffs. Other ufs file systems
do not need them.

Ride on 4.99.28
 1.89  20-Jul-2007  pooka branches: 1.89.4; 1.89.6;
In sync, skip over vnodes based on if they are clean rather than
if they have pages.
 1.88  05-Jun-2007  yamt branches: 1.88.2;
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.
 1.87  17-May-2007  hannken Fstrans_start() always returns zero, so change its type to void.
 1.86  20-Feb-2007  ad branches: 1.86.4; 1.86.6;
Call genfs_node_destroy() where appropriate.
 1.85  29-Jan-2007  hannken branches: 1.85.2;
Change fstrans enum types to upper case.
No functional change.

From Antti Kantee <pooka@netbsd.org>
 1.84  19-Jan-2007  hannken New file system suspension API to replace vn_start_write and vn_finished_write.
The suspension helpers are now put into file system specific operations.
This means every file system not supporting these helpers cannot be suspended
and therefore snapshots are no longer possible.

Implemented for file systems of type ffs.

The new API is enabled on a kernel option NEWVNGATE. This option is
not enabled by default in any kernel config.

Presented and discussed on tech-kern with much input from
Bill Studenmund <wrstuden@netbsd.org> and YAMAMOTO Takashi <yamt@netbsd.org>.

Welcome to 4.99.9 (new vfs op vfs_suspendctl).
 1.83  16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.82  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.81  23-Jul-2006  ad branches: 1.81.4; 1.81.6;
Use the LWP cached credentials where sane.
 1.80  14-May-2006  elad integrate kauth.
 1.79  09-Apr-2006  yamt ffs_gop_size: revert a problematic part of 1.78.
problems reported by Kouichirou Hiratsuka and Jukka Salmi on current-users@.
 1.78  30-Mar-2006  yamt some cleanups after the introduction of GOP_SIZE_MEM flag.
- remove GOP_SIZE_READ/GOP_SIZE_WRITE flags.
they have not been used since the change.
- ufs_balloc_range: remove code which has been no-op since the change.
thanks Konrad Schroder for explaining the original intention of the code.
- ffs_gop_size: don't extend past eof, in the case of GOP_SIZE_MEM.
otherwise genfs_getpages end up to allocate pages past eof unnecessarily.
 1.77  11-Dec-2005  christos branches: 1.77.4; 1.77.6; 1.77.8; 1.77.10; 1.77.12;
merge ktrace-lwp.
 1.76  02-Nov-2005  yamt merge yamt-vop branch. remove following VOPs.

VOP_BLKATOFF
VOP_VALLOC
VOP_BALLOC
VOP_REALLOCBLKS
VOP_VFREE
VOP_TRUNCATE
VOP_UPDATE
 1.75  09-Sep-2005  yamt branches: 1.75.2;
revert the code to expand putpage requests to block boundary.
because:
- it was incomplete in some cases.
- it can confuse pagedaemon.
see PR/15364 for details.
 1.74  30-Aug-2005  xtraeme * Remove __P()
* Use ANSI function declarations on ext2fs and mfs
 1.73  28-Aug-2005  thorpej Experimental support for extended attributes on UFS1 file systems, using a
backing file per attribute type indexed by inode number to hold the extended
attributes.

This is working pretty well on my test systems, except for the "autostart"
feature. I need someone with a better handle on the VFS locking protocol
to go over that.

This is a work-in-progress. There are parts of this that could be re-factored
allowing this approach to be used on other types of file systems.

Adapted from FreeBSD.
 1.72  26-Jul-2005  yamt revert VCHR part of ffs_vnops.c 1.71.
as VCHR uses the device pager, no point to call VOP_PUTPAGES here.
pointed by Chuck Silvers.
 1.71  21-Jul-2005  yamt ffs_full_fsync: because VBLK/VCHR can be mmap'ed,
do VOP_PUTPAGES for them as well.
 1.70  15-Jul-2005  thorpej Use ANSI function decls.
 1.69  26-Feb-2005  perry branches: 1.69.2; 1.69.4;
nuke trailing whitespace
 1.68  27-Jan-2005  wrstuden Fix pasto in previous. We only perform the DIOCCACHESYNC call if
FSYNC_CACHE is set, not if FSYNC_WAIT is set.
 1.67  25-Jan-2005  wrstuden Extend fsync_range(2) to support the FDISKSYNC flag, which requests
that the sync be propogated out through the disk drive caches.
 1.66  15-Nov-2003  thorpej branches: 1.66.8; 1.66.10;
Kernel portion of the fsync_range(2) system call. Written by Bill
Studenmund, and contributed by Wasabi Systems, Inc.
 1.65  08-Nov-2003  jdolecek fix uninitialized variable use in previous change (!)
 1.64  08-Nov-2003  dbj always do a full fsync if vp->v_type != VREG
in partial fsync, only use PGO_SYNCIO if FSYNC_WAIT is specified
 1.63  08-Nov-2003  dbj protect use of buf's b_flags with b_interlock
 1.62  08-Nov-2003  dbj protect a few uses of buf's b_flags with b_interlock
 1.61  25-Oct-2003  kleink 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.
 1.60  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.59  29-Jun-2003  fvdl branches: 1.59.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.58  28-Jun-2003  darrenr 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
 1.57  16-Apr-2003  fvdl 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.
 1.56  02-Apr-2003  fvdl 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.
 1.55  17-Feb-2003  perseant Add code to UBCify LFS. This is still behind "#ifdef LFS_UBC" for now
(there are still some details to work out) but expect that to go
away soon. To support these basic changes (creation of lfs_putpages,
lfs_gop_write, mods to lfs_balloc) several other changes were made, to
wit:

* Create a writer daemon kernel thread whose purpose is to handle page
writes for the pagedaemon, but which also takes over some of the
functions of lfs_check(). This thread is started the first time an
LFS is mounted.

* Add a "flags" parameter to GOP_SIZE. Current values are
GOP_SIZE_READ, meaning that the call should return the size of the
in-core version of the file, and GOP_SIZE_WRITE, meaning that it
should return the on-disk size. One of GOP_SIZE_READ or
GOP_SIZE_WRITE must be specified.

* Instead of using malloc(...M_WAITOK) for everything, reserve enough
resources to get by and use malloc(...M_NOWAIT), using the reserves if
necessary. Use the pool subsystem for structures small enough that
this is feasible. This also obsoletes LFS_THROTTLE.

And a few that are not strictly necessary:

* Moves the LFS inode extensions off onto a separately allocated
structure; getting closer to LFS as an LKM. "Welcome to 1.6O."

* Unified GOP_ALLOC between FFS and LFS.

* Update LFS copyright headers to correct values.

* Actually cast to unsigned in lfs_shellsort, like the comment says.

* Keep track of which segments were empty before the previous
checkpoint; any segments that pass two checkpoints both dirty and
empty can be summarily cleaned. Do this. Right now lfs_segclean
still works, but this should be turned into an effectless
compatibility syscall.
 1.54  05-Feb-2003  pk Make the buffer cache code MP-safe.
 1.53  29-Jan-2003  simonb Remove variable that is only assigned to but not referenced.
 1.52  24-Jan-2003  fvdl Bump daddr_t to 64 bits. Replace it with int32_t in all places where
it was used on-disk, so that on-disk formats remain the same.
Remove ufs_daddr_t and ufs_lbn_t for the time being.
 1.51  01-Nov-2002  kristerw Removed unused variables doclusterread and doclusterwrite.
 1.50  23-Oct-2002  jdolecek merge kqueue branch into -current

kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

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

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
 1.49  05-May-2002  chs for softdep vnodes, always write together the pages for any block that
might have a dependency , since the accounting doesn't work otherwise.
fixes PRs 15364 16336 16448.
 1.48  31-Dec-2001  thorpej Do not compare an integer to NULL.
 1.47  27-Dec-2001  fvdl The softdep code sometimes use vfs_vget .. vput. For removals, these
would result in a vop_inactive call for the vnode each time, resulting
in vinvalbuf->fsync. The original softdep code avoided the fsync
in vinvalbuf by not calling it if there were no dirty blocks. This
was changed in NetBSD. Also, flush_inodedeps was changed to mark
the inode as modified so that it would do an inode update and flush the
last one. This combination basically caused a sync write for each removed
file in an rm -rf (showing up delayed from the syncer a lot of the time).

If called from vinvalbuf (FSYNC_RECLAIM), and there were no dirty blocks
or pages to begin with, still do everything as normal, so that possible dirty
blocks in transit to disk are properly waited for, etc, but don't pass
UPDATE_WAIT to VOP_UPDATE, since there is no need for it in that case.
 1.46  08-Nov-2001  chs call VOP_PUTPAGES() directly for vnodes instead of
going through the UVM pager "put" vector.
 1.45  06-Nov-2001  simonb Remove some variables that are set but never used.
 1.44  30-Oct-2001  lukem add __KERNEL_RCSID()
 1.43  26-Oct-2001  lukem remove #include <ufs/ufs/quota.h> where it was just to appease
<ufs/ufs/inode.h>, since the latter now includes the former. leave the former
in source that obviously uses specific bits of it (for completeness.)
 1.42  26-Sep-2001  chs branches: 1.42.2;
undo the part of the previous revision about skipping
the put if there are no pages, that seems to cause some problem.
fix another problem with missing an splx(), spotted by enami.
 1.41  26-Sep-2001  chs be sure to call the pager put with page-aligned offsets.
spotted by Nathan Williams.

while I'm here, move an splbio() so that we don't return without
splx()ing it if there's an error, and don't bother calling the
pager put if the vnode has no pages.
 1.40  22-Sep-2001  sommerfeld Add fifo_putpages() placebo so that the vnode's uobj is unlocked.
 1.39  15-Sep-2001  chs a whole bunch of changes to improve performance and robustness under load:

- remove special treatment of pager_map mappings in pmaps. this is
required now, since I've removed the globals that expose the address range.
pager_map now uses pmap_kenter_pa() instead of pmap_enter(), so there's
no longer any need to special-case it.
- eliminate struct uvm_vnode by moving its fields into struct vnode.
- rewrite the pageout path. the pager is now responsible for handling the
high-level requests instead of only getting control after a bunch of work
has already been done on its behalf. this will allow us to UBCify LFS,
which needs tighter control over its pages than other filesystems do.
writing a page to disk no longer requires making it read-only, which
allows us to write wired pages without causing all kinds of havoc.
- use a new PG_PAGEOUT flag to indicate that a page should be freed
on behalf of the pagedaemon when it's unlocked. this flag is very similar
to PG_RELEASED, but unlike PG_RELEASED, PG_PAGEOUT can be cleared if the
pageout fails due to eg. an indirect-block buffer being locked.
this allows us to remove the "version" field from struct vm_page,
and together with shrinking "loan_count" from 32 bits to 16,
struct vm_page is now 4 bytes smaller.
- no longer use PG_RELEASED for swap-backed pages. if the page is busy
because it's being paged out, we can't release the swap slot to be
reallocated until that write is complete, but unlike with vnodes we
don't keep a count of in-progress writes so there's no good way to
know when the write is done. instead, when we need to free a busy
swap-backed page, just sleep until we can get it busy ourselves.
- implement a fast-path for extending writes which allows us to avoid
zeroing new pages. this substantially reduces cpu usage.
- encapsulate the data used by the genfs code in a struct genfs_node,
which must be the first element of the filesystem-specific vnode data
for filesystems which use genfs_{get,put}pages().
- eliminate many of the UVM pagerops, since they aren't needed anymore
now that the pager "put" operation is a higher-level operation.
- enhance the genfs code to allow NFS to use the genfs_{get,put}pages
instead of a modified copy.
- clean up struct vnode by removing all the fields that used to be used by
the vfs_cluster.c code (which we don't use anymore with UBC).
- remove kmem_object and mb_object since they were useless.
instead of allocating pages to these objects, we now just allocate
pages with no object. such pages are mapped in the kernel until they
are freed, so we can use the mapping to find the page to free it.
this allows us to remove splvm() protection in several places.

The sum of all these changes improves write throughput on my
decstation 5000/200 to within 1% of the rate of NetBSD 1.5
and reduces the elapsed time for "make release" of a NetBSD 1.5
source tree on my 128MB pc to 10% less than a 1.5 kernel took.
 1.38  17-Aug-2001  chs branches: 1.38.2;
add getpages/putpages entries for spec vnodes.
 1.37  22-Jan-2001  jdolecek branches: 1.37.2; 1.37.6;
make filesystem vnodeop, specop, fifoop and vnodeopv_* arrays const
 1.36  10-Dec-2000  chs call pgo_flush with (start,end) rather than (start,length).
 1.35  27-Nov-2000  chs Initial integration of the Unified Buffer Cache project.
 1.34  24-Oct-2000  fvdl Stay at splbio across the VBWAIT loop, as is done elsewhere in the
kernel. Avoids a possible race condition. Pointed out by
enami@netbsd.org, problem reported by deberg@netbsd.org.
 1.33  19-Sep-2000  fvdl Adapt for VOP_FSYNC parameter change.

Implement range fsync for FFS. Note: not yet implemented for the
SOFTDEP case.
 1.32  28-Jun-2000  mrg remove include of <vm/vm.h> and <uvm/uvm_extern.h>
 1.31  29-May-2000  mycroft branches: 1.31.2;
According to Frank, buffers with dependencies *are* left on v_dirtyblks, so
remove the FSYNC_RECLAIM check and force them to be flushed.
 1.30  29-May-2000  mycroft 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.)
 1.29  29-May-2000  mycroft 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.
 1.28  27-May-2000  thorpej branches: 1.28.2;
sleep() -> tsleep()
 1.27  13-May-2000  perseant 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.
 1.26  30-Mar-2000  augustss Remove register declarations.
 1.25  29-Mar-2000  simonb Don't need to include <sys/conf.h> here.
 1.24  17-Mar-2000  fvdl If we're reclaiming, and there are no dirty blocks, just return.
 1.23  15-Mar-2000  fvdl Revert this back to 2 revisions ago, these checks are done higher up now.
 1.22  14-Mar-2000  fvdl 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.
 1.21  11-Mar-2000  perseant 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>.
 1.20  15-Nov-1999  fvdl Add Kirk McKusick's soft updates code to the trunk. Not enabled by
default, as the copyright on the main file (ffs_softdep.c) is such
that is has been put into gnusrc. options SOFTDEP will pull this
in. This code also contains the trickle syncer.

Bump version number to 1.4O
 1.19  03-Aug-1999  wrstuden branches: 1.19.2; 1.19.4; 1.19.8;
Add support for fcntl(2) to generate VOP_FCNTL calls. Any fcntl
call with F_FSCTL set and F_SETFL calls generate calls to a new
fileop fo_fcntl. Add genfs_fcntl() and soo_fcntl() which return 0
for F_SETFL and EOPNOTSUPP otherwise. Have all leaf filesystems
use genfs_fcntl().

Reviewed by: thorpej
Tested by: wrstuden
 1.18  24-Mar-1999  mrg branches: 1.18.4;
completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
 1.17  04-Dec-1998  bouyer No need to #include malloc.h here.
 1.16  01-Sep-1998  thorpej branches: 1.16.2;
Use the pool allocator and the "nointr" pool page allocator for FFS inodes.

XXX MFS also comes in here for inodes, and used a different malloc type,
but the structure is the same, so we just use the FFS inode pool.
 1.15  24-Jun-1998  sommerfe Always include fifos; "not an option any more".
 1.14  22-Jun-1998  sommerfe defopt for options FIFO
 1.13  09-Jun-1998  scottr Protect various config(8)-generated files from inclusion while
building LKMs. Fixes PR 5557.
 1.12  01-Mar-1998  fvdl Merge with Lite2 + local changes
 1.11  10-Feb-1998  mrg - add defopt's for UVM, UVMHIST and PMAP_NEW.
- remove unnecessary UVMHIST_DECL's.
 1.10  05-Feb-1998  mrg initial import of the new virtual memory system, UVM, into -current.

UVM was written by chuck cranor <chuck@maria.wustl.edu>, with some
minor portions derived from the old Mach code. i provided some help
getting swap and paging working, and other bug fixes/ideas. chuck
silvers <chuq@chuq.com> also provided some other fixes.

this is the rest of the MI portion changes.

this will be KNF'd shortly. :-)
 1.9  07-Sep-1996  mycroft Implement poll(2).
 1.8  01-Sep-1996  mycroft Add a set of generic file system operations that most file systems use.
Also, fix some time stamp bogosities.
 1.7  11-May-1996  mycroft Change VOP_UPDATE() semantics:
* Make 2nd and 3rd args timespecs, not timevals.
* Consistently pass a Boolean as the 4th arg (except in LFS).
Also, fix ffs_update() and lfs_update() to actually change the nsec fields.
 1.6  09-Feb-1996  christos ffs prototypes
 1.5  14-Dec-1994  mycroft Sync with CSRG.
 1.4  13-Dec-1994  mycroft Turn lease_check() into a vnode op, per CSRG.
 1.3  29-Jun-1994  cgd New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'
 1.2  22-Jun-1994  mycroft Deallocate the vnode data using the correct type for MFS nodes.
 1.1  08-Jun-1994  mycroft branches: 1.1.1;
Update to 4.4-Lite fs code, with local changes.
 1.1.1.2  01-Mar-1998  fvdl Import 4.4BSD-Lite2
 1.1.1.1  01-Mar-1998  fvdl Import 4.4BSD-Lite for reference
 1.16.2.6  02-Jun-1999  chs use the new flags PG_RDONLY and UFP_NORDONLY to ensure that
any page which becomes dirty will have backing store allocated.
 1.16.2.5  30-May-1999  chs redo ffs_getpages() and ffs_putpages() again since vm_page's
blkno field is gone.
 1.16.2.4  29-Apr-1999  chs disable buffer-cache clustering.
 1.16.2.3  25-Feb-1999  chs major overhaul of getpages and putpages functions.
 1.16.2.2  16-Nov-1998  chs fix style nits.
 1.16.2.1  09-Nov-1998  chs initial snapshot. lots left to do.
 1.18.4.2  04-Jul-1999  chs support VOP_BALLOC(). ffs_getpages() and ffs_putpages() are gone
in favor of the genfs versions.
 1.18.4.1  07-Jun-1999  chs merge everything from chs-ubc branch.
 1.19.8.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.19.4.2  26-Oct-1999  fvdl Merge changes in the trickle-sync and softdep code as done by Kirk McKusick
in FreeBSD since the version that we based the branch on. Merging mostly
done by Ethan Solomita <ethan@geocast.com>.

Also, make sure the syncer thread/process isn't active when we're
unmounting a filesystem. This could wreak havoc. XXX should be done
on a per-mountpoint basis, but especially the softdep code would
end up to be a big pile of vfs_busy() calls.
 1.19.4.1  19-Oct-1999  fvdl Bring in Kirk McKusick's FFS softdep code on a branch.
 1.19.2.4  11-Feb-2001  bouyer Sync with HEAD.
 1.19.2.3  13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.19.2.2  08-Dec-2000  bouyer Sync with HEAD.
 1.19.2.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.28.2.1  22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.31.2.2  26-Feb-2002  he Pull up revision 1.47 (via patch, requested by fvdl):
Correct a mistake made in the original merge-in of the softdep
code, and fix a problem which caused ffs_fsync to do unneeded
sync writes.
 1.31.2.1  14-Dec-2000  he Pull up revisions 1.33-1.34 (requested by fvdl):
Improve NFS performance, possibly with as much as 100% in
throughput. Please note: this implies a kernel interface change,
VOP_FSYNC gains two arguments.
 1.37.6.7  25-Sep-2002  jdolecek switch over to genfs_kqfilter(), g/c the ufs_kqfilter() code
 1.37.6.6  23-Sep-2002  jdolecek add spec kqfilter vnode op
 1.37.6.5  22-Sep-2002  jdolecek add fifo_kqfilter() to ffs_fifoop_entries[], to switch on
support for kevents on fifos on FFS
 1.37.6.4  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.37.6.3  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.37.6.2  25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.37.6.1  10-Jul-2001  lukem add ufs_kqfilter method for vop_kqfilter
 1.37.2.9  11-Nov-2002  nathanw Catch up to -current
 1.37.2.8  16-Jul-2002  nathanw pagedaemon_proc really should be a proc, not a LWP.
 1.37.2.7  24-Jun-2002  nathanw Curproc->curlwp renaming.

Change uses of "curproc->l_proc" back to "curproc", which is more like the
original use. Bare uses of "curproc" are now "curlwp".

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.37.2.6  20-Jun-2002  nathanw Catch up to -current.
 1.37.2.5  08-Jan-2002  nathanw Catch up to -current.
 1.37.2.4  14-Nov-2001  nathanw Catch up to -current.
 1.37.2.3  26-Sep-2001  nathanw Catch up to -current.
Again.
 1.37.2.2  21-Sep-2001  nathanw Catch up to -current.
 1.37.2.1  24-Aug-2001  nathanw Catch up with -current.
 1.38.2.1  01-Oct-2001  fvdl Catch up with -current.
 1.42.2.1  12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.59.2.7  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.59.2.6  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.59.2.5  04-Feb-2005  skrll Sync with HEAD.
 1.59.2.4  21-Sep-2004  skrll Fix the sync with head I botched.
 1.59.2.3  18-Sep-2004  skrll Sync with HEAD.
 1.59.2.2  03-Aug-2004  skrll Sync with HEAD
 1.59.2.1  02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.66.10.2  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.66.10.1  12-Feb-2005  yamt sync with head.
 1.66.8.1  29-Apr-2005  kent sync with -current
 1.69.4.8  04-Feb-2008  yamt sync with head.
 1.69.4.7  21-Jan-2008  yamt sync with head
 1.69.4.6  07-Dec-2007  yamt sync with head
 1.69.4.5  27-Oct-2007  yamt sync with head.
 1.69.4.4  03-Sep-2007  yamt sync with head.
 1.69.4.3  26-Feb-2007  yamt sync with head.
 1.69.4.2  30-Dec-2006  yamt sync with head.
 1.69.4.1  21-Jun-2006  yamt sync with head.
 1.69.2.2  21-Oct-2005  tron Pull up following revision(s) (requested by yamt in ticket #845):
sys/ufs/ffs/ffs_extern.h: revision 1.45 via patch
sys/ufs/ffs/ffs_vnops.c: revision 1.75 via patch
revert the code to expand putpage requests to block boundary.
because:
- it was incomplete in some cases.
- it can confuse pagedaemon.
see PR/15364 for details.
 1.69.2.1  24-Aug-2005  riz Pull up following revision(s) (requested by yamt in ticket #688):
sys/miscfs/genfs/genfs_vnops.c: revision 1.98 via patch
sys/ufs/ffs/ffs_vfsops.c: revision 1.165
sys/ufs/lfs/lfs_extern.h: revision 1.69
sys/fs/filecorefs/filecore_vfsops.c: revision 1.20
sys/nfs/nfs_node.c: revision 1.80
sys/fs/smbfs/smbfs_node.c: revision 1.24
sys/fs/cd9660/cd9660_vfsops.c: revision 1.24
sys/fs/msdosfs/msdosfs_denode.c: revision 1.8
sys/miscfs/genfs/genfs_node.h: revision 1.6
sys/ufs/lfs/lfs_vfsops.c: revision 1.183
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.86
sys/fs/adosfs/advfsops.c: revision 1.23
sys/fs/ntfs/ntfs_vfsops.c: revision 1.31
- constify genfs_ops.
- use member designators.

sys/miscfs/genfs/genfs_vnops.c: revision 1.99 via patch
genfs_getpages: don't forget to put the vnode onto the syncer's work que
ue
even in the case of PGO_LOCKED.

sys/uvm/uvm_bio.c: revision 1.40
sys/uvm/uvm_pager.h: revision 1.29
sys/miscfs/genfs/genfs_vnops.c: revision 1.100 via patch
sys/ufs/ufs/ufs_inode.c: revision 1.50
- introduce PGO_NOBLOCKALLOC and use it for ubc mapping
to prevent unnecessary block allocations in the case that
page size > block size.
- ufs_balloc_range: use VM_PROT_WRITE+PGO_NOBLOCKALLOC rather than
VM_PROT_READ.

sys/uvm/uvm_fault.c: revision 1.96
sys/miscfs/genfs/genfs_vnops.c: revision 1.101 via patch
sys/uvm/uvm_object.h: revision 1.19
sys/miscfs/genfs/genfs_node.h: revision 1.7
ensure that vnodes with dirty pages are always on syncer's queue.
- genfs_putpages: wait for i/o completion of PG_RELEASED/PG_PAGEOUT pages by
setting "wasclean" false when encountering them.
suggested by Stephan Uphoff in PR/24596 (1).
- genfs_putpages: write protect pages when cleaning out, if
we're going to take the vnode off the syncer's queue.
uvm_fault: don't write-map pages unless its vnode is already on
the syncer's queue.
fix PR/24596 (3) but in the different way from the suggested fix.
(to keep our current behaviour, ie. not to require explicit msync.
discussed on tech-kern@.)
- genfs_putpages: don't mistakenly take a vnode off the queue
by introducing a generation number in genfs_node.
genfs_getpages: increment the generation number.
suggested by Stephan Uphoff in PR/24596 (2).
- add some assertions.

sys/miscfs/genfs/genfs_vnops.c: revision 1.102 via patch
genfs_putpages: don't bother to clean the vnode unless VONWORKLST.

sys/ufs/ffs/ffs_vnops.c: revision 1.71
ffs_full_fsync: because VBLK/VCHR can be mmap'ed,
do VOP_PUTPAGES for them as well.

sys/uvm/uvm_fault.c: revision 1.97
uvm_fault: check a correct object in the case of layered filesystems.
fix PR/30811 from Jukka Salmi.

sys/uvm/uvm_object.h: revision 1.20
sys/ufs/ffs/ffs_vfsops.c: revision 1.167
sys/uvm/uvm_bio.c: revision 1.41
sys/ufs/ufs/ufs_vnops.c: revision 1.129
sys/uvm/uvm_mmap.c: revision 1.92
sys/uvm/uvm_fault.c: revision 1.98
sys/kern/vfs_subr.c: revision 1.252
sys/fs/msdosfs/denode.h: revision 1.5
sys/miscfs/genfs/genfs_vnops.c: revision 1.103 via patch
sys/fs/msdosfs/msdosfs_denode.c: revision 1.9
sys/sys/vnode.h: revision 1.141
sys/ufs/ufs/ufs_inode.c: revision 1.51
sys/ufs/ufs/ufs_extern.h: revision 1.45 via patch
sys/miscfs/genfs/genfs_node.h: revision 1.8
sys/ufs/lfs/lfs_vfsops.c: revision 1.184
sys/uvm/uvm_pager.h: revision 1.30
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.87
update file timestamps for nfsd loaned-read and mmap.
PR/25279. discussed on tech-kern@.

sys/miscfs/genfs/genfs_vnops.c: revision 1.104 via patch
don't write-protect wired pages. pointed by Chuck Silvers.
for now, leave a vnode on the syncer's queue, as suggested by him.

sys/ufs/ffs/ffs_vnops.c: revision 1.72
revert VCHR part of ffs_vnops.c 1.71.
as VCHR uses the device pager, no point to call VOP_PUTPAGES here.
pointed by Chuck Silvers.
 1.75.2.2  29-Oct-2005  yamt use ffs_* directly rather than via ufs_ops.
suggested by Chuck Silvers.
 1.75.2.1  20-Oct-2005  yamt adapt ufs.
 1.77.12.2  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.77.12.1  31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.77.10.3  06-May-2006  christos - Move kauth_cred_t declaration to <sys/types.h>
- Cleanup struct ucred; forward declarations that are unused.
- Don't include <sys/kauth.h> in any header, but include it in the c files
that need it.

Approved by core.
 1.77.10.2  19-Apr-2006  elad sync with head.
 1.77.10.1  08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.77.8.4  11-Aug-2006  yamt sync with head
 1.77.8.3  24-May-2006  yamt sync with head.
 1.77.8.2  11-Apr-2006  yamt sync with head
 1.77.8.1  01-Apr-2006  yamt sync with head.
 1.77.6.2  01-Jun-2006  kardel Sync with head.
 1.77.6.1  22-Apr-2006  simonb Sync with head.
 1.77.4.1  09-Sep-2006  rpaulo sync with head
 1.81.6.2  10-Dec-2006  yamt sync with head.
 1.81.6.1  22-Oct-2006  yamt sync with head
 1.81.4.2  01-Feb-2007  ad Sync with head.
 1.81.4.1  18-Nov-2006  ad Sync with head.
 1.85.2.2  17-May-2007  yamt sync with head.
 1.85.2.1  27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.86.6.1  11-Jul-2007  mjf Sync with head.
 1.86.4.13  09-Oct-2007  ad Sync with head.
 1.86.4.12  16-Sep-2007  ad - Checkpoint work in progress on the vnode lifecycle and reference counting
stuff. This makes it work properly without kernel_lock and fixes a few
quite old bugs. See vfs_subr.c 1.283.2.17 for details.

- Fix some problems with softdep. Unfortunately our softdep code appears
to have some longstanding bugs that cause it fail under stress test.
 1.86.4.11  30-Aug-2007  ad bufcache_lock is sufficient to inspect v_dirtyblkhd, vp->v_interlock is only
needed to modify.
 1.86.4.10  24-Aug-2007  ad Sync with buffer cache locking changes. See buf.h/vfs_bio.c for details.
Some minor portions are incomplete and needs to be verified as a whole.
 1.86.4.9  20-Aug-2007  ad Sync with HEAD.
 1.86.4.8  01-Jul-2007  ad Minor locking fixes.
 1.86.4.7  23-Jun-2007  ad - Lock v_cleanblkhd, v_dirtyblkhd, v_numoutput with the vnode's interlock.
Get rid of global_v_numoutput_lock. Partially incomplete as the buffer
cache locking doesn't work very well and needs an overhaul.
- Some changes to try and make softdep MP safe. Untested.
 1.86.4.6  09-Jun-2007  ad Sync with head.
 1.86.4.5  08-Jun-2007  ad Sync with head.
 1.86.4.4  27-May-2007  ad ffs_sync: vp->v_data can be NULL if the vnode is being recycled.
 1.86.4.3  13-May-2007  ad - Pass the error number and residual count to biodone(), and let it handle
setting error indicators. Prepare to eliminate B_ERROR.
- Add a flag argument to brelse() to be set into the buf's flags, instead
of doing it directly. Typically used to set B_INVAL.
- Add a "struct cpu_info *" argument to kthread_create(), to be used to
create bound threads. Change "bool mpsafe" to "int flags".
- Allow exit of LWPs in the IDL state when (l != curlwp).
- More locking fixes & conversion to the new API.
 1.86.4.2  21-Mar-2007  ad - Replace more simple_locks, and fix up in a few places.
- Use condition variables.
- LOCK_ASSERT -> KASSERT.
 1.86.4.1  13-Mar-2007  ad Pull in the initial set of changes for the vmlocking branch.
 1.88.2.2  03-Sep-2007  skrll Sync with HEAD.
 1.88.2.1  15-Aug-2007  skrll Sync with HEAD.
 1.89.6.2  20-Jul-2007  pooka In sync, skip over vnodes based on if they are clean rather than
if they have pages.
 1.89.6.1  20-Jul-2007  pooka file ffs_vnops.c was added on branch matt-mips64 on 2007-07-20 16:46:46 +0000
 1.89.4.4  27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.89.4.3  26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.89.4.2  03-Sep-2007  jmcneill Sync with HEAD.
 1.89.4.1  16-Aug-2007  jmcneill Sync with HEAD.
 1.91.4.1  14-Oct-2007  yamt sync with head.
 1.91.2.3  23-Mar-2008  matt sync with HEAD
 1.91.2.2  09-Jan-2008  matt sync with HEAD
 1.91.2.1  06-Nov-2007  matt sync with HEAD
 1.92.4.2  18-Feb-2008  mjf Sync with HEAD.
 1.92.4.1  08-Dec-2007  mjf Sync with HEAD.
 1.93.6.3  10-Jan-2008  bouyer Sync with HEAD
 1.93.6.2  08-Jan-2008  bouyer Sync with HEAD
 1.93.6.1  02-Jan-2008  bouyer Sync with HEAD
 1.93.2.4  30-Dec-2007  ad Fix remaining problems with ext2fs on this branch.
 1.93.2.3  10-Dec-2007  ad - Don't drain the vnode lock in vclean(); reference counting and XLOCK
should be enough.
- LK_SETRECURSE is gone.
 1.93.2.2  09-Dec-2007  ad LK_SETRECURSE is unused.
 1.93.2.1  04-Dec-2007  ad Pull the vmlocking changes into a new branch.
 1.98.10.5  09-Oct-2010  yamt sync with head
 1.98.10.4  11-Aug-2010  yamt sync with head.
 1.98.10.3  11-Mar-2010  yamt sync with head
 1.98.10.2  04-May-2009  yamt sync with head.
 1.98.10.1  16-May-2008  yamt sync with head.
 1.98.8.1  18-May-2008  yamt sync with head.
 1.98.6.3  17-Jan-2009  mjf Sync with HEAD.
 1.98.6.2  28-Sep-2008  mjf Sync with HEAD.
 1.98.6.1  02-Jun-2008  mjf Sync with HEAD.
 1.99.6.1  19-Oct-2008  haad Sync with HEAD.
 1.99.4.3  18-Jul-2008  simonb In ffs_fsync() pass FSYNC_VFS to ffs_full_fsync() for a VBLK vnode so
that the correct "struct mount" is referenced.

Fixes WAPBL for the "mount update" case, so remove the "anti-kern/38057"
hack that was previous there to guard against this.

Based on suggestion from yamt@. yamt suggest this could be cleaner
that the current VFS_FSYNC method too. Another day...
 1.99.4.2  12-Jun-2008  martin License police
 1.99.4.1  10-Jun-2008  simonb Initial commit of Wasabi System's WAPBL (Write Ahead Physical Block
Logging) journaling code. Originally written by Darrin B. Jewell
while at Wasabi and updated to -current by Antti Kantee, Andy Doran,
Greg Oster and Simon Burge.

Still a number of issues - look in doc/BRANCHES for "simonb-wapbl"
for more info.
 1.99.2.2  10-Oct-2008  skrll Sync with HEAD.
 1.99.2.1  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.104.4.8  17-Jul-2011  riz Pull up following revision(s) (requested by manu in ticket #1645):
lib/libc/sys/Makefile.inc 1.207 via patch
lib/libc/sys/extattr_get_file.2 patch
lib/libpuffs/dispatcher.c 1.34,1.36 via patch
lib/libpuffs/puffs.c 1.107 via patch
lib/libpuffs/puffs.h 1.115,1.118 via patch
sys/fs/puffs/puffs_msgif.h 1.71,1.76 via patch
sys/fs/puffs/puffs_vfsops.c 1.88 via patch
sys/fs/puffs/puffs_vnops.c 1.145,1.154 via patch
sys/kern/vfs_xattr.c 1.24-1.27 via patch
sys/kern/vnode_if.c 1.87 via patch
sys/sys/Makefile 1.133 via patch
sys/sys/extattr.h 1.6 via patch
sys/sys/vnode_if.h 1.81 via patch
sys/ufs/ffs/ffs_vnops.c patch
sys/ufs/ufs/ufs_extattr.c 1.31,1.34 via patch

* support extended attributes
* bump major due to structure growth
* add some spare space
* remove ABI sillyness
Support extended attributes.
Fix multiple non compliances in our Linux-like extattr API, and make it
public so that it can be used.
Improve a bit listxattr(2). It attemps to list both system and user
extended attributes, and it faled if calling user did not have privilege
for reading system EA. Now we just lise user EA and skip system EA in
reading them is not allowed.
Fix bug introduced in previous commuit: Do not vrele() a vnode we did not
obtained.
Improve UFS1 extended attributes usability
- autocreate attribute backing file for new attributes
- autoload attributes when issuing extattrctl start
- when autoloading attributes, do not display garbage warning when looking
up entries that got ENOENT
Add a flag to VOP_LISTEXTATTR(9) so that the vnode interface can tell the
filesystem in which format extended attribute shall be listed.
There are currently two formats:
- NUL-terminated strings, used for listxattr(2), this is the default.
- one byte length-pprefixed, non NUL-terminated strings, used for
extattr_list_file(2), which is obtanined by setting the
EXTATTR_LIST_PREFIXLEN flag to VOP_LISTEXTATTR(9)
This approach avoid the need for converting the list back and forth, except
in libperfuse, since FUSE uses NUL-terminated strings, and the kernel may
have requested EXTATTR_LIST_PREFIXLEN.
 1.104.4.7  04-Apr-2009  snj Pull up following revision(s) (requested by add in ticket #655):
sys/ufs/ffs/ffs_vfsops.c: revision 1.245 via patch
sys/ufs/ffs/ffs_vnops.c: revision 1.112 via patch
fsync:
- atime updates were not being synced.
ffs_sync:
- In some cases the sync vnode was acting like now dead /usr/sbin/update.
It was examining vnodes that it should have ignored.
- It would find dirty inodes and try to flush them. Often ffs_fsync()
cheerfully ignored the flush request due to the fsync bug. Such inodes
remained dirty and were repeatedly re-examined by the syncer until
vnode reclaim or system shutdown.
- We were marking our place in the per-mount vnode list even though in
most cases there was not flush to perform. While not a bug, this wasted
CPU cycles because a TAILQ_NEXT would have sufficed.
 1.104.4.6  24-Feb-2009  snj Pull up following revision(s) (requested by ad in ticket #490):
sys/kern/vfs_wapbl.c: revision 1.23
sys/miscfs/syncfs/sync_subr.c: revision 1.36
sys/miscfs/syncfs/sync_vnops.c: revision 1.26
sys/ufs/ffs/ffs_alloc.c: revision 1.121
sys/ufs/ffs/ffs_vfsops.c: revision 1.242
sys/ufs/ffs/ffs_vnops.c: revision 1.110
PR kern/39564 wapbl performance issues with disk cache flushing
PR kern/40361 WAPBL locking panic in -current
PR kern/40361 WAPBL locking panic in -current
PR kern/40470 WAPBL corrupts ext2fs
PR kern/40562 busy loop in ffs_sync when unmounting a file system
PR kern/40525 panic: ffs_valloc: dup alloc
- A fix for an issue that can lead to "ffs_valloc: dup" due to dirty cg
buffers being invalidated. Problem discovered and patch by dholland@.
- If the syncer fails to lazily sync a vnode due to lock contention,
retry 1 second later instead of 30 seconds later.
- Flush inode atime updates every ~10 seconds (this makes most sense with
logging). Presently they didn't hit the disk for read-only files or
devices until the file system was unmounted. It would be better to trickle
the updates out but that would require more extensive changes.
- Fix issues with file system corruption, busy looping and other nasty
problems when logging and non-logging file systems are intermixed,
with one being the root file system.
- For logging, do not flush metadata on an inode-at-a-time basis if the sync
has been requested by ioflush. Previously, we could try hundreds of log
sync operations a second due to inode update activity, causing the syncer
to fall behind and metadata updates to be serialized across the entire
file system. Instead, burst out metadata and log flushes at a minimum
interval of every 10 seconds on an active file system (happens more often
if the log becomes full). Note this does not change the operation of
fsync() etc.
- With the flush issue fixed, re-enable concurrent metadata updates in
vfs_wapbl.c.
 1.104.4.5  02-Feb-2009  snj Pull up following revision(s) (requested by ad in ticket #395):
sys/ufs/ffs/ffs_vnops.c: revision 1.109
PR kern/40469 5.0_BETA/amd64 INSTALL kernel panics when installing on
log-enabled filesystems
PR kern/40470 WAPBL corrupts ext2fs
Don't touch inodes at all unless VOP_FSYNC(). Might fix the ext2fs problem,
I am not sure.
 1.104.4.4  02-Feb-2009  snj Pull up following revision(s) (requested by ad in ticket #395):
sys/ufs/ffs/ffs_vnops.c: revision 1.108
Don't try to ffs_update VT_NON vnodes
 1.104.4.3  02-Feb-2009  snj Pull up following revision(s) (requested by ad in ticket #395):
sys/ufs/ffs/ffs_vnops.c: revision 1.107
Add a comment.
 1.104.4.2  02-Feb-2009  snj Pull up following revision(s) (requested by ad in ticket #395):
sys/ufs/ffs/ffs_vnops.c: revision 1.106
PR kern/40246 current panics when removing swap devices
Someone was smoking crack when they decided to unconditionally OR FSYNC_VFS
into the flags for block devices.
 1.104.4.1  02-Feb-2009  snj Pull up following revision(s) (requested by ad in ticket #395):
sys/ufs/ffs/ffs_vnops.c: revision 1.105
PR kern/40210 5.0 BETA WAPBL related crash
 1.104.2.3  28-Apr-2009  skrll Sync with HEAD.
 1.104.2.2  03-Mar-2009  skrll Sync with HEAD.
 1.104.2.1  19-Jan-2009  skrll Sync with HEAD.
 1.109.2.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.113.4.5  31-May-2011  rmind sync with head
 1.113.4.4  21-Apr-2011  rmind sync with head
 1.113.4.3  05-Mar-2011  rmind sync with head
 1.113.4.2  30-May-2010  rmind sync with head
 1.113.4.1  16-Mar-2010  rmind Change struct uvm_object::vmobjlock to be dynamically allocated with
mutex_obj_alloc(). It allows us to share the locks among UVM objects.
 1.113.2.2  17-Aug-2010  uebayasi Sync with HEAD.
 1.113.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.116.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.118.2.1  23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.120.8.1  07-May-2012  riz Pull up following revision(s) (requested by chs in ticket #204):
sys/fs/sysvbfs/sysvbfs_vnops.c: revision 1.44
sys/ufs/ffs/ffs_vfsops.c: revision 1.277
sys/fs/v7fs/v7fs_vnops.c: revision 1.11
sys/ufs/chfs/chfs_vnops.c: revision 1.7
sys/ufs/ext2fs/ext2fs_readwrite.c: revision 1.61
sys/miscfs/genfs/genfs_io.c: revision 1.54
sys/kern/vfs_wapbl.c: revision 1.52
sys/uvm/uvm_pager.h: revision 1.43
sys/ufs/ffs/ffs_vnops.c: revision 1.121
sys/kern/vfs_subr.c: revision 1.434
sys/fs/msdosfs/msdosfs_vnops.c: revision 1.83
sys/fs/ntfs/ntfs_vnops.c: revision 1.51
sys/fs/udf/udf_subr.c: revision 1.119
sys/miscfs/specfs/spec_vnops.c: revision 1.135
sys/ufs/ext2fs/ext2fs_vnops.c: revision 1.103
sys/fs/udf/udf_vnops.c: revision 1.71
sys/ufs/ufs/ufs_readwrite.c: revision 1.104
change vflushbuf() to take the full FSYNC_* flags.
translate FSYNC_LAZY into PGO_LAZY for VOP_PUTPAGES() so that
genfs_do_io() can set the appropriate io priority for the I/O.
this is the first part of addressing PR 46325.
mark all wapbl I/O as BPRIO_TIMECRITICAL.
this is the second part of addressing PR 46325.
 1.120.6.1  02-Jun-2012  mrg sync to latest -current.
 1.120.2.3  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.120.2.2  23-Jan-2013  yamt sync with head
 1.120.2.1  23-May-2012  yamt sync with head.
 1.121.2.3  03-Dec-2017  jdolecek update from HEAD
 1.121.2.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.121.2.1  25-Feb-2013  tls resync with head
 1.123.2.1  18-May-2014  rmind sync with head
 1.124.2.1  10-Aug-2014  tls Rebase.
 1.125.12.1  21-Apr-2017  bouyer Sync with HEAD
 1.125.8.1  20-Mar-2017  pgoyette Sync with HEAD
 1.125.4.1  28-Aug-2017  skrll Sync with HEAD
 1.129.16.1  29-Feb-2020  ad Sync with head.
 1.129.10.2  21-Apr-2020  martin Sync with HEAD
 1.129.10.1  08-Apr-2020  martin Merge changes from current as of 20200406
 1.130.4.1  20-Apr-2020  bouyer Sync with HEAD
 1.133.6.1  01-Aug-2021  thorpej Sync with HEAD.

RSS XML Feed