git: cd086696c2cb - main - vm_pager_allocate(): override resulting object type
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 09 Dec 2022 12:17:39 UTC
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=cd086696c2cb6d23bac3bc749836d36a9280ae98 commit cd086696c2cb6d23bac3bc749836d36a9280ae98 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2022-12-04 00:37:28 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2022-12-09 12:17:03 +0000 vm_pager_allocate(): override resulting object type For dynamically allocated pager type, which inherits the parent's alloc method, type of the returned object is set to the parent's type otherwise. Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D37097 --- sys/vm/vm_pager.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/vm/vm_pager.c b/sys/vm/vm_pager.c index 08ce98ab5dbd..e24348ed39a0 100644 --- a/sys/vm/vm_pager.c +++ b/sys/vm/vm_pager.c @@ -258,9 +258,14 @@ vm_object_t vm_pager_allocate(objtype_t type, void *handle, vm_ooffset_t size, vm_prot_t prot, vm_ooffset_t off, struct ucred *cred) { + vm_object_t object; + MPASS(type < nitems(pagertab)); - return ((*pagertab[type]->pgo_alloc)(handle, size, prot, off, cred)); + object = (*pagertab[type]->pgo_alloc)(handle, size, prot, off, cred); + if (object != NULL) + object->type = type; + return (object); } /*