diff options
author | Konstantin Belousov <kib@FreeBSD.org> | 2022-12-04 00:37:28 +0000 |
---|---|---|
committer | Konstantin Belousov <kib@FreeBSD.org> | 2022-12-09 12:17:03 +0000 |
commit | cd086696c2cb6d23bac3bc749836d36a9280ae98 (patch) | |
tree | ff160176255d735f0171911e845e9cbc13222ec1 | |
parent | ec201dddfbddd3a77dd3f3afc9b007d0e13e7ad1 (diff) | |
download | src-cd086696c2cb6d23bac3bc749836d36a9280ae98.tar.gz src-cd086696c2cb6d23bac3bc749836d36a9280ae98.zip |
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
-rw-r--r-- | sys/vm/vm_pager.c | 7 |
1 files changed, 6 insertions, 1 deletions
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); } /* |