Home | History | Annotate | Download | only in tmpfs
History log of /src/sys/fs/tmpfs/tmpfs.h
RevisionDateAuthorComments
 1.56  17-May-2020  ad PR kern/55268: tmpfs is slow

tmpfs_getpages(): handle the PGO_LOCKED case and implement lazy update of
atime/mtime.
 1.55  19-Apr-2018  christos s/static inline/static __inline/g for consistency.
 1.54  01-Mar-2017  hannken branches: 1.54.12;
Change the protocol to update a mounted file system from read-write
to read-only and vice versa:

- Add an internal flag IMNT_WANTRDONLY.
- Set either IMNT_WANTRDWR or IMNT_WANTRDONLY if going from or to read-only.
- After successfull call to VFS_MOUNT() set or clear MNT_RDONLY.

Adapt tmpfs and rumpfs to the new protocol. Other file systems will be
updated when they get the IMNT_CAN_RWTORO property.

Welcome to 7.99.64
 1.53  27-Jan-2017  hannken Run vflush() when going from read/write to read only.
 1.52  06-Jul-2015  hannken branches: 1.52.2; 1.52.4;
Change tmpfs to vcache.
- Use tmpfs node address as key.
- Remove tn_vlock, field tn_vnode now protected by vcache.
- Add a hold count to tmpfs node to prevent nodes from disappearing
while tmpfs_fhtovp() trys to vcache_get() them. Last holder
destroys reclaimed nodes.
- Remove the now unneeded parent unlock/lock for lookup of '..'.
 1.51  06-Jul-2015  hannken Use VFS_PROTOS() for tmpfs.
 1.50  07-Jun-2014  martin branches: 1.50.4;
Remove the hardcoded 4 MB free kernel memory limit and replace it
by uvmexp.freetarg, as discussed on tech-kern.
Main purpose is to make tmpfs usable (as far as possible) on small memory
machines.
This is a bit experimental, but we need to give it some real world exposure
to see how well it works.
 1.49  30-Apr-2014  christos handle MNT_UPDATE
 1.48  23-Nov-2013  rmind branches: 1.48.2;
- Simplify tmpfs_update(), eliminate tmpfs_note_t::tn_status and deferred
timestamp updates. Fix some incorrect updates and plug some missing ones.
Should fix PR/48385.
- tmpfs_rmdir: avoid O(n) scan when the directory is not empty and whiteout
entries were never added.
 1.47  18-Nov-2013  rmind Make tmpfs_node_t::tn_gen a 32-bit number, keep it in sync with tmpfs_fid_t.
Also, change tn_status to unsigned while here.
 1.46  08-Nov-2013  rmind tmpfs: replace the broken tmpfs_dircookie() logic which uses the node
address truncated to 31 bits (required for 32-bit readdir compatibility,
e.g. linux32). Instead, assign 2^31 range using the following logic:
- The first half of the 2^31 is assigned incrementally (the fast path).
- When exceeded, use the second half of 2^31, but manage with vmem(9).

It will require 2 billion files per-directory to trigger vmem(9) usage.
Also, while here, add some fixes for tmpfs_unmount().

Should fix PR/47739, PR/47480, PR/46088 and PR/41068.
Thanks to wiz@ for stress testing.
 1.45  27-Sep-2011  christos branches: 1.45.2; 1.45.12; 1.45.16;
define and use TMPFS_MAXNAMLEN instead of MAXNAMLEN
 1.44  29-May-2011  rmind - Rework and document inode reference counting. Also document inode life
cycle (destruction part). Perform link counting in tmpfs_dir_attach()
and tmpfs_dir_detach(), instead of alloc/free and arbitrary places.
Fixes PR/44285, PR/44288, PR/44657 and likely PR/42484.

- Fix the race between the lookup and inode destruction. Fixes PR/43167
and its duplicates PR/40088, PR/40757.

- Improve tmpfs_rename() locking a little, fix kqueue event notifications
and also fix PR/43617. Add simplistic tmpfs_parentcheck_p(); to be
expanded and used for further rename() locking fixes.

