Home | History | Annotate | Download | only in ffs
History log of /src/sys/ufs/ffs/ffs_inode.c
RevisionDateAuthorComments
 1.131  31-Jul-2020  chs fix the UFS2 extattr truncate code to play nice with wapbl.
also, rather than pull in the FreeBSD V_NORMAL/V_ALT flags to
vinvalbuf() and the buf b_xflags field and BX_ALTDATA flag,
add a binvalbuf() function to invalid a specific buffer
and use that to invalidate the two possible exattr bufs
during IO_EXT truncations.
 1.130  26-Jul-2020  chs pull in a bit more FreeBSD code to allow specifying truncation of
the regular bmap (IO_NORMAL) independently of the extattr bmap (IO_EXT).
fixes fs corruption when removing extattrs in UFS2.
 1.129  02-May-2020  christos Remove the unlock/relock hack by using IO_EXT to indicate that we are already
holding the lock.
 1.128  23-Apr-2020  ad PR kern/54759 (vm.ubc_direct deadlock when read()/write() into mapping of itself)

- Add new flag UBC_ISMAPPED which tells ubc_uiomove() the object is mmap()ed
somewhere. Use it to decide whether to do direct-mapped copy, rather than
poking around directly in the vnode in ubc_uiomove(), which is ugly and
doesn't work for tmpfs. It would be nicer to contain all this in UVM but
the filesystem provides the needed locking here (VV_MAPPED) and to
reinvent that would suck more.

- Rename UBC_UNMAP_FLAG() to UBC_VNODE_FLAGS(). Pass in UBC_ISMAPPED where
appropriate.
 1.127  18-Apr-2020  christos Extended attribute support for ffsv2, from FreeBSD.
 1.126  23-Feb-2020  ad branches: 1.126.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.125  10-Dec-2018  jdolecek branches: 1.125.6;
make UFS_WAPBL_JLOCK_ASSERT() #ifdef DIAGNOSTIC, same as the underlying
function KASSERT(), so that it actually does something; fix code using
it to actually pass correct params, so that it compiles

remove UFS_WAPBL_JUNLOCK_ASSERT(), as that is inherently racy (it's
okay on those places if the rwlock is held by other lwp); depend
on the RW_ASSERT()/LOCKDEBUG inside rw_enter() to catch the case
with wapbl rwlock held by current lwp
 1.124  18-Mar-2017  riastradh branches: 1.124.12; 1.124.14;
#if DIAGNOSTIC panic ---> KASSERT
 1.123  11-Nov-2016  hannken branches: 1.123.2;
Fix a "slight tweak" from Rev. 1.121: bap1/bap2 must be valid
before using BAP_ASSIGN().

Prevents NULL pointer dereference when "lastbn >= 0".
 1.122  10-Nov-2016  jdolecek during truncate with wapbl, register deallocation for upper indirect block
before recursing into lower blocks, to make sure that it will be removed after
all its referenced blocks are removed

fixes 'ffs_blkfree_common: freeing free block' panic triggered by
ufs_truncate_retry() when just the upper indirect block registration failed,
code tried to free the lower blocks again after wapbl flush

problem found by hannken@, thank you
 1.121  10-Nov-2016  jdolecek ffs_indirtrunc(): for !wapbl, restore rev 1.117 behavior of writing the zeroed
(indirect) block before freeing the referenced blocks; it's necessary for
fsck to recover the filesystem, if system goes down during truncate

patch courtesy of hannken@ with only sligh tweaks
 1.120  07-Nov-2016  jdolecek fix broken test for partial truncate, introduced in rev 1.118

PR kern/51601 kern/51602
 1.119  07-Nov-2016  jdolecek reduce diff vs 1.117, no functional change
 1.118  28-Oct-2016  jdolecek reorganize ffs_truncate()/ffs_indirtrunc() to be able to partially
succeed; change wapbl_register_deallocation() to return EAGAIN
rather than panic when code hits the limit

callers changed to either loop calling ffs_truncate() using new
utility ufs_truncate_retry() if their semantics requires it, or
just ignore the failure; remove ufs_wapbl_truncate()

this fixes possible user-triggerable panic during truncate, and
resolves WAPBL performance issue with truncates of large files

PR kern/47146 and kern/49175
 1.117  28-Mar-2015  maxv branches: 1.117.2;
Remove the 'cred' argument from bread(). Remove a now unused var in
ffs_snapshot.c. Update the man page accordingly.

ok hannken@
 1.116  20-Oct-2013  htodd branches: 1.116.6;
Definining needswap where needed.
 1.115  23-Jun-2013  dholland branches: 1.115.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.114  23-Jun-2013  dholland fsbtodb() -> FFS_FSBTODB(), EXT2_FSBTODB(), or MFS_FSBTODB()
