aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/vnode.h
Commit message (Collapse)AuthorAgeFilesLines
* lockf: ensure atomicity of lockf for open(O_CREAT|O_EXCL|O_EXLOCK)Konstantin Belousov2021-02-171-0/+2
| | | | | | | | | | | | | or EX_SHLOCK. Do it by setting a vnode iflag indicating that the locking exclusive open is in progress, and not allowing F_LOCK request to make a progress until the first open finishes. Requested by: mckusick Reviewed by: markj, mckusick Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28697
* Stop ignoring ERELOOKUP from VOP_INACTIVE()Konstantin Belousov2021-02-121-1/+2
| | | | | | | | | | | | | When possible, relock the vnode and retry inactivation. Only vunref() is required not to drop the vnode lock, so handle it specially by not retrying. This is a part of the efforts to ensure that unlinked not referenced vnode does not prevent inode from reusing. Reviewed by: chs, mckusick Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
* vfs: use atomic_load_consume_ptr in vn_load_v_data_smrMateusz Guzik2021-01-251-1/+1
|
* cache: add symlink support to lockless lookupMateusz Guzik2021-01-231-0/+9
| | | | | | Reviewed by: kib (previous version) Tested by: pho (previous version) Differential Revision: https://reviews.freebsd.org/D27488
* open(2): Add O_DSYNC flag.Thomas Munro2021-01-081-0/+1
| | | | | | | | | | | | | | | POSIX O_DSYNC means that writes include an implicit fdatasync(2), just as O_SYNC implies fsync(2). VOP_WRITE() functions that understand the new IO_DATASYNC flag can act accordingly, but we'll still pass down IO_SYNC so that file systems that don't understand it will continue to provide the stronger O_SYNC behaviour. Flag also applies to fcntl(2). Reviewed by: kib, delphij Differential Revision: https://reviews.freebsd.org/D25090
* vfs: add vn_seqc_read_notmodifyMateusz Guzik2021-01-061-0/+1
|
* cache: combine fast path enabled status into one flagMateusz Guzik2021-01-061-0/+1
| | | | Tested by: pho
* vfs: denote vnode being a mount point with VIRF_MOUNTPOINTMateusz Guzik2021-01-031-0/+1
| | | | | Reviewed by: kib (previous version) Differential Revision: https://reviews.freebsd.org/D27794
* vfs: add v_irflag accessorsMateusz Guzik2021-01-031-1/+9
| | | | | Reviewed by: kib (previous version) Differential Revision: https://reviews.freebsd.org/D27793
* Make max ticks for pause in vn_lock_pair() adjustable at runtime.Konstantin Belousov2020-11-261-0/+2
| | | | | | | | | | | Reduce default value from hz / 10 to hz / 100. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=368073
* Implement vn_lock_pair().Konstantin Belousov2020-11-131-0/+2
| | | | | | | | | | | In collaboration with: pho Reviewed by: mckusick (previous version), markj (previous version) Tested by: markj (syzkaller), pho Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D26136 Notes: svn path=/head/; revision=367631
* cache: add cache_vop_mkdir and rename cache_rename to cache_vop_renameMateusz Guzik2020-10-301-2/+3
| | | | Notes: svn path=/head/; revision=367162
* vfs: prevent avoidable evictions on mkdir of existing directoriesMateusz Guzik2020-10-221-0/+11
| | | | | | | | | | | | | | | | | mkdir -p /foo/bar/baz will mkdir each path component and ignore EEXIST. The NOCACHE lookup will make the namecache unnecessarily evict the existing entry, and then fallback to the fs lookup routine eventually leading namei to return an error as the directory is already there. For invocations like mkdir -p /usr/obj/usr/src/sys/GENERIC/modules this triggers fallbacks to the slowpath for concurrently executing lookups. Tested by: pho Discussed with: kib Notes: svn path=/head/; revision=366950
* vfs: drop spurious cred argument from VOP_VPTOCNPMateusz Guzik2020-10-201-2/+1
| | | | Notes: svn path=/head/; revision=366869
* vfs: add VOP_EAGAINMateusz Guzik2020-10-151-0/+2
| | | | | | | Can be used to stub fplookup for example. Notes: svn path=/head/; revision=366716
* cache: drop the force flag from purgevfsMateusz Guzik2020-09-231-1/+1
| | | | | | | | | The optional scan is wasteful, thus it is removed altogether from unmount. Callers which always want it anyway remain unaffected. Notes: svn path=/head/; revision=366071
* Convert page cache read to VOP.Konstantin Belousov2020-09-151-0/+1
| | | | | | | | | | | | | | | | | | | | | There are several negative side-effects of not calling into VOP layer at all for page cache reads. The biggest is the missed activation of EVFILT_READ knotes. Also, it allows filesystem to make more fine grained decision to refuse read from page cache. Keep VIRF_PGREAD flag around, it is still useful for nullfs, and for asserts. Reviewed by: markj Tested by: pho Discussed with: mjg Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D26346 Notes: svn path=/head/; revision=365785
* vfs_subr.c: export io_hold_cnt and vn_read_from_obj().Konstantin Belousov2020-09-151-1/+3
| | | | | | | | | | Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D26346 Notes: svn path=/head/; revision=365784
* vfs: retire vholdl as a symbolMateusz Guzik2020-09-021-1/+5
| | | | | | | Similarly to vrefl in r364283. Notes: svn path=/head/; revision=365273
* sys: clean up empty lines in .c and .h filesMateusz Guzik2020-09-011-2/+0
| | | | Notes: svn path=/head/; revision=365223
* cache: drop the always curthread argument from reverse lookup routinesMateusz Guzik2020-08-241-5/+3
| | | | | | | | | Note VOP_VPTOCNP keeps getting it as temporary compatibility for zfs. Tested by: pho Notes: svn path=/head/; revision=364633
* cache: add cache_rename, a dedicated helper to use for renamesMateusz Guzik2020-08-201-0/+2
| | | | | | | | | While here make both tmpfs and ufs use it. No fuctional changes. Notes: svn path=/head/; revision=364419
* vfs: drop the error parameter from vn_isdisk, introduce vn_isdisk_errorMateusz Guzik2020-08-191-1/+2
| | | | | | | Most consumers pass NULL. Notes: svn path=/head/; revision=364372
* VMIO readKonstantin Belousov2020-08-161-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | If possible, i.e. if the requested range is resident valid in the vm object queue, and some secondary conditions hold, copy data for read(2) directly from the valid cached pages, avoiding vnode lock and instantiating buffers. I intentionally do not start read-ahead, nor handle the advises on the cached range. Filesystems indicate support for VMIO reads by setting VIRF_PGREAD flag, which must not be cleared until vnode reclamation. Currently only filesystems that use vnode pager for v_objects can enable it, due to reliance on vnp_size. There is a WIP to handle it for tmpfs. Reviewed by: markj Discussed with: jeff Tested by: pho Benchmarked by: mjg Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D25968 Notes: svn path=/head/; revision=364287
* vfs: retire vrefl as a symbolMateusz Guzik2020-08-161-1/+5
| | | | | | | | | vrefl calls vref and there is only one in-tree consumer. Keep it as a macro for assertion purposes. Notes: svn path=/head/; revision=364283
* vfs: remove the thread argument from vgetMateusz Guzik2020-08-161-1/+1
| | | | | | | | | | | | | | | | | | It was already asserted to be curthread. Semantic patch: @@ expression arg1, arg2, arg3; @@ - vget(arg1, arg2, arg3) + vget(arg1, arg2) Notes: svn path=/head/; revision=364271
* vfs: inline vrefcntMateusz Guzik2020-08-121-1/+6
| | | | Notes: svn path=/head/; revision=364141
* vfs: garbage collect vrefactnMateusz Guzik2020-08-121-1/+0
| | | | Notes: svn path=/head/; revision=364140
* devfs: rework si_usecount to track opensMateusz Guzik2020-08-111-1/+0
| | | | | | | | | | | This removes a lot of special casing from the VFS layer. Reviewed by: kib (previous version) Tested by: pho (previous version) Differential Revision: https://reviews.freebsd.org/D25612 Notes: svn path=/head/; revision=364113
* vfs: add VOP_STATMateusz Guzik2020-08-071-2/+16
| | | | | | | | | | | | | | The current scheme of calling VOP_GETATTR adds avoidable overhead. An example with tmpfs doing fstat (ops/s): before: 7488958 after: 7913833 Reviewed by: kib (previous version) Differential Revision: https://reviews.freebsd.org/D25910 Notes: svn path=/head/; revision=364044
* vfs: remove the obsolete privused argument from vaccessMateusz Guzik2020-08-051-5/+3
| | | | | | | | This brings argument count down to 6, which is passable without the stack on amd64. Notes: svn path=/head/; revision=363893
* vfs: support lockless dotdot lookupMateusz Guzik2020-08-041-0/+2
| | | | | | | Tested by: pho Notes: svn path=/head/; revision=363874
* cache: add cache_purge_vgoneMateusz Guzik2020-08-041-0/+1
| | | | | | | | | | | | | | | | | | cache_purge locklessly checks whether the vnode at hand has any namecache entries. This can race with a concurrent purge which managed to remove the last entry, but may not be done touching the vnode. Make sure we observe the relevant vnode lock as not taken before proceeding with vgone. Paired with the fact that doomed vnodes cannnot receive entries this restores the invariant that there are no namecache-related writing users past cache_purge in vgone. Reported by: pho Notes: svn path=/head/; revision=363872
* vfs: shorten v_iflag and v_vflagMateusz Guzik2020-08-021-6/+7
| | | | | | | | | | While here renumber VI_* flags to remove the gaps. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D25921 Notes: svn path=/head/; revision=363781
* vfs: move namecache initialisation into cache_vnode_initMateusz Guzik2020-08-021-0/+1
| | | | Notes: svn path=/head/; revision=363780
* vfs: inline vops if there are no pre/post associated callsMateusz Guzik2020-07-301-16/+16
| | | | | | | | | | This removes a level of indirection from frequently used methods, most notably VOP_LOCK1 and VOP_UNLOCK1. Tested by: pho Notes: svn path=/head/; revision=363708
* vfs: add the infrastructure for lockless lookupMateusz Guzik2020-07-251-0/+16
| | | | | | | | | Reviewed by: kib Tested by: pho (in a patchset) Differential Revision: https://reviews.freebsd.org/D25577 Notes: svn path=/head/; revision=363518
* vfs: introduce vnode sequence countersMateusz Guzik2020-07-251-0/+40
| | | | | | | | | | | Modified on each permission change and link/unlink. Reviewed by: kib Tested by: pho (in a patchset) Differential Revision: https://reviews.freebsd.org/D25573 Notes: svn path=/head/; revision=363517
* vfs: protect vnodes with smrMateusz Guzik2020-07-011-1/+16
| | | | | | | | | | | | | | vget_prep_smr and vhold_smr can be used to ref a vnode while within vfs_smr section, allowing consumers to get away without locking. See vhold_smr and vdropl for comments explaining caveats. Reviewed by: kib Testec by: pho Differential Revision: https://reviews.freebsd.org/D23913 Notes: svn path=/head/; revision=362827
* vfs: quiet -Wwrite-stringsRyan Libby2020-02-231-1/+1
| | | | | | | | Reviewed by: kib, markj Differential Revision: https://reviews.freebsd.org/D23797 Notes: svn path=/head/; revision=358257
* Provide O_SEARCHKyle Evans2020-02-021-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | O_SEARCH is defined by POSIX [0] to open a directory for searching, skipping permissions checks on the directory itself after the initial open(). This is close to the semantics we've historically applied for O_EXEC on a directory, which is UB according to POSIX. Conveniently, O_SEARCH on a file is also explicitly undefined behavior according to POSIX, so O_EXEC would be a fine choice. The spec goes on to state that O_SEARCH and O_EXEC need not be distinct values, but they're not defined to be the same value. This was pointed out as an incompatibility with other systems that had made its way into libarchive, which had assumed that O_EXEC was an alias for O_SEARCH. This defines compatibility O_SEARCH/FSEARCH (equivalent to O_EXEC and FEXEC respectively) and expands our UB for O_EXEC on a directory. O_EXEC on a directory is checked in vn_open_vnode already, so for completeness we add a NOEXECCHECK when O_SEARCH has been specified on the top-level fd and do not re-check that when descending in namei. [0] https://pubs.opengroup.org/onlinepubs/9699919799/ Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D23247 Notes: svn path=/head/; revision=357412
* vfs: remove the now empty vop_unlock_postMateusz Guzik2020-02-021-2/+0
| | | | Notes: svn path=/head/; revision=357404
* vfs: remove the never set VDESC_VPP_WILLRELE flagMateusz Guzik2020-02-021-1/+0
| | | | Notes: svn path=/head/; revision=357403
* cache: replace kern___getcwd with vn_getcwdMateusz Guzik2020-02-011-0/+1
| | | | | | | | The previous routine was resulting in extra data copies most notably in linux_getcwd. Notes: svn path=/head/; revision=357387
* vfs: consistently use size_t for buflen around VOP_VPTOCNPMateusz Guzik2020-02-011-1/+1
| | | | Notes: svn path=/head/; revision=357383
* vfs: replace VOP_MARKATIME with VOP_MMAPPEDMateusz Guzik2020-02-011-1/+0
| | | | | | | | | | The routine is only provided by ufs and is only used on mmap and exec. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D23422 Notes: svn path=/head/; revision=357361
* vfs: add vrefactnMateusz Guzik2020-02-011-0/+1
| | | | | | | Differential Revision: https://reviews.freebsd.org/D23427 Notes: svn path=/head/; revision=357358
* vfs: remove the never set VDESC_NOMAP_VPP flagMateusz Guzik2020-01-301-1/+0
| | | | Notes: svn path=/head/; revision=357287
* vfs: per-cpu batched requeuing of free vnodesMateusz Guzik2020-01-131-1/+2
| | | | | | | | | | | | | | | | | | | | | | Constant requeuing adds significant lock contention in certain workloads. Lessen the problem by batching it. Per-cpu areas are locked in order to synchronize against UMA freeing memory. vnode's v_mflag is converted to short to prevent the struct from growing. Sample result from an incremental make -s -j 104 bzImage on tmpfs: stock: 122.38s user 1780.45s system 6242% cpu 30.480 total patched: 144.84s user 985.90s system 4856% cpu 23.282 total Reviewed by: jeff Tested by: pho (in a larger patch, previous version) Differential Revision: https://reviews.freebsd.org/D22998 Notes: svn path=/head/; revision=356673
* vfs: rework vnode list managementMateusz Guzik2020-01-131-5/+2
| | | | | | | | | | | | | | | | | | | | | | | The current notion of an active vnode is eliminated. Vnodes transition between 0<->1 hold counts all the time and the associated traversal between different lists induces significant scalability problems in certain workloads. Introduce a global list containing all allocated vnodes. They get unlinked only when UMA reclaims memory and are only requeued when hold count reaches 0. Sample result from an incremental make -s -j 104 bzImage on tmpfs: stock: 118.55s user 3649.73s system 7479% cpu 50.382 total patched: 122.38s user 1780.45s system 6242% cpu 30.480 total Reviewed by: jeff Tested by: pho (in a larger patch, previous version) Differential Revision: https://reviews.freebsd.org/D22997 Notes: svn path=/head/; revision=356672