- Cache directory entry "hint" in the tmpfs node, add tmpfs_dir_cached(),
and thus avoid unnecessary lookup in tmpfs_remove() and tmpfs_rmdir().

- Set correct _PC_FILESIZEBITS value in tmpfs_pathconf(). Fixes PR/43576.

- Few minor fixes.
 1.43  29-May-2011  christos undo the multiple inclusion protection part.
 1.42  29-May-2011  rmind - Prevent tmpfs.h from inclusion in userland.
- Clean up and KNF tmpfs.h a little bit.
 1.41  24-May-2011  rmind - Describe some locking.
- Add VOP argument comments, add some asserts.
- Update/fix/remove outdated/missleading comments.
- Clean up, de-indent, KNF, misc.

No functional changes intended.
 1.40  19-May-2011  rmind - tmpfs: do not create dirent/node pools per-mount, there is no need to.
- tmpfs_mount: fix a leak of mount structures in error path.
 1.39  13-Jan-2011  pooka branches: 1.39.2;
Add some support for unionfs (not built by default). It's still
missing at least opaque directory support, but until someone figures
out how that should work on ffs (see PR kern/kern/44383), there's
no point in trying to figure out how it should work here.
 1.38  22-Jun-2010  rmind Replace tmpfs_pool custom allocator code with a simpler layer for memory
accounting. Use wired memory (which can be limited) for meta-data, and
kmem(9) for string allocations.

Close PR/31944. Fix PR/38361 while here. OK ad@.
 1.37  29-Jul-2008  pooka branches: 1.37.14; 1.37.16;
Solve the fstat-wants-to-look-at-kernel-data-structures in a nicer
way: don't export the fs internals to innocent userspace programs
which just want to mount the file system.
 1.36  28-Jul-2008  pooka shuffle around some more defs for fstat

noticed by Kurt Schreiner on current-users
 1.35  28-Jul-2008  pooka Install mount argument structure header just like every other file system.
 1.34  19-Jun-2008  christos branches: 1.34.2;
- setting the birthdate is valid in setattr.
- don't call nanotime if not needed.
- don't call tempfs_update() if tempfs_chtimes succeeded, because it just did.
 1.33  28-Apr-2008  martin branches: 1.33.2; 1.33.4;
Remove clause 3 and 4 from TNF licenses
 1.32  06-Feb-2008  jmmv branches: 1.32.6; 1.32.8; 1.32.10;
u_int is not a C99 standard type, so spell it out completely as
unsigned int.
 1.31  06-Feb-2008  jmmv Drop trailing whitespace.
 1.30  02-Jan-2008  ad Merge vmlocking2 to head.
 1.29  08-Dec-2007  pooka branches: 1.29.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.28  10-Nov-2007  ad branches: 1.28.2;
Back out the tmpfs changes; there appears to be a bug lurking.
 1.27  06-Nov-2007  ad Merge from vmlocking.
 1.26  22-Feb-2007  thorpej branches: 1.26.4; 1.26.16; 1.26.18; 1.26.24;
TRUE -> true, FALSE -> false
 1.25  21-Feb-2007  thorpej Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.
 1.24  13-Nov-2006  jmmv branches: 1.24.4;
Fix typo in comment.
 1.23  05-Nov-2006  jmmv Protect the dircookie stuff with _KERNEL. Fixes build problems of
mount_tmpfs as reported by Hisashi T Fujinaka in private mail.
 1.22  05-Nov-2006  jmmv Truncate directory cookies to 31 bits to avoid problems exposed in Linux
binaries which cast the returned values to 64-bits and fail due to sign
expansion. More details are provided in the big comment in tmpfs.h that
describes how the new tmpfs_dircookie works.

This is a rather ugly hack that shall be fixed with a cleaner solution,
but this resolves the problem in an effective way.

Fixes kern PR/32034.
 1.21  23-Jul-2006  ad branches: 1.21.4; 1.21.6;