dbtofsb() -> FFS_DBTOFSB() or EXT2_DBTOFSB()

(Christos already did the lfs ones a few days back)
 1.113  19-Jun-2013  dholland Rename ambiguous macros:
MAXDIRSIZE -> UFS_MAXDIRSIZE or LFS_MAXDIRSIZE
NINDIR -> FFS_NINDIR, EXT2_NINDIR, LFS_NINDIR, or MFS_NINDIR
INOPB -> FFS_INOPB, LFS_INOPB
INOPF -> FFS_INOPF, LFS_INOPF
blksize -> ffs_blksize, ext2_blksize, or lfs_blksize
sblksize -> ffs_blksize

These are not the only ambiguously defined filesystem macros, of
course, there's a pile more. I may not have found all the ambiguous
definitions of blksize(), too, as there are a lot of other things
called 'blksize' in the system.
 1.112  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.111  20-Dec-2012  hannken Change bread() and breadn() to never return a buffer on
error and modify all callers to not brelse() on error.

Welcome to 6.99.16

PR kern/46282 (6.0_BETA crash: msdosfs_bmap -> pcbmap -> bread -> bio_doread)
 1.110  09-Jul-2012  matt branches: 1.110.2;
Convert a KDASSERT to a KDASSERTMSG
 1.109  27-Jan-2012  para converting readdir in ffs ext2fs from malloc(9) to kmem(9)
while there allocate ufs mount structs from kmem(9) too
preceding kmem-vmem-pool-patch

releng@ acknowledged
 1.108  23-Nov-2011  bouyer branches: 1.108.2;
If ufs_balloc_range() fails, make sure to call ?fs_truncate() to
reset v_writesize to the right value.
If v_writesize is left larger than the allocated blocks, we may have
the same issue as the one described in
http://mail-index.netbsd.org/tech-kern/2010/02/02/msg007156.html
 1.107  16-Jun-2011  hannken branches: 1.107.2;
Rename uvm_vnp_zerorange(struct vnode *, off_t, size_t) to
ubc_zerorange(struct uvm_object *, off_t, size_t, int) changing
the first argument to an uvm_object and adding a flags argument.

Modify tmpfs_reg_resize() to zero the backing store (aobj) instead
of the vnode. Ubc_purge() no longer panics when unmounting tmpfs.

Keep uvm_vnp_zerorange() until the next kernel version bump.
 1.106  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.105  06-Mar-2011  bouyer branches: 1.105.2;
merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.
 1.104  07-Feb-2010  bouyer branches: 1.104.4; 1.104.6; 1.104.8;
- ufs_balloc_range(): on error, only PG_RELEASED the pages that were
allocated to extend the file to the new size. Releasing all pages
may release pages that contains previously-written data not yet flushed
to disk. Should fix PR kern/35704
- {ffs,lfs,ext2fs}_truncate(): Even if the inode's size is the same as
the new length, call uvm_vnp_setsize(). *_truncate() may have been
called by *_write() in the error path (e.g. block allocation failure
because of quota of file system full), and at this point v_writesize
has been set to the desired size of the file and not reverted to the
old size. Not adjusting v_writesize to the real size cause
genfs_do_io() to write to disk past the real end of the file.
 1.103  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.102  15-Jan-2009  pooka branches: 1.102.2;
Revert 1.101, author did not provide a justification.
 1.101  23-Dec-2008  cegger ffs_update: sprinkle KASSERTs
 1.100  17-Dec-2008  cegger kill MALLOC and FREE macros.
 1.99  30-Aug-2008  hannken branches: 1.99.2; 1.99.4; 1.99.10;
ffs_truncate() always runs with journal locked. Propagate this information
to VOP_PUTPAGES().

Report from Lars Nordlund on current-users@
 1.98  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.97  03-Jun-2008  hannken branches: 1.97.2; 1.97.4;
ufs/ffs: replace calls to getblk() with ffs_getblk(). Now all buffers
have been run through copy-on-write and async mounts work again.

Fixes PR kern/38820

Reviewed by: YAMAMOTO Takashi <yamt@netbsd.org>
 1.96  16-May-2008  hannken Make sure all cached buffers with valid, not yet written data have been
run through copy-on-write. Call fscow_run() with valid data where possible.

The LP_UFSCOW hack is no longer needed to protect ffs_copyonwrite() against
endless recursion.

- Add a flag B_MODIFY to bread(), breada() and breadn(). If set the caller
intends to modify the buffer returned.

- Always run copy-on-write on buffers returned from ffs_balloc().

