svn commit: r364277 - head/sys/kern

Mateusz Guzik mjg at FreeBSD.org
Sun Aug 16 18:21:22 UTC 2020


Author: mjg
Date: Sun Aug 16 18:21:21 2020
New Revision: 364277
URL: https://svnweb.freebsd.org/changeset/base/364277

Log:
  vfs: use namei_zone for getcwd allocations
  
  instead of malloc.
  
  Note that this should probably be wrapped with a dedicated API and other
  vn_getcwd callers did not get converted.

Modified:
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/vfs_cache.c
==============================================================================
--- head/sys/kern/vfs_cache.c	Sun Aug 16 18:12:21 2020	(r364276)
+++ head/sys/kern/vfs_cache.c	Sun Aug 16 18:21:21 2020	(r364277)
@@ -2427,11 +2427,11 @@ sys___getcwd(struct thread *td, struct __getcwd_args *
 	if (buflen > MAXPATHLEN)
 		buflen = MAXPATHLEN;
 
-	buf = malloc(buflen, M_TEMP, M_WAITOK);
+	buf = uma_zalloc(namei_zone, M_WAITOK);
 	error = vn_getcwd(td, buf, &retbuf, &buflen);
 	if (error == 0)
 		error = copyout(retbuf, uap->buf, buflen);
-	free(buf, M_TEMP);
+	uma_zfree(namei_zone, buf);
 	return (error);
 }
 
@@ -2982,8 +2982,6 @@ DB_SHOW_COMMAND(vpath, db_show_vpath)
 }
 
 #endif
-
-extern uma_zone_t namei_zone;
 
 static bool __read_frequently cache_fast_lookup = true;
 SYSCTL_BOOL(_vfs, OID_AUTO, cache_fast_lookup, CTLFLAG_RW,


More information about the svn-src-all mailing list