Use the LWP cached credentials where sane.
 1.20  27-May-2006  yamt branches: 1.20.4;
hide more by ifdef _KERNEL.
 1.19  14-May-2006  elad branches: 1.19.2;
integrate kauth.
 1.18  31-Mar-2006  riz Swap the order of the tf_gen and tf_id members of struct tmpfs_fid,
since tf_id needs 8-byte alignment on some architectures (like amd64).
struct tmpfs_fid now fits in 16 bytes on amd64 again.
OK matt@
 1.17  26-Mar-2006  martin Restrict generation numbers to 32bit values - we would have had to bump
_VFS_MAXFIDSZ to 24 otherwise for 64bit archs.
 1.16  16-Feb-2006  perry branches: 1.16.2; 1.16.4; 1.16.6;
Change "inline" back to "__inline" in .h files -- C99 is still too
new, and some apps compile things in C89 mode. C89 keywords stay.

As per core@.
 1.15  16-Feb-2006  jmmv Do not use unnamed structures/unions without instances; they break the
build under vax because of gcc 2.95. Found by he@.
 1.14  10-Feb-2006  christos make the include files usable from userland.
 1.13  24-Dec-2005  jmmv branches: 1.13.2; 1.13.4; 1.13.6;
Remove a conditional by always using inlined functions in favour of macros.
This way, the code is clearer and there shouldn't be any performance
difference (if the compiler DTRT). Suggested by chs@.
 1.12  11-Dec-2005  christos merge ktrace-lwp.
 1.11  06-Dec-2005  yamt VFS_TO_TMPFS: remove a wrong assertion.
it's wrong because TMPFS_PAGES_MAX can be decreased.
 1.10  03-Dec-2005  christos - protect userland exported files against multiple inclusion.
- make sure that kernel only files don't compile in userland using #error
- XXX: some kernel only files still get installed.
- XXX: some files used in userland, don't get installed.
 1.9  02-Nov-2005  yamt branches: 1.9.2;
merge yamt-vop branch. remove following VOPs.

VOP_BLKATOFF
VOP_VALLOC
VOP_BALLOC
VOP_REALLOCBLKS
VOP_VFREE
VOP_TRUNCATE
VOP_UPDATE
 1.8  29-Sep-2005  jmmv branches: 1.8.2;
Implement the tmpfs_advlock operation. Makes "user-level" file locking
work (aka lockf(3)).
 1.7  28-Sep-2005  yamt tmpfs_getattr: return up-to-date timestamps.
 1.6  23-Sep-2005  jmmv Kill the tmpfs(9) manual page; it was just documenting internal details of
tmpfs' "API" and was already rotting.

Instead, merge all the relevant comments into the code. This includes
acknowledgements to Google's Summer of Code 2005 program (they were in the
AUTHORS section of tmpfs(9) before), so all the files need to be changed
to include this sentence alongside the title. (Note that this was not a
requirement of the program.)
 1.5  23-Sep-2005  jmmv Apply the NFS exports list rototill patch:

- Remove all NFS related stuff from file system specific code.
- Drop the vfs_checkexp hook and generalize it in the new nfs_check_export
function, thus removing redundancy from all file systems.
- Move all NFS export-related stuff from kern/vfs_subr.c to the new
file sys/nfs/nfs_export.c. The former was becoming large and its code
is always compiled, regardless of the build options. Using the latter,
the code is only compiled in when NFSSERVER is enabled. While doing this,
also make some functions in nfs_subs.c conditional to NFSSERVER.
- Add a new command in nfssvc(2), called NFSSVC_SETEXPORTSLIST, that takes a
path and a set of export entries. At the moment it can only clear the
exports list or append entries, one by one, but it is done in a way that
allows setting the whole set of entries atomically in the future (see the
comment in mountd_set_exports_list or in doc/TODO).
- Change mountd(8) to use the nfssvc(2) system call instead of mount(2) so
that it becomes file system agnostic. In fact, all this whole thing was
done to remove a 'XXX' block from this utility!
- Change the mount*, newfs and fsck* userland utilities to not deal with NFS
exports initialization; done internally by the kernel when initializing
the NFS support for each file system.
- Implement an interface for VFS (called VFS hooks) so that several kernel
subsystems can run arbitrary code upon receipt of specific VFS events.
At the moment, this only provides support for unmount and is used to
destroy NFS exports lists from the file systems being unmounted, though it
has room for extension.