- Add new function ffs_getblk() that gets a buffer, assigns a new blkno,
may clear the buffer and runs copy-on-write. Process possible errors
from getblk() or fscow_run(). Part of PR kern/38664.

Welcome to 4.99.63

Reviewed by: YAMAMOTO Takashi <yamt@netbsd.org>
 1.95  27-Mar-2008  ad branches: 1.95.2; 1.95.4; 1.95.6;
Make rusage collection per-LWP and collate in the appropriate places.
cloned threads need a little bit more work but the locking needs to
be fixed first.
 1.94  09-Jan-2008  ad branches: 1.94.6;
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.93  02-Jan-2008  ad Merge vmlocking2 to head.
 1.92  08-Dec-2007  pooka branches: 1.92.4;
Remove cn_lwp from struct componentname. curlwp should be used
from on. The NDINIT() macro no longer takes the lwp parameter and
associates the credentials of the calling thread with the namei
structure.
 1.91  08-Dec-2007  ad Grab ump->um_lock in another spot.
 1.90  26-Nov-2007  pooka branches: 1.90.2;
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.89  08-Oct-2007  ad branches: 1.89.4;
Merge ffs locking & brelse changes from the vmlocking branch.
 1.88  10-Jul-2007  hannken branches: 1.88.6; 1.88.8; 1.88.10;
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@
 1.87  05-Jun-2007  yamt 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.86  04-Mar-2007  christos branches: 1.86.2; 1.86.4; 1.86.6;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.85  17-Oct-2006  yamt branches: 1.85.4;
ffs_truncate: don't forget to zero the past eof in the case of
blocksize < pagesize. PR/33777 from Simon Burge.
XXX check other filesystems, esp. lfs.
 1.84  14-Oct-2006  yamt don't use g_glock directly.
 1.83  23-Jun-2006  yamt branches: 1.83.4; 1.83.6;
fix a simonb-timecounters regression.
the precision of getnanotime() is not suitable for file timestamps.
esp. when it's nfs-exported.

- introduce vfs_timestamp().
(the name is from freebsd. currently merely a wrapper of nanotime())
- for ufs-like filesystems, use it rather than getnanotime().

XXX check other filesystems.
 1.82  07-Jun-2006  kardel branches: 1.82.2;
merge FreeBSD timecounters from branch simonb-timecounters
- struct timeval time is gone
time.tv_sec -> time_second
- struct timeval mono_time is gone
mono_time.tv_sec -> time_uptime
- access to time via
{get,}{micro,nano,bin}time()
get* versions are fast but less precise
- support NTP nanokernel implementation (NTP API 4)
- further reading:
Timecounter Paper: http://phk.freebsd.dk/pubs/timecounter.pdf
NTP Nanokernel: http://www.eecis.udel.edu/~mills/ntp/html/kern.html
 1.81  14-May-2006  elad branches: 1.81.2;
integrate kauth.
 1.80  18-Mar-2006  bouyer Fix dead error condition, coverity ID 747.
 1.79  11-Dec-2005  christos branches: 1.79.4; 1.79.6; 1.79.8; 1.79.10; 1.79.12;
merge ktrace-lwp.
 1.78  11-Nov-2005  yamt - ignore truncation for VCHR/VBLK/VFIFO as it used to be
before yamt-vop merge. PR/32049 from Atsushi Onoe.
- reject setattr which attempts to change size of VLNK/VSOCK.
 1.77  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.76  27-Sep-2005  yamt branches: 1.76.2;
introduce "ufs_ops" and use it for ITIMES.
 1.75  12-Sep-2005  christos Add another KASSERT.
 1.74  12-Sep-2005  drochner move the new ffs_itimes() to a berr place -- ffs_subr.c is shared with
userland
 1.73  12-Sep-2005  christos Use nanotime() to update the time fields in filesystems. Convert the code
from macros to real functions. Original patch and review from chuq.
Note: ext2fs only keeps seconds in the on-disk inode, and msdosfs does not
have enough precision for all fields, so this is not very useful for those
two.
 1.72  15-Jul-2005  thorpej Use ANSI function decls.
 1.71  15-Aug-2004  mycroft branches: 1.71.12;
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.
 1.70  15-Aug-2004  mycroft 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.
 1.69  15-Aug-2004  mycroft Minor simplification to some arithmetic.
 1.68  15-Aug-2004  mycroft 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.
 1.67  14-Aug-2004  mycroft 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
 1.66  14-Aug-2004  mycroft There is no need to do a synchronous write when truncating a short symlink.
 1.65  14-Aug-2004  mycroft 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.
 1.64  20-Jun-2004  hannken 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>
 1.63  25-May-2004  hannken 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>
 1.62  25-Jan-2004  hannken 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.
 1.61  10-Jan-2004  yamt store a i/o priority hint in struct buf for buffer queue discipline.
 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  15-May-2003  kristerw The C language does not permit statements of the form
