sg_pager.c (d9a447559bc04121f7c6682e64abe67efa154864) | sg_pager.c (89f6b8632cc94bca2738b4fcc26e1189ef4f5dde) |
---|---|
1/*- 2 * Copyright (c) 2009 Advanced Computing Technologies LLC 3 * Written by: John H. Baldwin <jhb@FreeBSD.org> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 22 unchanged lines hidden (view full) --- 31/* 32 * This pager manages OBJT_SG objects. These objects are backed by 33 * a scatter/gather list of physical address ranges. 34 */ 35 36#include <sys/param.h> 37#include <sys/lock.h> 38#include <sys/mutex.h> | 1/*- 2 * Copyright (c) 2009 Advanced Computing Technologies LLC 3 * Written by: John H. Baldwin <jhb@FreeBSD.org> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 22 unchanged lines hidden (view full) --- 31/* 32 * This pager manages OBJT_SG objects. These objects are backed by 33 * a scatter/gather list of physical address ranges. 34 */ 35 36#include <sys/param.h> 37#include <sys/lock.h> 38#include <sys/mutex.h> |
39#include <sys/rwlock.h> |
|
39#include <sys/sglist.h> 40#include <vm/vm.h> 41#include <vm/vm_param.h> 42#include <vm/vm_object.h> 43#include <vm/vm_page.h> 44#include <vm/vm_pager.h> 45#include <vm/vm_phys.h> 46#include <vm/uma.h> --- 90 unchanged lines hidden (view full) --- 137 struct sglist *sg; 138 vm_page_t m_paddr, page; 139 vm_pindex_t offset; 140 vm_paddr_t paddr; 141 vm_memattr_t memattr; 142 size_t space; 143 int i; 144 | 40#include <sys/sglist.h> 41#include <vm/vm.h> 42#include <vm/vm_param.h> 43#include <vm/vm_object.h> 44#include <vm/vm_page.h> 45#include <vm/vm_pager.h> 46#include <vm/vm_phys.h> 47#include <vm/uma.h> --- 90 unchanged lines hidden (view full) --- 138 struct sglist *sg; 139 vm_page_t m_paddr, page; 140 vm_pindex_t offset; 141 vm_paddr_t paddr; 142 vm_memattr_t memattr; 143 size_t space; 144 int i; 145 |
145 VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); | 146 VM_OBJECT_ASSERT_WLOCKED(object); |
146 sg = object->handle; 147 memattr = object->memattr; | 147 sg = object->handle; 148 memattr = object->memattr; |
148 VM_OBJECT_UNLOCK(object); | 149 VM_OBJECT_WUNLOCK(object); |
149 offset = m[reqpage]->pindex; 150 151 /* 152 * Lookup the physical address of the requested page. An initial 153 * value of '1' instead of '0' is used so we can assert that the 154 * page is found since '0' can be a valid page-aligned physical 155 * address. 156 */ --- 18 unchanged lines hidden (view full) --- 175 } 176 177 /* Return a fake page for the requested page. */ 178 KASSERT(!(m[reqpage]->flags & PG_FICTITIOUS), 179 ("backing page for SG is fake")); 180 181 /* Construct a new fake page. */ 182 page = vm_page_getfake(paddr, memattr); | 150 offset = m[reqpage]->pindex; 151 152 /* 153 * Lookup the physical address of the requested page. An initial 154 * value of '1' instead of '0' is used so we can assert that the 155 * page is found since '0' can be a valid page-aligned physical 156 * address. 157 */ --- 18 unchanged lines hidden (view full) --- 176 } 177 178 /* Return a fake page for the requested page. */ 179 KASSERT(!(m[reqpage]->flags & PG_FICTITIOUS), 180 ("backing page for SG is fake")); 181 182 /* Construct a new fake page. */ 183 page = vm_page_getfake(paddr, memattr); |
183 VM_OBJECT_LOCK(object); | 184 VM_OBJECT_WLOCK(object); |
184 TAILQ_INSERT_TAIL(&object->un_pager.sgp.sgp_pglist, page, pageq); 185 186 /* Free the original pages and insert this fake page into the object. */ 187 for (i = 0; i < count; i++) { 188 vm_page_lock(m[i]); 189 vm_page_free(m[i]); 190 vm_page_unlock(m[i]); 191 } --- 26 unchanged lines hidden --- | 185 TAILQ_INSERT_TAIL(&object->un_pager.sgp.sgp_pglist, page, pageq); 186 187 /* Free the original pages and insert this fake page into the object. */ 188 for (i = 0; i < count; i++) { 189 vm_page_lock(m[i]); 190 vm_page_free(m[i]); 191 vm_page_unlock(m[i]); 192 } --- 26 unchanged lines hidden --- |