Thanks go to yamt@, chs@, thorpej@, wrstuden@ and others for their comments
and advice in the development of this patch.
 1.4  15-Sep-2005  yamt change the way to handle directory "offsets" so that
they won't be changed when removing entries in the directory.
some applications like cvs rely on this.
 1.3  13-Sep-2005  yamt - don't waste/leak kva.
- implement getpages/putpages. support mmap.
- eliminate meaningless memcpy.
- ubcify.
 1.2  10-Sep-2005  jmmv wiz@ remembers that the preferred way to spell file-system in NetBSD is
file system.
 1.1  10-Sep-2005  jmmv Initial addition of tmpfs, an efficient memory file-system. This project
was developed as part of Google's Summer of Code 2005 program. This
change adds the kernel code, the mount_tmpfs utility, a regression test
suite and does all other related changes to integrate these.

The file-system is still *experimental*. Therefore, it is disabled by
default in all kernels. However, as typically done, a commented-out
entry is added in them to ease its setup.

Note that I haven't commited the required mountd(8) changes to be able
to export tmpfs file-systems because NFS support is still very unstable
and because, before enabling it, I'd like to do some other changes.

OK'ed by my project mentor, William Studenmund (wrstuden@).
 1.8.2.2  29-Oct-2005  yamt as tmpfs_update never fails, make it return void.
suggested by Chuck Silvers.
 1.8.2.1  20-Oct-2005  yamt adapt tmpfs.
 1.9.2.4  11-Dec-2005  christos Sync with head.
 1.9.2.3  12-Nov-2005  skrll Adapt to branch
 1.9.2.2  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.9.2.1  02-Nov-2005  skrll file tmpfs.h was added on branch ktrace-lwp on 2005-11-10 14:09:44 +0000
 1.13.6.2  01-Jun-2006  kardel Sync with head.
 1.13.6.1  22-Apr-2006  simonb Sync with head.
 1.13.4.1  09-Sep-2006  rpaulo sync with head
 1.13.2.1  18-Feb-2006  yamt sync with head.
 1.16.6.2  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.16.6.1  28-Mar-2006  tron Merge 2006-03-28 NetBSD-current into the "peter-altq" branch.
 1.16.4.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.16.4.2  19-Apr-2006  elad sync with head.
 1.16.4.1  08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.16.2.4  11-Aug-2006  yamt sync with head
 1.16.2.3  26-Jun-2006  yamt sync with head.
 1.16.2.2  24-May-2006  yamt sync with head.
 1.16.2.1  01-Apr-2006  yamt sync with head.
 1.19.2.1  19-Jun-2006  chap Sync with head.
 1.20.4.6  11-Feb-2008  yamt sync with head.
 1.20.4.5  21-Jan-2008  yamt sync with head
 1.20.4.4  26-Feb-2007  yamt sync with head.
 1.20.4.3  30-Dec-2006  yamt sync with head.
 1.20.4.2  21-Jun-2006  yamt sync with head.
 1.20.4.1  27-May-2006  yamt file tmpfs.h was added on branch yamt-lazymbuf on 2006-06-21 15:09:36 +0000
 1.21.6.1  10-Dec-2006  yamt sync with head.
 1.21.4.1  18-Nov-2006  ad Sync with head.
 1.24.4.1  27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.26.24.3  18-Feb-2008  mjf Sync with HEAD.
 1.26.24.2  27-Dec-2007  mjf Sync with HEAD.
 1.26.24.1  19-Nov-2007  mjf Sync with HEAD.
 1.26.18.3  23-Mar-2008  matt sync with HEAD
 1.26.18.2  09-Jan-2008  matt sync with HEAD
 1.26.18.1  08-Nov-2007  matt sync with -HEAD
 1.26.16.3  09-Dec-2007  jmcneill Sync with HEAD.
 1.26.16.2  11-Nov-2007  joerg Sync with HEAD.
 1.26.16.1  06-Nov-2007  joerg Sync with HEAD.
 1.26.4.2  08-Oct-2007  ad - Don't leave nodes dangling in order to keep track of the inode generation