(X ? Y : Z) = 0;
even though gcc handles this by a stupid extension.

Transform these to correct C.

Approved by fvdl.
 1.56  10-Apr-2003  fvdl Remove some leftover diagnostic checks.
 1.55  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.54  25-Jan-2003  fvdl The oldblks and newblks arrays are used to store direct copies of
on-disk block pointers, so they should be int32_t. Error found
by Izumi Tsutsui.
 1.53  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.52  26-Sep-2002  simonb Move a brace that is in the wrong position when changes from FreeBSD
were added in rev 1.51. This may fix the "N lost blocks" problem some
people have noticed.
Reviewed by fvdl.
 1.51  18-Dec-2001  fvdl branches: 1.51.10;
Bring over fixes from FreeBSD that weren't incorporated yet, mainly
from Kirk McKusick. They implement taking pending block/inode frees
into account for the sake of correct statfs() numbers, and adding
a new softdep type (newdirblk) to correctly handle newly allocated
directory blocks.

Minor additional changes: 1) swap the newly introduced fs_pendinginodes
and fs_pendingblock fields in ffs_sb_swap, and 2) declare lkt_held
in the debug version of the softdep lock structure volatile, as it
can be modified from interrupt context #ifdef DEBUG.
 1.50  18-Dec-2001  chs when truncating a file, make sure the last block of the file is actually
allocated, since other parts of the code assume this.
 1.49  30-Nov-2001  chs VOP_PUTPAGES() requires page-aligned offsets, so be sure to provide such.
fixes PR 14759.

(while I'm here, call VOP_PUTPAGES() directly instead of indirecting through
the UVM pager op vector.)
 1.48  08-Nov-2001  chs in both paths that can cause fragments to be expanded (write and truncate-up),
deal with the fragment expansion separately before the rest of the operation.
this allows us to simplify ufs_balloc_range() by not worrying about implicit
fragment expansion.

call VOP_PUTPAGES() directly for vnodes instead of
going through the UVM pager "put" vector.
 1.47  06-Nov-2001  simonb Remove some bogus checks for unsigned variables < 0.
 1.46  30-Oct-2001  lukem add __KERNEL_RCSID()
 1.45  28-Sep-2001  chs branches: 1.45.2;
handle allocation errors in truncate-up case.
 1.44  20-Sep-2001  chs we can't assert that the inode and vnode sizes are consistent at the start
of ffs_truncate() since there are cases (eg. when ffs_write() gets ENOSPC)
where they should be different. move the assert to the end instead.
 1.43  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.42  30-Aug-2001  chs branches: 1.42.2;
min() -> MIN()
 1.41  30-May-2001  mrg branches: 1.41.4;
use _KERNEL_OPT
 1.40  27-Jan-2001  augustss branches: 1.40.2;
Fix from chuq:
don't update UVM's notion of the file size before the VOP_FSYNC() when
we're partially truncating a file with softdeps enabled. doing so could
free pages without updating the dependency info, which would result in
"panic: softdep_write_inodeblock: direct pointer #1 mismatch 0 != N".
 1.39  01-Jan-2001  matt Convert a MALLOC with a variable size to malloc(). Saves 220 bytes of text
on VAX.
 1.38  27-Nov-2000  chs Initial integration of the Unified Buffer Cache project.
 1.37  19-Sep-2000  fvdl Adapt for VOP_FSYNC parameter change.

Implement range fsync for FFS. Note: not yet implemented for the
SOFTDEP case.
 1.36  28-Jun-2000  mrg remove include of <vm/vm.h> and <uvm/uvm_extern.h>
 1.35  30-May-2000  mycroft branches: 1.35.2;
In ffs_update():
* Move the clearing of IN_MODIFIED and IN_ACCESSED later, so they are not
cleared if the bread() failed.
* Explicitly set waitfor to 0 in the softdep case, if IN_MODIFIED is not
set (mirroring the bwrite()/bdwrite() decision).
 1.34  29-May-2000  mycroft Add a new inode flags called IN_ACCESSED. This used in place of IN_MODIFIED
to record that the atime was updated. In ffs_update(), we only do synchronous
writes if something *other* than the atime was changed.
 1.33  28-May-2000  mycroft When unwinding a failed allocation, make sure to nuke the unwound block from
the vnode's block list. This fixes `itrunc3' panics (at least in some cases;
further testing is needed) and prevents further lossage later on.
 1.32  28-May-2000  mycroft Add a new function to remove extra buffers when truncating a file. This is
