summaryrefslogtreecommitdiffstats
path: root/sys/fs/tmpfs/tmpfs_vfsops.c
Commit message (Collapse)AuthorAgeFilesLines
* MFC r312432:kib2017-02-021-1/+4
| | | | Add a mount option for tmpfs(5) to not use namecache.
* MFC r312428:kib2017-02-021-23/+39
| | | | Refcount tmpfs nodes and mount structures.
* MFC r312414:kib2017-01-261-3/+3
| | | | Rename tmpfs_mount member allnode_lock to include namespace prefix.
* MFC r312409:kib2017-01-261-19/+14
| | | | | | | Style fixes and comment updates. MFC r312435: Remove mistakenly merged field.
* MFC r312124 (by mjg):kib2017-01-261-1/+1
| | | | tmpfs: manage tm_pages_used with atomics.
* MFC r277828:kib2015-02-111-0/+35
| | | | | | | | | | | | | Update mtime for tmpfs files modified through memory mapping. MFC r277969: Update both ctime and mtime for writes to tmpfs files. MFC r277972: Remove single-use boolean. MFC r278151: Remove duplicated assignment.
* MFC r277827:kib2015-01-311-4/+4
| | | | tmpfs does not use UVM on FreeBSD.
* MFC r268617:kib2014-07-281-24/+50
| | | | Rework the tmpfs unmount.
* MFC r268605:kib2014-07-281-16/+0
| | | | Remove code separator lines which do not conform to style(9).
* MFC r263130:bdrewery2014-03-301-2/+4
| | | | Fix -o size less than PAGE_SIZE resulting in SIZE_MAX being used.
* Allow tmpfs be mounted inside jail.delphij2013-08-231-1/+7
|
* tmpfs works perfectly fine with -o union -- there is no reason to exclude itnwhitehorn2013-07-231-1/+1
| | | | from the list of options.
* tmpfs: Replace directory entry linked list with RB-Tree.gleb2013-01-061-13/+2
| | | | | | | | | | | | | | | | | | | | | Use file name hash as a tree key, handle duplicate keys. Both VOP_LOOKUP and VOP_READDIR operations utilize same tree for search. Directory entry offset (cookie) is either file name hash or incremental id in case of hash collisions (duplicate-cookies). Keep sorted per directory list of duplicate-cookie entries to facilitate cookie number allocation. Don't fail if previous VOP_READDIR() offset is no longer valid, start with next dirent instead. Other file system handle it similarly. Workaround race prone tn_readdir_last[pn] fields update. Add tmpfs_dir_destroy() to free all dirents. Set NFS cookies in tmpfs_dir_getdents(). Return EJUSTRETURN from tmpfs_dir_getdents() instead of hard coded -1. Mark directory traversal routines static as they are no longer used outside of tmpfs_subr.c
* Complete MPSAFE VFS interface and remove MNTK_MPSAFE flag.attilio2012-11-091-1/+0
| | | | | Porters should refer to __FreeBSD_version 1000021 for this change as it may have happened at the same timeframe.
* Fix up kernel sources to be ready for a 64-bit ino_t.mdf2012-09-271-1/+2
| | | | Original code by: Gleb Kurtsou
* tmpfs: Allow update mounts only for certain options.jh2012-04-161-6/+12
| | | | | | | | Since r230208 update mounts were allowed if the list of mount options contained the "export" option. This is not correct as tmpfs doesn't really support updating all options. Reviewed by: kevlo, trociny
* tmpfs supports only INT_MAX nodes due to limitations of unit numbergleb2012-04-071-3/+7
| | | | | | | | | | | allocator. Replace UINT32_MAX checks with INT_MAX. Keeping more than 2^31 nodes in memory is not likely to become possible in foreseeable feature and would require new unit number allocator. Discussed with: delphij MFC after: 2 weeks
* Add vfs_getopt_size. Support human readable file system options in tmpfs.gleb2012-04-071-16/+13
| | | | | | | Increase maximum tmpfs file system size to 4GB*PAGE_SIZE on 32 bit archs. Discussed with: delphij MFC after: 2 weeks
* Add reserved memory limit sysctl to tmpfs.gleb2012-04-071-10/+18
| | | | | | | Cleanup availble and used memory functions. Check if free pages available before allocating new node. Discussed with: delphij
* Return EOPNOTSUPP since we only support update mounts for NFS export.kevlo2012-01-171-0/+4
| | | | Spotted by: trociny
* Add nfs export support to tmpfs(5)kevlo2012-01-161-4/+2
| | | | Reviewed by: kib
* Don astbestos garment and remove the warning about TMPFS being experimentalmarcel2011-11-071-3/+0
| | | | | | | | | -- highly experimental even. So far the closest to a bug in TMPFS that people have gotten to relates to how ZFS can take away from the memory that TMPFS needs. One can argue that such is not a bug in TMPFS. Irrespective, even if there is a bug here and there in TMPFS, it's not in our own advantage to scare people away from using TMPFS. I for one have been using it, even with ZFS, very successfully.
* Add a lock flags argument to the VFS_FHTOVP() file systemrmacklem2011-05-221-2/+4
| | | | | | | | | | | method, so that callers can indicate the minimum vnode locking requirement. This will allow some file systems to choose to return a LK_SHARED locked vnode when LK_SHARED is specified for the flags argument. This patch only adds the flag. It does not change any file system to use it and all callers specify LK_EXCLUSIVE, so file system semantics are not changed. Reviewed by: kib
* Add "maxfilesize" mount option for tmpfs to allow specifying thejh2010-01-291-57/+8
| | | | | | | | | | | | | | maximum file size limit. Default is UINT64_MAX when the option is not specified. It was useless to set the limit to the total amount of memory and swap in the system. Use tmpfs_mem_info() rather than get_swpgtotal() in tmpfs_mount() to check if there is enough memory available. Remove now unused get_swpgtotal(). Reviewed by: Gleb Kurtsou Approved by: trasz (mentor)
* - Change the type of nodes_max to u_int and use "%u" format string tojh2010-01-201-6/+9
| | | | | | | | | | | | | convert its value. [1] - Set default tm_nodes_max to min(pages + 3, UINT32_MAX). It's more reasonable than the old four nodes per page (with page size 4096) because non-empty regular files always use at least one page. This fixes possible overflow in the calculation. [2] - Don't allow more than tm_nodes_max nodes allocated in tmpfs_alloc_node(). PR: kern/138367 Suggested by: bde [1], Gleb Kurtsou [2] Approved by: trasz (mentor)
* - Fix some style bugs in tmpfs_mount(). [1]jh2010-01-131-7/+7
| | | | | | - Remove a stale comment about tmpfs_mem_info() 'total' argument. Reported by: bde [1]
* - Change the type of size_max to u_quad_t because its value is convertedjh2010-01-081-3/+3
| | | | | | | | | | with vfs_scanopt(9) using the "%qu" format string. - Limit the maximum value of size_max to (SIZE_MAX - PAGE_SIZE) to prevent overflow in howmany() macro. PR: kern/141194 Approved by: trasz (mentor) MFC after: 2 weeks
* Remove the thread argument from the FSD (File-System Dependent) parts ofattilio2009-05-111-13/+12
| | | | | | | | | | | | | | | | | the VFS. Now all the VFS_* functions and relating parts don't want the context as long as it always refers to curthread. In some points, in particular when dealing with VOPs and functions living in the same namespace (eg. vflush) which still need to be converted, pass curthread explicitly in order to retain the old behaviour. Such loose ends will be fixed ASAP. While here fix a bug: now, UFS_EXTATTR can be compiled alone without the UFS_EXTATTR_AUTOSTART option. VFS KPI is heavilly changed by this commit so thirdy parts modules needs to be recompiled. Bump __FreeBSD_version in order to signal such situation.
* Reflect license change of NetBSD code.delphij2008-09-031-8/+1
| | | | | Obtained from: NetBSD MFC after: 3 days
* Decontextualize the couplet VOP_GETATTR / VOP_SETATTR as the passed threadattilio2008-08-281-1/+1
| | | | | | was always curthread and totally unuseful. Tested by: Giovanni Trematerra <giovanni dot trematerra at gmail dot com>
* Move the head of byte-level advisory lock list from thekib2008-04-161-1/+0
| | | | | | | | | | | | | | | | | | | | | | filesystem-specific vnode data to the struct vnode. Provide the default implementation for the vop_advlock and vop_advlockasync. Purge the locks on the vnode reclaim by using the lf_purgelocks(). The default implementation is augmented for the nfs and smbfs. In the nfs_advlock, push the Giant inside the nfs_dolock. Before the change, the vop_advlock and vop_advlockasync have taken the unlocked vnode and dereferenced the fs-private inode data, racing with with the vnode reclamation due to forced unmount. Now, the vop_getattr under the shared vnode lock is used to obtain the inode size, and later, in the lf_advlockasync, after locking the vnode interlock, the VI_DOOMED flag is checked to prevent an operation on the doomed vnode. The implementation of the lf_purgelocks() is submitted by dfr. Reported by: kris Tested by: kris, pho Discussed with: jeff, dfr MFC after: 2 weeks
* VOP_LOCK1() (and so VOP_LOCK()) and VOP_UNLOCK() are only used inattilio2008-01-131-1/+1
| | | | | | | | | | | conjuction with 'thread' argument passing which is always curthread. Remove the unuseful extra-argument and pass explicitly curthread to lower layer functions, when necessary. KPI results broken by this change, which should affect several ports, so version bumping and manpage update will be further committed. Tested by: kris, pho, Diego Sardina <siarodx at gmail dot com>
* vn_lock() is currently only used with the 'curthread' passed as argument.attilio2008-01-101-1/+1
| | | | | | | | | | | | | | | | Remove this argument and pass curthread directly to underlying VOP_LOCK1() VFS method. This modify makes the code cleaner and in particular remove an annoying dependence helping next lockmgr() cleanup. KPI results, obviously, changed. Manpage and FreeBSD_version will be updated through further commits. As a side note, would be valuable to say that next commits will address a similar cleanup about VFS methods, in particular vop_lock1 and vop_unlock. Tested by: Diego Sardina <siarodx at gmail dot com>, Andrea Di Pasquale <whyx dot it at gmail dot com>
* size_max should be unsigned, as such, use size_t here.delphij2007-12-061-1/+1
|
* MFp4: Several fixes to tmpfs which makes it to survive from pho@'sdelphij2007-11-181-1/+0
| | | | | | | | | | | | | | | | | | | | strees2 suite, to quote his letter, this change: 1. It removes the tn_lookup_dirent stuff. I think this cannot be fixed, because nothing protects vnode/tmpfs node between lookup is done, and actual operation is performed, in the case the vnode lock is dropped. At least, this is the case with the from vnode for rename. For now, we do the linear lookup in the parent node. This has its own drawbacks. Not mentioning speed (that could be fixed by using hash), the real problem is the situation where several hardlinks exist in the dvp. But, I think this is fixable. 2. The patch restores the VV_ROOT flag on the root vnode after it became reclaimed and allocated again. This fixes MPASS assertion at the start of the tmpfs_lookup() reported by many. Submitted by: kib
* MFp4: Fix several style(9) bugs.delphij2007-11-181-19/+12
| | | | Submitted by: des
* Correct a stack overflow which will trigger panics whendelphij2007-11-121-1/+1
| | | | | | | | mode= is specified, caused by incorrect format string specified to vfs_scanopt() and subsequently vsscanf(). Pointed out by: kib Submitted by: des
* MFp4: Provide a dummy verb "export" to shut up the messagedelphij2007-10-041-1/+1
| | | | | | | showed up at start when NFS is enabled. Reported by: rafan Approved by: re (tmpfs blanket)
* Additional work is still needed before we can claim that tmpfsdelphij2007-10-041-0/+3
| | | | | | is stable enough for production usage. Warn user upon mount. Approved by: re (tmpfs blanket)
* MFp4:delphij2007-08-101-2/+5
| | | | | | | | | | | | | | | - Respect cnflag and don't lock vnode always as LK_EXCLUSIVE [1] - Properly lock around tn_vnode to avoid NULL deference - Be more careful handling vnodes (*) (*) This is a WIP [1] by pjd via howardsu Thanks kib@ for his valuable VFS related comments. Tested with: fsx, fstest, tmpfs regression test set Found by: pho's stress2 suite Approved by: re (tmpfs blanket)
* MFp4: Force 64-bit arithmatic when caculating the maximum file size.delphij2007-07-241-1/+1
| | | | | | | | | This fixes tmpfs caculations on 32-bit systems equipped with more than 4GB swap. Reported by: Craig Boston <craig xfoil gank org> PR: kern/114870 Approved by: re (tmpfs blanket)
* MFp4: When swapping is not enabled, allow creating files by takingdelphij2007-07-231-1/+1
| | | | | | | | physical memory pages into account for tm_maxfilesize. Reported by: Dominique Goncalves <dominique.goncalves gmail.com> Submitted by: Howard Su Approved by: re (tmpfs blanket)
* MFp4: Make use of the kernel unit number allocation facilitydelphij2007-07-111-14/+6
| | | | | | | for tmpfs nodes. Submitted by: Mingyan Guo <guomingyan gmail com> Approved by: re (tmpfs blanket)
* MFp4:delphij2007-07-081-21/+42
| | | | | | | | | | | | | | | | - Plug memory leak. - Respect underlying vnode's properties rather than assuming that the user want root:wheel + 0755. Useful for using tmpfs(5) for /tmp. - Use roundup2 and howmany macros instead of rolling our own version. - Try to fix fsx -W -R foo case. - Instead of blindly zeroing a page, determine whether we need a pagein order to prevent data corruption. - Fix several bugs reported by Coverity. Submitted by: Mingyan Guo <guomingyan gmail com>, Howard Su, delphij Coverity ID: CID 2550, 2551, 2552, 2557 Approved by: re (tmpfs blanket)
* MFp4:delphij2007-06-291-4/+2
| | | | | | | | | | | | | - Remove unnecessary NULL checks after M_WAITOK allocations. - Use VOP_ACCESS instead of hand-rolled suser_cred() calls. [1] - Use malloc(9) KPI to allocate memory for string. The optimization taken from NetBSD is not valid for FreeBSD because our malloc(9) already act that way. [2] Requested by: rwatson [1] Submitted by: Howard Su [2] Approved by: re (tmpfs blanket)
* Space/style cleanups after last set of commits.delphij2007-06-281-23/+22
| | | | Approved by: re (tmpfs blanket)
* MFp4: Several clean-ups and improvements over tmpfs:delphij2007-06-251-23/+70
| | | | | | | | | | | | | | | | | | | | | | | - Remove tmpfs_zone_xxx KPI, the uma(9) wrapper, since they does not bring any value now. - Use |= instead of = when applying VV_ROOT flag. - Remove tm_avariable_nodes list. Use uma to hold the released nodes. - init/destory interlock mutex of node when init/fini instead of ctor/dtor. - Change memory computing using u_int to fix negative value in 2G mem machine. - Remove unnecessary bzero's - Rely uma logic to make file id allocation harder to guess. - Fix some unsigned/signed related things. Make sure we respect -o size=xxxx - Use wire instead of hold a page. - Pass allocate_zero to obtain zeroed pages upon first use. Submitted by: Howard Su Approved by: re (tmpfs blanket, kensmith)
* MFp4: Add tmpfs, an efficient memory file system.delphij2007-06-161-0/+418
Please note that, this is currently considered as an experimental feature so there could be some rough edges. Consult http://wiki.freebsd.org/TMPFS for more information. For now, connect tmpfs to build on i386 and amd64 architectures only. Please let us know if you have success with other platforms. This work was developed by Julio M. Merino Vidal for NetBSD as a SoC project; Rohit Jalan ported it from NetBSD to FreeBSD. Howard Su and Glen Leeder are worked on it to continue this effort. Obtained from: NetBSD via p4 Submitted by: Howard Su (with some minor changes) Approved by: re (kensmith)
OpenPOWER on IntegriCloud