number. Free them back to the pool as soon as the referenced file becomes
unused. Using arc4random() for the generation and ino_t based off the
node's in-core address is just about as as good as a disk-based file
system is going to give.
- Add assertion to catch empty directories with linkcount > 1 being freed.
This fires frequently but I haven't tracked the bug down yet..
- Use kmem_alloc.
 1.26.4.1  21-Aug-2007  ad - Add locking around tmpfs shared data structures and mark it MP safe.
It's enough to last for about 45m of fsx+postmark, but it doesn't
survive SGI fsstress yet.
- Close a race where multiple vnodes could maybe have been allocated
for a tmpnode with linkcount > 1.
 1.28.2.6  26-Dec-2007  ad Sync with head.
 1.28.2.5  15-Dec-2007  ad Fix accounting problem that allowed a tmpfs to be filled beyond its limit
when running multithreaded.
 1.28.2.4  13-Dec-2007  ad Kill tn_lookup_dirent and find the correct node using the supplied
componentname.
 1.28.2.3  12-Dec-2007  ad - Don't use LK_RETRY in tmpfs_alloc_vp().
- Reduce cosmetic diffs to head.
 1.28.2.2  08-Dec-2007  ad Reduce coverage of the per-mount lock by using atomic ops.
 1.28.2.1  04-Dec-2007  ad Pull the vmlocking changes into a new branch.
 1.29.4.1  02-Jan-2008  bouyer Sync with HEAD
 1.32.10.3  11-Aug-2010  yamt sync with head.
 1.32.10.2  04-May-2009  yamt sync with head.
 1.32.10.1  16-May-2008  yamt sync with head.
 1.32.8.1  18-May-2008  yamt sync with head.
 1.32.6.3  28-Sep-2008  mjf Sync with HEAD.
 1.32.6.2  29-Jun-2008  mjf Sync with HEAD.
 1.32.6.1  02-Jun-2008  mjf Sync with HEAD.
 1.33.4.4  31-Jul-2008  simonb Sync with head.
 1.33.4.3  29-Jul-2008  simonb Sync with head.
 1.33.4.2  28-Jul-2008  simonb Sync with head.
 1.33.4.1  27-Jun-2008  simonb Sync with head.
 1.33.2.2  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.33.2.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.34.2.1  19-Oct-2008  haad Sync with HEAD.
 1.37.16.3  31-May-2011  rmind sync with head
 1.37.16.2  05-Mar-2011  rmind sync with head
 1.37.16.1  03-Jul-2010  rmind sync with head
 1.37.14.1  17-Aug-2010  uebayasi Sync with HEAD.
 1.39.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.45.16.1  18-May-2014  rmind sync with head
 1.45.12.2  03-Dec-2017  jdolecek update from HEAD
 1.45.12.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.45.2.1  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.48.2.1  10-Aug-2014  tls Rebase.
 1.50.4.3  28-Aug-2017  skrll Sync with HEAD
 1.50.4.2  05-Feb-2017  skrll Sync with HEAD
 1.50.4.1  22-Sep-2015  skrll Sync with HEAD
 1.52.4.1  21-Apr-2017  bouyer Sync with HEAD
 1.52.2.1  20-Mar-2017  pgoyette Sync with HEAD
 1.54.12.1  22-Apr-2018  pgoyette Sync with HEAD

RSS XML Feed