more generic than the vinvalbuf(V_SAVEMETA) case, avoiding synchronous
operations when truncating to a non-zero length.
 1.31  13-May-2000  perseant branches: 1.31.2;
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.30  30-Mar-2000  augustss Remove register declarations.
 1.29  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.28  24-Mar-1999  mrg branches: 1.28.4; 1.28.8; 1.28.10; 1.28.14;
completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
 1.27  05-Mar-1999  mycroft Pass null pointers to VOP_UPDATE rather than having all the callers fetch the
current time themselves.
 1.26  05-Mar-1999  mycroft Permit the access and modify time pointers passed to VOP_UPDATE to be null,
meaning the current time.
 1.25  12-Nov-1998  thorpej defopt FFS_EI
 1.24  23-Oct-1998  thorpej branches: 1.24.2;
Use DINODE_SIZE rather than pointer arithmetic.
 1.23  04-Oct-1998  christos Missed a conditional for FFS_EI; appears when we compile without -Ox
 1.22  09-Aug-1998  perry bzero->memset, bcopy->memcpy, bcmp->memcmp
 1.21  09-Jun-1998  scottr Protect various config(8)-generated files from inclusion while
building LKMs. Fixes PR 5557.
 1.20  08-Jun-1998  scottr Use the newly-defined opt_quota.h.
 1.19  18-Mar-1998  bouyer Add support for reading/writing FFS in non-native byte order, conditioned
to "options FFS_EI". The superblock and inodes (without blk addr) are
byteswapped at disk read/write time, other metadatas are byteswapped
when used (as they are acceeded directly in the buffer cache).
This required the addition of a "um_flags" field to struct ufsmount.
ffs_bswap.c contains superblock and inode byteswap routines also used
by userland utilities.
 1.18  01-Mar-1998  fvdl Merge with Lite2 + local changes
 1.17  10-Feb-1998  mrg - add defopt's for UVM, UVMHIST and PMAP_NEW.
- remove unnecessary UVMHIST_DECL's.
 1.16  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.15  04-Jul-1997  drochner Don't cast 64bit (off_t) file sizes to vm_offset_t (32bit on many
architectures), truncate them intelligently instead.
The truncation is done centralized in vnode_pager.c.
This prevents from wrap-over effects when parts of large (>2^32 byte) files
are mmapped.
Don't allow to mmap above the numerical range of vm_offset_t.
This is considered a temporary solution until the vm system handles the
object sizes/offsets more cleanly.
 1.14  11-Jun-1997  bouyer Add support for ext2fs, this needed a few modifications to ufs/ufs/inode.h:
- added an "union inode_ext" to struct inode, for the per-fs extentions.
For now only ext2fs uses it.
- i_din is now an union:
union {
struct dinode ffs_din; /* 128 bytes of the on-disk dinode. */
struct ext2fs_dinode e2fs_din; /* 128 bytes of the on-disk dinode. */
} i_din
Added a lot of #define i_ffs_* and i_e2fs_* to access the fields.
- Added two macros: FFS_ITIMES and EXT2FS_ITIMES. ITIMES calls the rigth
macro, depending on the time of the inode. ITIMES is used where necessary,
FFS_ITIMES and EXT2FS_ITIMES in other places.
 1.13  27-Jan-1997  tls Correct old inode flag names in comment, and reformat for 80 character screen
 1.12  06-Nov-1996  thorpej Performance enhancement from Kirk McKusick <mckusick@McKusick.COM>:
When freeing an indirect block, there is no need to write it (synchronously,
no less!) before tossing it.
 1.11  01-Sep-1996  mycroft Add a set of generic file system operations that most file systems use.
Also, fix some time stamp bogosities.
 1.10  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.9  09-Feb-1996  christos ffs prototypes
 1.8  15-Jun-1995  cgd compensate for timeval/timespec/stat structure changes.
 1.7  14-Dec-1994  mycroft Sync with CSRG.
 1.6  28-Oct-1994  mycroft Don't allow truncating past maxfilesize.
 1.5  29-Jun-1994  cgd branches: 1.5.2;
New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'
 1.4  15-Jun-1994  mycroft Fastlink compat.
 1.3  13-Jun-1994  mycroft Format police.
 1.2  13-Jun-1994  pk Check requested file size; negative values cause havoc.
 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.5.2.2  23-Nov-1994  cgd from mycroft, for patch_05
 1.5.2.1  19-Oct-1994  cgd temporary sanity checks, as suggested by charles.
 1.24.2.3  30-May-1999  chs update call to ffs_balloc() for new args.
