Mateusz Guzik
8ddea0b127
cache: just assign ni_resflags = NIRES_ABS
...
It is guaranteed to be 0 on entry.
2021-01-08 13:57:10 +00:00
Mateusz Guzik
fee405e057
cache: stop checkpointing cn_flags
...
They are only modified, if ever, for the last component.
2021-01-07 23:29:52 +00:00
Mateusz Guzik
ac7715471c
cache: stop checkpointing cn_nameptr
...
For aborts cn_nameptr is the same as cn_pnbuf. For partial results
the same cn_nameptr is to be used.
2021-01-07 23:29:38 +00:00
Mateusz Guzik
0f1fc3a31f
cache: stop manipulating pathlen
...
It is a copy-pasto from regular lookup. Add debug to ensure the result
is the same.
2021-01-07 23:26:53 +00:00
Mateusz Guzik
f2b794e1e9
cache: unengrish the comment in previous commit
...
Reported by: rpokala, brd
2021-01-06 23:46:05 +00:00
Mateusz Guzik
deabdc6868
cache: stop pre-checking seqc when starting the lookup
...
Tested by: pho
2021-01-06 07:28:07 +00:00
Mateusz Guzik
71a6a0b545
cache: skip checking for spurious slashes if possible
...
Tested by: pho
2021-01-06 07:28:06 +00:00
Mateusz Guzik
33f3e81df5
cache: combine fast path enabled status into one flag
...
Tested by: pho
2021-01-06 07:28:06 +00:00
Mateusz Guzik
dbbbc07cc3
cache: split handling of 0 and non-0 error codes
...
Tested by: pho
2021-01-06 07:07:24 +01:00
Mateusz Guzik
a1a8f8ada1
cache: deinline state handling
...
The intent is to reduce branchfest when finishing the lookup.
Tested by: pho
2021-01-06 07:05:22 +01:00
Mateusz Guzik
05803be000
cache: stop setting cn_nameptr on entry as matches cn_pnbuf already
...
While here tidy up other asserts.
2021-01-06 07:03:41 +01:00
Mateusz Guzik
3814bea00a
cache: drop the now spurious doomed check when crossing a mount point
2021-01-03 21:22:16 +00:00
Mateusz Guzik
82397d7919
vfs: denote vnode being a mount point with VIRF_MOUNTPOINT
...
Reviewed by: kib (previous version)
Differential Revision: https://reviews.freebsd.org/D27794
2021-01-03 06:50:06 +00:00
Mateusz Guzik
51bf55fa6c
cache: stop checkpointing cn_namelen
...
The variable is recomputed by regular lookup from the get go.
2021-01-03 06:50:06 +00:00
Mateusz Guzik
7220a10b5b
cache: predict on no spurious slashes in cache_fpl_handle_root
...
This is a step towards speculatively not handling them.
2021-01-03 06:50:06 +00:00
Mateusz Guzik
30a2fc91fa
cache: postpone NAME_MAX check as it may be unnecessary
2021-01-03 06:50:06 +00:00
Mateusz Guzik
eca899bd5d
cache: remove spurious null check in sdt probe
2021-01-03 06:50:06 +00:00
Mateusz Guzik
1365b5f86f
cache: fold NCF_WHITE check into the rest
...
Tested by: pho
2021-01-01 00:10:43 +00:00
Mateusz Guzik
d7c62d98c9
cache: call cache_fplookup_modifying in neg
...
Tested by: pho
2021-01-01 00:10:43 +00:00
Mateusz Guzik
6fe7de1a25
cache: refactor cache_fpl_handle_root to fit the rest of the code better
...
Tested by: pho
2021-01-01 00:10:43 +00:00
Mateusz Guzik
e17e01bd0e
cache: refactor dot handling
...
Tested by: pho
2021-01-01 00:10:43 +00:00
Mateusz Guzik
4651db56c7
cache: remove a branch from mount point checking
...
Tested by: pho
2021-01-01 00:10:42 +00:00
Mateusz Guzik
0b5bd1afd8
cache: support lockless lookup of degenerate paths
...
Tested by: pho
2021-01-01 00:10:42 +00:00
Mateusz Guzik
1d6eb97677
cache: save on branching when parsing the path by inserting a sentinel
...
Tested by: pho
2021-01-01 00:10:42 +00:00
Mateusz Guzik
67297766b5
cache: hoist trailing slash and degenerate path handling out of the loop
...
Tested by: pho
2021-01-01 00:10:42 +00:00
Mateusz Guzik
0c09f4b0cc
cache: work around corner case of dvp == tvp in cache_fplookup_final_modifying
...
Fixes a panic where the kernel would unlock an unheld lock coming from
rename looking up "foo/." as the source.
Reported by: markj (syzkaller)
2020-12-28 21:38:20 +00:00
Mateusz Guzik
4ab7d9f484
cache: reduce engrish in previous commit
2020-12-28 02:05:30 +00:00
Mateusz Guzik
0714f921cd
cache: save on some branching in common case mount point traversal
2020-12-28 01:53:28 +00:00
Mateusz Guzik
002e18eb7f
vfs: add FAILIFEXISTS flag
...
Both FreeBSD and Linux mkdir -p walk the tree up ignoring any EEXIST on
the way and both are used a lot when building respective kernels.
This poses a problem as spurious locking avoidably interferes with
concurrent operations like getdirentries on affected directories.
Work around the problem by adding FAILIFEXISTS flag. In case of lockless
lookup this manages to avoid any work to begin with, there is no speed
up for the locked case but perhaps this can be augmented later on.
For simplicity the only supported semantics are as used by mkdir.
Reviewed by: kib (previous version)
Differential Revision: https://reviews.freebsd.org/D27789
2020-12-28 01:53:27 +00:00
Mateusz Guzik
ff97bc034f
cache: simplify lockless dot lookups
2020-12-28 01:53:27 +00:00
Mateusz Guzik
abd7ded451
cache: modification and last entry filling support in lockless lookup v2
...
The previous patch failed to set the ISDOTDOT flag when appropriate,
which in turn fail to properly handle degenerate lookups.
While here sprinkle some extra assertions.
Tested by: pho (previous version)
2020-12-27 21:03:18 +00:00
Mateusz Guzik
623daa69f9
cache: assert internal flags are not passed by namei
2020-12-27 19:49:24 +00:00
Mateusz Guzik
a1fc1f10c6
Revert "cache: modification and last entry filling support in lockless lookup"
...
This reverts commit 6dbb07ed68
.
Some ports unreliably fail to build with rmdir getting ENOTEMPTY.
2020-12-27 19:02:29 +00:00
Mateusz Guzik
6dbb07ed68
cache: modification and last entry filling support in lockless lookup
...
Tested by: pho (previous version)
2020-12-27 17:22:25 +00:00
Mateusz Guzik
906a73e791
cache: fix up cache_hold_vnode comment
2020-12-23 07:24:29 +00:00
Mateusz Guzik
8ab96e265d
cache: fix ups bad predicts
...
- last level fallback normally sees CREATE; the code should be optimized to not
get there for said case
- fast path commonly fails with ENOENT
2020-12-13 21:29:39 +00:00
Ryan Libby
d3bbf8af68
cache_fplookup: quiet gcc -Wreturn-type
...
Reviewed by: markj, mjg
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D27555
2020-12-11 22:51:44 +00:00
Mateusz Guzik
f6dd1aefb7
vfs: group mount per-cpu vars into one struct
...
While here move frequently read stuff into the same cacheline.
This shrinks struct mount by 64 bytes.
Tested by: pho
2020-11-09 23:02:13 +00:00
Mateusz Guzik
4bfebc8d2c
cache: add cache_vop_mkdir and rename cache_rename to cache_vop_rename
2020-10-30 10:46:35 +00:00
Mateusz Guzik
d681c51d36
cache: add missing NIRES_ABS handling
2020-10-26 18:01:18 +00:00
Mateusz Guzik
eb65cde4f5
cache: assorted typo fixes
2020-10-24 13:31:40 +00:00
Mateusz Guzik
029cfccc71
cache: add the missing NC_NOMAKEENTRY and NC_KEEPPOSENTRY to lockless lookup
...
They are de facto ignored.
2020-10-24 13:31:25 +00:00
Mateusz Guzik
acb41008f3
cache: batch updates to numcache in case of mass removal
2020-10-24 01:14:52 +00:00
Mateusz Guzik
208cb7c4b6
cache: refactor alloc/free
...
This in particular centralizes manipulation of numcache.
2020-10-24 01:14:17 +00:00
Mateusz Guzik
1d44405690
cache: fold branch prediction into cache_ncp_canuse
2020-10-24 01:13:47 +00:00
Mateusz Guzik
c13d7d1f98
cache: fix some typos
2020-10-24 01:13:16 +00:00
Mateusz Guzik
f878526f20
cache: drop write-only vars
2020-10-24 01:13:02 +00:00
Mateusz Guzik
3862838921
cache: reduce memory waste in struct namecache
...
The previous scheme for calculating the total size was doing sizeof
on the struct and then adding the wanted space for the buffer.
nc_name is at offset 58 while sizeof(struct namecache) is 64.
With CACHE_PATH_CUTOFF of 39 bytes and 1 byte of padding we were
allocating 104 bytes for the entry and never accounting for the 6
byte padding, wasting that space.
2020-10-23 15:56:22 +00:00
Mateusz Guzik
c7520caa4f
vfs: prevent avoidable evictions on mkdir of existing directories
...
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
2020-10-22 19:28:12 +00:00
Mateusz Guzik
54f09403a3
cache: assert the created entry does not point to itself
2020-10-22 19:22:34 +00:00