From 868643e7229b7959024880cda396fef87602b948 Mon Sep 17 00:00:00 2001 From: Mateusz Guzik Date: Sun, 24 Jan 2021 21:04:01 +0100 Subject: [PATCH] cache: assorted cleanups --- sys/kern/vfs_cache.c | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 9d3b935a3047..e3098ac7c5d5 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -5078,20 +5078,6 @@ cache_fplookup_is_mp(struct cache_fpl *fpl) * Debug ni_pathlen tracking. */ #ifdef INVARIANTS -static void -cache_fpl_pathlen_dec(struct cache_fpl *fpl) -{ - - cache_fpl_pathlen_sub(fpl, 1); -} - -static void -cache_fpl_pathlen_inc(struct cache_fpl *fpl) -{ - - cache_fpl_pathlen_add(fpl, 1); -} - static void cache_fpl_pathlen_add(struct cache_fpl *fpl, size_t n) { @@ -5109,17 +5095,21 @@ cache_fpl_pathlen_sub(struct cache_fpl *fpl, size_t n) KASSERT(fpl->debug.ni_pathlen <= PATH_MAX, ("%s: pathlen underflow to %zd\n", __func__, fpl->debug.ni_pathlen)); } -#else -static void __always_inline -cache_fpl_pathlen_dec(struct cache_fpl *fpl) -{ -} -static void __always_inline +static void cache_fpl_pathlen_inc(struct cache_fpl *fpl) { + + cache_fpl_pathlen_add(fpl, 1); } +static void +cache_fpl_pathlen_dec(struct cache_fpl *fpl) +{ + + cache_fpl_pathlen_sub(fpl, 1); +} +#else static void cache_fpl_pathlen_add(struct cache_fpl *fpl, size_t n) { @@ -5129,6 +5119,16 @@ static void cache_fpl_pathlen_sub(struct cache_fpl *fpl, size_t n) { } + +static void +cache_fpl_pathlen_inc(struct cache_fpl *fpl) +{ +} + +static void +cache_fpl_pathlen_dec(struct cache_fpl *fpl) +{ +} #endif static int __always_inline @@ -5258,7 +5258,7 @@ cache_fplookup_parse_advance(struct cache_fpl *fpl) * * Lockless lookup tries to elide checking for spurious slashes and should they * be present is guaranteed to fail to find an entry. In this case the caller - * must check if the name starts with a slash and this call routine. It is + * must check if the name starts with a slash and call this routine. It is * going to fast forward across the spurious slashes and set the state up for * retry. */ @@ -5342,11 +5342,13 @@ cache_fplookup_failed_vexec(struct cache_fpl *fpl, int error) * Hack: handle O_SEARCH. * * Open Group Base Specifications Issue 7, 2018 edition states: + * * If the access mode of the open file description associated with the * file descriptor is not O_SEARCH, the function shall check whether * directory searches are permitted using the current permissions of * the directory underlying the file descriptor. If the access mode is * O_SEARCH, the function shall not perform the check. + * * * Regular lookup tests for the NOEXECCHECK flag for every path * component to decide whether to do the permission check. However,