fix an uninitialize variable in ffs_truncate().
 1.24.2.2  25-Feb-1999  chs add UBC stuff to ffs_truncate().
 1.24.2.1  09-Nov-1998  chs initial snapshot. lots left to do.
 1.28.14.2  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.28.14.1  21-Dec-1999  wrstuden Initial commit of recent changes to make DEV_BSIZE go away.

Runs on i386, needs work on other arch's. Main kernel routines should be
fine, but a number of the stand programs need help.

cd, fd, ccd, wd, and sd have been updated. sd has been tested with non-512
byte block devices. vnd, raidframe, and lfs need work.

Non 2**n block support is automatic for LKM's and conditional for kernels
on "options NON_PO2_BLOCKS".
 1.28.10.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.28.10.1  19-Oct-1999  fvdl Bring in Kirk McKusick's FFS softdep code on a branch.
 1.28.8.4  11-Feb-2001  bouyer Sync with HEAD.
 1.28.8.3  05-Jan-2001  bouyer Sync with HEAD
 1.28.8.2  08-Dec-2000  bouyer Sync with HEAD.
 1.28.8.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.28.4.3  31-Jul-1999  chs simplify ffs_truncate().
 1.28.4.2  11-Jul-1999  chs remove uvm_vnp_uncache(), it's no longer needed.
 1.28.4.1  07-Jun-1999  chs merge everything from chs-ubc branch.
 1.31.2.1  22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.35.2.3  26-Feb-2002  he Apply patch (requested by fvdl):
Fix a panic in the FFS sofdep code on an NFS server triggered by
an excerciser program run on an NFS client.
 1.35.2.2  30-Sep-2001  he Apply patch (requested by chuck):
