sg_pager.c (e946b94934e6205383b30f615799b6b60c391a3f) sg_pager.c (c325e866f4c58f7804884581b999849982b2abd6)
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:

--- 110 unchanged lines hidden (view full) ---

119{
120 struct sglist *sg;
121 vm_page_t m;
122
123 /*
124 * Free up our fake pages.
125 */
126 while ((m = TAILQ_FIRST(&object->un_pager.sgp.sgp_pglist)) != 0) {
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:

--- 110 unchanged lines hidden (view full) ---

119{
120 struct sglist *sg;
121 vm_page_t m;
122
123 /*
124 * Free up our fake pages.
125 */
126 while ((m = TAILQ_FIRST(&object->un_pager.sgp.sgp_pglist)) != 0) {
127 TAILQ_REMOVE(&object->un_pager.sgp.sgp_pglist, m, pageq);
127 TAILQ_REMOVE(&object->un_pager.sgp.sgp_pglist, m, plinks.q);
128 vm_page_putfake(m);
129 }
130
131 sg = object->handle;
132 sglist_free(sg);
133}
134
135static int

--- 41 unchanged lines hidden (view full) ---

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);
184 VM_OBJECT_WLOCK(object);
128 vm_page_putfake(m);
129 }
130
131 sg = object->handle;
132 sglist_free(sg);
133}
134
135static int

--- 41 unchanged lines hidden (view full) ---

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);
184 VM_OBJECT_WLOCK(object);
185 TAILQ_INSERT_TAIL(&object->un_pager.sgp.sgp_pglist, page, pageq);
185 TAILQ_INSERT_TAIL(&object->un_pager.sgp.sgp_pglist, page, plinks.q);
186
187 /* Free the original pages and insert this fake page into the object. */
188 for (i = 0; i < count; i++) {
189 if (i == reqpage &&
190 vm_page_replace(page, object, offset) != m[i])
191 panic("sg_pager_getpages: invalid place replacement");
192 vm_page_lock(m[i]);
193 vm_page_free(m[i]);

--- 27 unchanged lines hidden ---
186
187 /* Free the original pages and insert this fake page into the object. */
188 for (i = 0; i < count; i++) {
189 if (i == reqpage &&
190 vm_page_replace(page, object, offset) != m[i])
191 panic("sg_pager_getpages: invalid place replacement");
192 vm_page_lock(m[i]);
193 vm_page_free(m[i]);

--- 27 unchanged lines hidden ---