Make one call to uvm_vnp_uncache() conditional. Fixes a panic
when removing an mmap'ing to an unlinked, closed file.
 1.35.2.1  14-Dec-2000  he Pull up revision 1.37 (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.40.2.9  18-Oct-2002  nathanw Catch up to -current.
 1.40.2.8  12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.40.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.40.2.6  08-Jan-2002  nathanw Catch up to -current.
 1.40.2.5  14-Nov-2001  nathanw Catch up to -current.
 1.40.2.4  08-Oct-2001  nathanw Catch up to -current.
 1.40.2.3  21-Sep-2001  nathanw Catch up to -current.
 1.40.2.2  21-Jun-2001  nathanw Catch up to -current.
 1.40.2.1  05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.41.4.3  10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.41.4.2  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.41.4.1  13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.42.2.1  01-Oct-2001  fvdl Catch up with -current.
 1.45.2.1  12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.51.10.1  24-Jun-2003  grant Pull up revision 1.52 (requested by nakayama in ticket #1333):

Move a brace that is in the wrong position when changes from FreeBSD
were added in rev 1.51. This may fix the "N lost blocks" problem some
people have noticed.
Reviewed by fvdl.
 1.59.2.7  11-Dec-2005  christos Sync with head.
 1.59.2.6  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.59.2.5  21-Sep-2004  skrll Fix the sync with head I botched.
 1.59.2.4  18-Sep-2004  skrll Sync with HEAD.
 1.59.2.3  25-Aug-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.71.12.6  21-Jan-2008  yamt sync with head
 1.71.12.5  07-Dec-2007  yamt sync with head
 1.71.12.4  27-Oct-2007  yamt sync with head.
 1.71.12.3  03-Sep-2007  yamt sync with head.
 1.71.12.2  30-Dec-2006  yamt sync with head.
 1.71.12.1  21-Jun-2006  yamt sync with head.
 1.76.2.2  29-Oct-2005  yamt use ffs_* directly rather than via ufs_ops.
suggested by Chuck Silvers.
 1.76.2.1  20-Oct-2005  yamt adapt ufs.
 1.79.12.2  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.79.12.1  28-Mar-2006  tron Merge 2006-03-28 NetBSD-current into the "peter-altq" branch.
 1.79.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.79.10.2  19-Apr-2006  elad sync with head.
 1.79.10.1  08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.79.8.3  26-Jun-2006  yamt sync with head.
 1.79.8.2  24-May-2006  yamt sync with head.
 1.79.8.1  01-Apr-2006  yamt sync with head.
 1.79.6.4  01-Jun-2006  kardel Sync with head.
 1.79.6.3  22-Apr-2006  simonb Sync with head.
 1.79.6.2  05-Feb-2006  simonb In the *itimes functions, just call getnanotime() at the start of
the function and use the result if needed, rather than the previous
conditional calls/assignments method. The code is clearer this way,
and benchmarks at about the same speed.
 1.79.6.1  04-Feb-2006  simonb Adapt for timecounters: mostly use get*time() and use "time_second"
instead of "time.tv_sec".
 1.79.4.1  09-Sep-2006  rpaulo sync with head
 1.81.2.1  19-Jun-2006  chap Sync with head.
 1.82.2.1  13-Jul-2006  gdamore Merge from HEAD.
 1.83.6.1  22-Oct-2006  yamt sync with head
 1.83.4.1  18-Nov-2006  ad Sync with head.
 1.85.4.1  12-Mar-2007  rmind Sync with HEAD.
 1.86.6.1  09-Dec-2007  reinoud Pullup to HEAD
 1.86.4.1  11-Jul-2007  mjf Sync with head.
 1.86.2.6  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.2.5  15-Jul-2007  ad Sync with head.
 1.86.2.4  09-Jun-2007  ad Sync with head.
 1.86.2.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.2.2  13-Apr-2007  ad Put a per-mount lock around ffs shared data structures, excluding softdep
and quotas. Strategy lifted from FreeBSD.
 1.86.2.1  13-Mar-2007  ad Pull in the initial set of changes for the vmlocking branch.
 1.88.10.1  14-Oct-2007  yamt sync with head.
 1.88.8.3  23-Mar-2008  matt sync with HEAD
 1.88.8.2  09-Jan-2008  matt sync with HEAD
 1.88.8.1  06-Nov-2007  matt sync with HEAD
 1.88.6.3  09-Dec-2007  jmcneill Sync with HEAD.
 1.88.6.2  27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.88.6.1  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.3  18-Feb-2008  mjf Sync with HEAD.
 1.89.4.2  27-Dec-2007  mjf Sync with HEAD.
 1.89.4.1  08-Dec-2007  mjf Sync with HEAD.
 1.90.2.4  30-Dec-2007  ad ffs_update: if softdep and the inode has been unlinked, wait for the update
(and so dependencies) to flush. Ensures that the slate is clean when the
inode is reused. Should work around "panic: handle_written_inodeblock:
filefree".
 1.90.2.3  26-Dec-2007  ad Sync with head.
 1.90.2.2  08-Dec-2007  ad Sync with head.
 1.90.2.1  04-Dec-2007  ad Pull the vmlocking changes into a new branch.
 1.92.4.2  10-Jan-2008  bouyer Sync with HEAD
 1.92.4.1  02-Jan-2008  bouyer Sync with HEAD
 1.94.6.5  17-Jan-2009  mjf Sync with HEAD.
 1.94.6.4  28-Sep-2008  mjf Sync with HEAD.
 1.94.6.3  05-Jun-2008  mjf Sync with HEAD.

Also fix build.
 1.94.6.2  02-Jun-2008  mjf Sync with HEAD.
 1.94.6.1  03-Apr-2008  mjf Sync with HEAD.
 1.95.6.2  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.95.6.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.95.4.2  11-Mar-2010  yamt sync with head
 1.95.4.1  04-May-2009  yamt sync with head.
 1.95.2.2  04-Jun-2008  yamt sync with head
 1.95.2.1  18-May-2008  yamt sync with head.
 1.97.4.1  19-Oct-2008  haad Sync with HEAD.
 1.97.2.2  12-Jun-2008  martin License police
 1.97.2.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.10.1  21-Apr-2010  matt sync to netbsd-5
 1.99.4.2  25-Jan-2012  riz Pull up following revision(s) (requested by bouyer in ticket #1702):
sys/ufs/lfs/lfs_inode.c: revision 1.126
sys/ufs/ffs/ffs_inode.c: revision 1.108
If ufs_balloc_range() fails, make sure to call ?fs_truncate() to
reset v_writesize to the right value.
If v_writesize is left larger than the allocated blocks, we may have
the same issue as the one described in
http://mail-index.netbsd.org/tech-kern/2010/02/02/msg007156.html
 1.99.4.1  22-Feb-2010  snj Pull up following revision(s) (requested by bouyer in ticket #1302):
sys/ufs/ext2fs/ext2fs_inode.c: revision 1.71
sys/ufs/ffs/ffs_inode.c: revision 1.104
sys/ufs/lfs/lfs_inode.c: revision 1.121
sys/ufs/ufs/ufs_inode.c: revision 1.79
- ufs_balloc_range(): on error, only PG_RELEASED the pages that were
allocated to extend the file to the new size. Releasing all pages
may release pages that contains previously-written data not yet flushed
to disk. Should fix PR kern/35704
- {ffs,lfs,ext2fs}_truncate(): Even if the inode's size is the same as
the new length, call uvm_vnp_setsize(). *_truncate() may have been
called by *_write() in the error path (e.g. block allocation failure
because of quota of file system full), and at this point v_writesize
has been set to the desired size of the file and not reverted to the
old size. Not adjusting v_writesize to the real size cause
genfs_do_io() to write to disk past the real end of the file.
 1.99.2.2  03-Mar-2009  skrll Sync with HEAD.
 1.99.2.1  19-Jan-2009  skrll Sync with HEAD.
 1.102.2.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.104.8.1  20-Jan-2011  bouyer Snapshot of work in progress on a modernised disk quota system:
- new quotactl syscall (versionned for backward compat), which takes
as parameter a path to a mount point, and a prop_dictionary
(in plistref format) describing commands and arguments.
For each command, status and data are returned as a prop_dictionary.
quota commands features will be added to take advantage of this,
exporting quota data or getting quota commands as plists.

- new on disk-format storage (all 64bit wide), integrated to metadata for
ffs (and playing nicely with wapbl).
Quotas are enabled on a ffs filesystem via superblock flags.
tunefs(8) can enable or disable quotas.
On a quota-enabled filesystem, fsck_ffs(8) will track per-uid/gid
block and inode usages, and will check and update quotas in Pass 6.
quota usage and limits are stored in unliked files (one for users,
one for groups)l fsck_ffs(8) will create the files if needed, or
free them if needed. This means that after enabling or disabling
quotas on a filesystem; a fsck_ffs(8) run is required.
quotacheck(8) is not needed any more, on a unclean shutdown
fsck or journal replay will take care of fixing quotas.
newfs(8) can create a ready-to-mount quota-enabled filesystem
(superblock flags are set and quota inodes are created).
Other new features or semantic changes:
- default quota datas, applied to users or groups which don't already
have a quota entry
- per-user/group grace time (instead of a filesystem global one)
- 0 really means "nothing allowed at all", not "no limit".
If you want "no limit", set the limit to UQUAD_MAX (tools will
understand "unlimited" and "-")

A quota file is structured as follow:
it starts with a header, containing a few per-filesystem values,
and the default quota limits.
Quota entries are linked together as a simple list, each entry has a
pointer (as an offset withing the file) to the next.
The header has a pointer to a list of free quota entries, and
a hash table of in-use entries. The size of the hash table depends
on the filesystem block size (header+hash table should fit in the
first block). The file is not sparse and is a multiple of
filesystem block size (when the free quota entry list is empty a new
filesystem block is allocated). quota entries to not cross
filesystem block boundaries.

In memory, the kernel keeps a cache of recently used quota entries
as a reference to the block number, and offset withing the block.
The quota entry itself is keept in the buf cache.

fsck_ffs(8), tunefs(8) and newfs(8) supports are completed (with
related atf tests :)
The kernel can update disk usage and report it via quotactl(2).

Todo: enforce quotas limits (limits are not checked by kernel yet)
update repquota, edquota and rpc.rquotad to the new world
implement compat_50_quotactl ioctl.
update quotactl(2) man page

fsck_ffs required fixes so that allocating new blocks or inodes will
properly update the superblock and cg sumaries. This was not an issue up
to now because superblock and cg sumaries check happened last, but now
allocations or frees can happen in pass 6.
 1.104.6.1  06-Jun-2011  jruoho Sync with HEAD.
 1.104.4.2  21-Apr-2011  rmind sync with head
 1.104.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.105.2.1  23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.107.2.4  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.107.2.3  23-Jan-2013  yamt sync with head
 1.107.2.2  30-Oct-2012  yamt sync with head
 1.107.2.1  17-Apr-2012  yamt sync with head
 1.108.2.1  18-Feb-2012  mrg merge to -current.
 1.110.2.4  03-Dec-2017  jdolecek update from HEAD
 1.110.2.3  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.110.2.2  23-Jun-2013  tls resync from head
 1.110.2.1  25-Feb-2013  tls resync with head
 1.115.2.1  18-May-2014  rmind sync with head
 1.116.6.3  28-Aug-2017  skrll Sync with HEAD
 1.116.6.2  05-Dec-2016  skrll Sync with HEAD
 1.116.6.1  06-Apr-2015  skrll Sync with HEAD
 1.117.2.3  20-Mar-2017  pgoyette Sync with HEAD
 1.117.2.2  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.117.2.1  04-Nov-2016  pgoyette Sync with HEAD
 1.123.2.1  21-Apr-2017  bouyer Sync with HEAD
 1.124.14.3  21-Apr-2020  martin Sync with HEAD
 1.124.14.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.124.14.1  10-Jun-2019  christos Sync with HEAD
 1.124.12.1  26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.125.6.1  29-Feb-2020  ad Sync with head.
 1.126.4.2  25-Apr-2020  bouyer Sync with bouyer-xenpvh-base2 (HEAD)
 1.126.4.1  20-Apr-2020  bouyer Sync with HEAD

RSS XML Feed