1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #pragma ident "%Z%%M% %I% %E% SMI" 28 29 #include <sys/types.h> 30 #include <sys/param.h> 31 #include <sys/systm.h> 32 #include <sys/buf.h> 33 #include <sys/cred.h> 34 #include <sys/errno.h> 35 #include <sys/vnode.h> 36 #include <sys/cmn_err.h> 37 #include <sys/swap.h> 38 #include <sys/mman.h> 39 #include <sys/vmsystm.h> 40 #include <sys/vtrace.h> 41 #include <sys/debug.h> 42 #include <sys/sysmacros.h> 43 #include <sys/vm.h> 44 45 #include <sys/fs/swapnode.h> 46 47 #include <vm/seg.h> 48 #include <vm/page.h> 49 #include <vm/pvn.h> 50 #include <fs/fs_subr.h> 51 52 #include <vm/seg_kp.h> 53 54 /* 55 * Define the routines within this file. 56 */ 57 static int swap_getpage(struct vnode *vp, offset_t off, size_t len, 58 uint_t *protp, struct page **plarr, size_t plsz, 59 struct seg *seg, caddr_t addr, enum seg_rw rw, struct cred *cr); 60 static int swap_putpage(struct vnode *vp, offset_t off, size_t len, 61 int flags, struct cred *cr); 62 static void swap_inactive(struct vnode *vp, struct cred *cr); 63 static void swap_dispose(vnode_t *vp, page_t *pp, int fl, int dn, 64 cred_t *cr); 65 66 static int swap_getapage(struct vnode *vp, u_offset_t off, size_t len, 67 uint_t *protp, page_t **plarr, size_t plsz, 68 struct seg *seg, caddr_t addr, enum seg_rw rw, struct cred *cr); 69 70 int swap_getconpage(struct vnode *vp, u_offset_t off, size_t len, 71 uint_t *protp, page_t **plarr, size_t plsz, page_t *conpp, spgcnt_t *nreloc, 72 struct seg *seg, caddr_t addr, enum seg_rw rw, struct cred *cr); 73 74 static int swap_putapage(struct vnode *vp, page_t *pp, u_offset_t *off, 75 size_t *lenp, int flags, struct cred *cr); 76 77 const fs_operation_def_t swap_vnodeops_template[] = { 78 VOPNAME_INACTIVE, (fs_generic_func_p) swap_inactive, 79 VOPNAME_GETPAGE, swap_getpage, 80 VOPNAME_PUTPAGE, swap_putpage, 81 VOPNAME_DISPOSE, (fs_generic_func_p) swap_dispose, 82 VOPNAME_SETFL, fs_error, 83 VOPNAME_POLL, fs_error, 84 VOPNAME_PATHCONF, fs_error, 85 VOPNAME_GETSECATTR, fs_error, 86 VOPNAME_SHRLOCK, fs_error, 87 NULL, NULL 88 }; 89 90 vnodeops_t *swap_vnodeops; 91 92 /* ARGSUSED */ 93 static void 94 swap_inactive( 95 struct vnode *vp, 96 struct cred *cr) 97 { 98 SWAPFS_PRINT(SWAP_VOPS, "swap_inactive: vp %x\n", vp, 0, 0, 0, 0); 99 } 100 101 /* 102 * Return all the pages from [off..off+len] in given file 103 */ 104 static int 105 swap_getpage( 106 struct vnode *vp, 107 offset_t off, 108 size_t len, 109 uint_t *protp, 110 page_t *pl[], 111 size_t plsz, 112 struct seg *seg, 113 caddr_t addr, 114 enum seg_rw rw, 115 struct cred *cr) 116 { 117 int err; 118 119 SWAPFS_PRINT(SWAP_VOPS, "swap_getpage: vp %p, off %llx, len %lx\n", 120 (void *)vp, off, len, 0, 0); 121 122 TRACE_3(TR_FAC_SWAPFS, TR_SWAPFS_GETPAGE, 123 "swapfs getpage:vp %p off %llx len %ld", 124 (void *)vp, off, len); 125 126 if (len <= PAGESIZE) { 127 err = swap_getapage(vp, (u_offset_t)off, len, protp, pl, plsz, 128 seg, addr, rw, cr); 129 } else { 130 err = pvn_getpages(swap_getapage, vp, (u_offset_t)off, len, 131 protp, pl, plsz, seg, addr, rw, cr); 132 } 133 134 return (err); 135 } 136 137 /* 138 * Called from pvn_getpages or swap_getpage to get a particular page. 139 */ 140 /*ARGSUSED*/ 141 static int 142 swap_getapage( 143 struct vnode *vp, 144 u_offset_t off, 145 size_t len, 146 uint_t *protp, 147 page_t *pl[], 148 size_t plsz, 149 struct seg *seg, 150 caddr_t addr, 151 enum seg_rw rw, 152 struct cred *cr) 153 { 154 struct page *pp, *rpp; 155 int flags; 156 int err = 0; 157 struct vnode *pvp = NULL; 158 u_offset_t poff; 159 int flag_noreloc; 160 se_t lock; 161 extern int kcage_on; 162 int upgrade = 0; 163 164 SWAPFS_PRINT(SWAP_VOPS, "swap_getapage: vp %p, off %llx, len %lx\n", 165 vp, off, len, 0, 0); 166 167 /* 168 * Until there is a call-back mechanism to cause SEGKP 169 * pages to be unlocked, make them non-relocatable. 170 */ 171 if (SEG_IS_SEGKP(seg)) 172 flag_noreloc = PG_NORELOC; 173 else 174 flag_noreloc = 0; 175 176 if (protp != NULL) 177 *protp = PROT_ALL; 178 179 lock = (rw == S_CREATE ? SE_EXCL : SE_SHARED); 180 181 again: 182 if (pp = page_lookup(vp, off, lock)) { 183 /* 184 * In very rare instances, a segkp page may have been 185 * relocated outside of the kernel by the kernel cage 186 * due to the window between page_unlock() and 187 * VOP_PUTPAGE() in segkp_unlock(). Due to the 188 * rareness of these occurances, the solution is to 189 * relocate the page to a P_NORELOC page. 190 */ 191 if (flag_noreloc != 0) { 192 if (!PP_ISNORELOC(pp) && kcage_on) { 193 if (lock != SE_EXCL) { 194 upgrade = 1; 195 if (!page_tryupgrade(pp)) { 196 page_unlock(pp); 197 lock = SE_EXCL; 198 goto again; 199 } 200 } 201 202 if (page_relocate_cage(&pp, &rpp) != 0) 203 panic("swap_getapage: " 204 "page_relocate_cage failed"); 205 206 pp = rpp; 207 } 208 } 209 210 if (pl) { 211 if (upgrade) 212 page_downgrade(pp); 213 214 pl[0] = pp; 215 pl[1] = NULL; 216 } else { 217 page_unlock(pp); 218 } 219 } else { 220 pp = page_create_va(vp, off, PAGESIZE, 221 PG_WAIT | PG_EXCL | flag_noreloc, 222 seg, addr); 223 /* 224 * Someone raced in and created the page after we did the 225 * lookup but before we did the create, so go back and 226 * try to look it up again. 227 */ 228 if (pp == NULL) 229 goto again; 230 if (rw != S_CREATE) { 231 err = swap_getphysname(vp, off, &pvp, &poff); 232 if (pvp) { 233 struct anon *ap; 234 kmutex_t *ahm; 235 236 flags = (pl == NULL ? B_ASYNC|B_READ : B_READ); 237 err = VOP_PAGEIO(pvp, pp, poff, 238 PAGESIZE, flags, cr); 239 240 if (!err) { 241 ahm = &anonhash_lock[AH_LOCK(vp, off)]; 242 mutex_enter(ahm); 243 244 ap = swap_anon(vp, off); 245 if (ap == NULL) 246 panic("swap_getapage: null anon"); 247 248 if (ap->an_pvp == pvp && 249 ap->an_poff == poff) { 250 swap_phys_free(pvp, poff, 251 PAGESIZE); 252 ap->an_pvp = NULL; 253 ap->an_poff = NULL; 254 hat_setmod(pp); 255 } 256 257 mutex_exit(ahm); 258 } 259 } else { 260 if (!err) 261 pagezero(pp, 0, PAGESIZE); 262 263 /* 264 * If it's a fault ahead, release page_io_lock 265 * and SE_EXCL we grabbed in page_create_va 266 * 267 * If we are here, we haven't called VOP_PAGEIO 268 * and thus calling pvn_read_done(pp, B_READ) 269 * below may mislead that we tried i/o. Besides, 270 * in case of async, pvn_read_done() should 271 * not be called by *getpage() 272 */ 273 if (pl == NULL) { 274 /* 275 * swap_getphysname can return error 276 * only when we are getting called from 277 * swapslot_free which passes non-NULL 278 * pl to VOP_GETPAGE. 279 */ 280 ASSERT(err == 0); 281 page_io_unlock(pp); 282 page_unlock(pp); 283 } 284 } 285 } 286 287 ASSERT(pp != NULL); 288 289 if (err && pl) 290 pvn_read_done(pp, B_ERROR); 291 292 if (!err && pl) 293 pvn_plist_init(pp, pl, plsz, off, PAGESIZE, rw); 294 } 295 TRACE_3(TR_FAC_SWAPFS, TR_SWAPFS_GETAPAGE, 296 "swapfs getapage:pp %p vp %p off %llx", pp, vp, off); 297 return (err); 298 } 299 300 /* 301 * Called from large page anon routines only! This is an ugly hack where 302 * the anon layer directly calls into swapfs with a preallocated large page. 303 * Another method would have been to change to VOP and add an extra arg for 304 * the preallocated large page. This all could be cleaned up later when we 305 * solve the anonymous naming problem and no longer need to loop across of 306 * the VOP in PAGESIZE increments to fill in or initialize a large page as 307 * is done today. I think the latter is better since it avoid a change to 308 * the VOP interface that could later be avoided. 309 */ 310 int 311 swap_getconpage( 312 struct vnode *vp, 313 u_offset_t off, 314 size_t len, 315 uint_t *protp, 316 page_t *pl[], 317 size_t plsz, 318 page_t *conpp, 319 spgcnt_t *nreloc, 320 struct seg *seg, 321 caddr_t addr, 322 enum seg_rw rw, 323 struct cred *cr) 324 { 325 struct page *pp; 326 int err = 0; 327 struct vnode *pvp = NULL; 328 u_offset_t poff; 329 330 ASSERT(len == PAGESIZE); 331 ASSERT(pl != NULL); 332 ASSERT(plsz == PAGESIZE); 333 ASSERT(protp == NULL); 334 ASSERT(nreloc != NULL); 335 ASSERT(!SEG_IS_SEGKP(seg)); /* XXX for now not supported */ 336 SWAPFS_PRINT(SWAP_VOPS, "swap_getconpage: vp %p, off %llx, len %lx\n", 337 vp, off, len, 0, 0); 338 339 /* 340 * If we are not using a preallocated page then we know one already 341 * exists. So just let the old code handle it. 342 */ 343 if (conpp == NULL) { 344 err = swap_getapage(vp, (u_offset_t)off, len, protp, pl, plsz, 345 seg, addr, rw, cr); 346 return (err); 347 } 348 ASSERT(conpp->p_szc != 0); 349 ASSERT(PAGE_EXCL(conpp)); 350 351 352 ASSERT(conpp->p_next == conpp); 353 ASSERT(conpp->p_prev == conpp); 354 ASSERT(!PP_ISAGED(conpp)); 355 ASSERT(!PP_ISFREE(conpp)); 356 357 *nreloc = 0; 358 pp = page_lookup_create(vp, off, SE_SHARED, conpp, nreloc, 0); 359 360 /* 361 * If existing page is found we may need to relocate. 362 */ 363 if (pp != conpp) { 364 ASSERT(rw != S_CREATE); 365 ASSERT(PAGE_SHARED(pp)); 366 if (pp->p_szc < conpp->p_szc) { 367 page_unlock(pp); 368 err = -1; 369 } else if (pp->p_szc > conpp->p_szc) { 370 page_unlock(pp); 371 err = -2; 372 } else { 373 pl[0] = pp; 374 pl[1] = NULL; 375 if (page_pptonum(pp) & 376 (page_get_pagecnt(pp->p_szc) - 1)) 377 cmn_err(CE_PANIC, "swap_getconpage: no root"); 378 } 379 return (err); 380 } 381 382 ASSERT(PAGE_EXCL(pp)); 383 384 if (*nreloc != 0) { 385 ASSERT(rw != S_CREATE); 386 pl[0] = pp; 387 pl[1] = NULL; 388 return (0); 389 } 390 391 *nreloc = 1; 392 393 /* 394 * If necessary do the page io. 395 */ 396 if (rw != S_CREATE) { 397 /* 398 * Since we are only called now on behalf of an 399 * address space operation it's impossible for 400 * us to fail unlike swap_getapge() which 401 * also gets called from swapslot_free(). 402 */ 403 if (swap_getphysname(vp, off, &pvp, &poff)) { 404 cmn_err(CE_PANIC, 405 "swap_getconpage: swap_getphysname failed!"); 406 } 407 408 if (pvp) { 409 err = VOP_PAGEIO(pvp, pp, poff, PAGESIZE, B_READ, cr); 410 } else { 411 pagezero(pp, 0, PAGESIZE); 412 } 413 } 414 415 /* 416 * Normally we would let pvn_read_done() destroy 417 * the page on IO error. But since this is a preallocated 418 * page we'll let the anon layer handle it. 419 */ 420 page_io_unlock(pp); 421 if (err != 0) 422 page_hashout(pp, NULL); 423 ASSERT(pp->p_next == pp); 424 ASSERT(pp->p_prev == pp); 425 426 TRACE_3(TR_FAC_SWAPFS, TR_SWAPFS_GETAPAGE, 427 "swapfs getconpage:pp %p vp %p off %llx", pp, vp, off); 428 429 pl[0] = pp; 430 pl[1] = NULL; 431 return (err); 432 } 433 434 /* Async putpage klustering stuff */ 435 int sw_pending_size; 436 extern int klustsize; 437 extern struct async_reqs *sw_getreq(); 438 extern void sw_putreq(struct async_reqs *); 439 extern void sw_putbackreq(struct async_reqs *); 440 extern struct async_reqs *sw_getfree(); 441 extern void sw_putfree(struct async_reqs *); 442 443 static size_t swap_putpagecnt, swap_pagespushed; 444 static size_t swap_otherfail, swap_otherpages; 445 static size_t swap_klustfail, swap_klustpages; 446 static size_t swap_getiofail, swap_getiopages; 447 448 /* 449 * Flags are composed of {B_INVAL, B_DIRTY B_FREE, B_DONTNEED}. 450 * If len == 0, do from off to EOF. 451 */ 452 static int swap_nopage = 0; /* Don't do swap_putpage's if set */ 453 454 /* ARGSUSED */ 455 static int 456 swap_putpage( 457 struct vnode *vp, 458 offset_t off, 459 size_t len, 460 int flags, 461 struct cred *cr) 462 { 463 page_t *pp; 464 u_offset_t io_off; 465 size_t io_len = 0; 466 int err = 0; 467 struct async_reqs *arg; 468 469 if (swap_nopage) 470 return (0); 471 472 ASSERT(vp->v_count != 0); 473 474 SWAPFS_PRINT(SWAP_VOPS, 475 "swap_putpage: vp %p, off %llx len %lx, flags %x\n", 476 (void *)vp, off, len, flags, 0); 477 TRACE_3(TR_FAC_SWAPFS, TR_SWAPFS_PUTPAGE, 478 "swapfs putpage:vp %p off %llx len %ld", (void *)vp, off, len); 479 480 if (vp->v_flag & VNOMAP) 481 return (ENOSYS); 482 483 if (!vn_has_cached_data(vp)) 484 return (0); 485 486 if (len == 0) { 487 if (curproc == proc_pageout) 488 cmn_err(CE_PANIC, "swapfs: pageout can't block"); 489 490 /* Search the entire vp list for pages >= off. */ 491 err = pvn_vplist_dirty(vp, (u_offset_t)off, swap_putapage, 492 flags, cr); 493 } else { 494 u_offset_t eoff; 495 496 /* 497 * Loop over all offsets in the range [off...off + len] 498 * looking for pages to deal with. 499 */ 500 eoff = off + len; 501 for (io_off = (u_offset_t)off; io_off < eoff; 502 io_off += io_len) { 503 /* 504 * If we run out of the async req slot, put the page 505 * now instead of queuing. 506 */ 507 if (flags == (B_ASYNC | B_FREE) && 508 sw_pending_size < klustsize && 509 (arg = sw_getfree())) { 510 /* 511 * If we are clustering, we should allow 512 * pageout to feed us more pages because # of 513 * pushes is limited by # of I/Os, and one 514 * cluster is considered to be one I/O. 515 */ 516 if (pushes) 517 pushes--; 518 519 arg->a_vp = vp; 520 arg->a_off = io_off; 521 arg->a_len = PAGESIZE; 522 arg->a_flags = B_ASYNC | B_FREE; 523 arg->a_cred = kcred; 524 sw_putreq(arg); 525 io_len = PAGESIZE; 526 continue; 527 } 528 /* 529 * If we are not invalidating pages, use the 530 * routine page_lookup_nowait() to prevent 531 * reclaiming them from the free list. 532 */ 533 if ((flags & B_INVAL) || 534 (flags & (B_ASYNC | B_FREE)) == B_FREE) 535 pp = page_lookup(vp, io_off, SE_EXCL); 536 else 537 pp = page_lookup_nowait(vp, io_off, 538 (flags & B_FREE) ? SE_EXCL : SE_SHARED); 539 540 if (pp == NULL || pvn_getdirty(pp, flags) == 0) 541 io_len = PAGESIZE; 542 else { 543 err = swap_putapage(vp, pp, &io_off, &io_len, 544 flags, cr); 545 if (err != 0) 546 break; 547 } 548 } 549 } 550 /* If invalidating, verify all pages on vnode list are gone. */ 551 if (err == 0 && off == 0 && len == 0 && 552 (flags & B_INVAL) && vn_has_cached_data(vp)) { 553 cmn_err(CE_WARN, 554 "swap_putpage: B_INVAL, pages not gone"); 555 } 556 return (err); 557 } 558 559 /* 560 * Write out a single page. 561 * For swapfs this means choose a physical swap slot and write the page 562 * out using VOP_PAGEIO. 563 * In the (B_ASYNC | B_FREE) case we try to find a bunch of other dirty 564 * swapfs pages, a bunch of contiguous swap slots and then write them 565 * all out in one clustered i/o. 566 */ 567 /*ARGSUSED*/ 568 static int 569 swap_putapage( 570 struct vnode *vp, 571 page_t *pp, 572 u_offset_t *offp, 573 size_t *lenp, 574 int flags, 575 struct cred *cr) 576 { 577 int err; 578 struct vnode *pvp; 579 u_offset_t poff, off; 580 u_offset_t doff; 581 size_t dlen; 582 size_t klsz = 0; 583 u_offset_t klstart = 0; 584 struct vnode *klvp = NULL; 585 page_t *pplist; 586 se_t se; 587 struct async_reqs *arg; 588 size_t swap_klustsize; 589 590 /* 591 * This check is added for callers who access swap_putpage with len = 0. 592 * swap_putpage calls swap_putapage page-by-page via pvn_vplist_dirty. 593 * And it's necessary to do the same queuing if users have the same 594 * B_ASYNC|B_FREE flags on. 595 */ 596 if (flags == (B_ASYNC | B_FREE) && 597 sw_pending_size < klustsize && (arg = sw_getfree())) { 598 599 hat_setmod(pp); 600 page_io_unlock(pp); 601 page_unlock(pp); 602 603 arg->a_vp = vp; 604 arg->a_off = pp->p_offset; 605 arg->a_len = PAGESIZE; 606 arg->a_flags = B_ASYNC | B_FREE; 607 arg->a_cred = kcred; 608 sw_putreq(arg); 609 610 return (0); 611 } 612 613 SWAPFS_PRINT(SWAP_PUTP, 614 "swap_putapage: pp %p, vp %p, off %llx, flags %x\n", 615 pp, vp, pp->p_offset, flags, 0); 616 617 ASSERT(PAGE_LOCKED(pp)); 618 619 off = pp->p_offset; 620 621 doff = off; 622 dlen = PAGESIZE; 623 624 if (err = swap_newphysname(vp, off, &doff, &dlen, &pvp, &poff)) { 625 err = (flags == (B_ASYNC | B_FREE) ? ENOMEM : 0); 626 hat_setmod(pp); 627 page_io_unlock(pp); 628 page_unlock(pp); 629 goto out; 630 } 631 632 klvp = pvp; 633 klstart = poff; 634 pplist = pp; 635 /* 636 * If this is ASYNC | FREE and we've accumulated a bunch of such 637 * pending requests, kluster. 638 */ 639 if (flags == (B_ASYNC | B_FREE)) 640 swap_klustsize = klustsize; 641 else 642 swap_klustsize = PAGESIZE; 643 se = (flags & B_FREE ? SE_EXCL : SE_SHARED); 644 klsz = PAGESIZE; 645 while (klsz < swap_klustsize) { 646 if ((arg = sw_getreq()) == NULL) { 647 swap_getiofail++; 648 swap_getiopages += btop(klsz); 649 break; 650 } 651 ASSERT(vn_matchops(arg->a_vp, swap_vnodeops)); 652 vp = arg->a_vp; 653 off = arg->a_off; 654 655 if ((pp = page_lookup_nowait(vp, off, se)) == NULL) { 656 swap_otherfail++; 657 swap_otherpages += btop(klsz); 658 sw_putfree(arg); 659 break; 660 } 661 if (pvn_getdirty(pp, flags | B_DELWRI) == 0) { 662 sw_putfree(arg); 663 continue; 664 } 665 /* Get new physical backing store for the page */ 666 doff = off; 667 dlen = PAGESIZE; 668 if (err = swap_newphysname(vp, off, &doff, &dlen, 669 &pvp, &poff)) { 670 swap_otherfail++; 671 swap_otherpages += btop(klsz); 672 hat_setmod(pp); 673 page_io_unlock(pp); 674 page_unlock(pp); 675 sw_putbackreq(arg); 676 break; 677 } 678 /* Try to cluster new physical name with previous ones */ 679 if (klvp == pvp && poff == klstart + klsz) { 680 klsz += PAGESIZE; 681 page_add(&pplist, pp); 682 pplist = pplist->p_next; 683 sw_putfree(arg); 684 } else if (klvp == pvp && poff == klstart - PAGESIZE) { 685 klsz += PAGESIZE; 686 klstart -= PAGESIZE; 687 page_add(&pplist, pp); 688 sw_putfree(arg); 689 } else { 690 swap_klustfail++; 691 swap_klustpages += btop(klsz); 692 hat_setmod(pp); 693 page_io_unlock(pp); 694 page_unlock(pp); 695 sw_putbackreq(arg); 696 break; 697 } 698 } 699 700 err = VOP_PAGEIO(klvp, pplist, klstart, klsz, 701 B_WRITE | flags, cr); 702 703 if ((flags & B_ASYNC) == 0) 704 pvn_write_done(pp, ((err) ? B_ERROR : 0) | B_WRITE | flags); 705 706 /* Statistics */ 707 if (!err) { 708 swap_putpagecnt++; 709 swap_pagespushed += btop(klsz); 710 } 711 out: 712 TRACE_4(TR_FAC_SWAPFS, TR_SWAPFS_PUTAPAGE, 713 "swapfs putapage:vp %p klvp %p, klstart %lx, klsz %lx", 714 vp, klvp, klstart, klsz); 715 if (err && err != ENOMEM) 716 cmn_err(CE_WARN, "swapfs_putapage: err %d\n", err); 717 if (lenp) 718 *lenp = PAGESIZE; 719 return (err); 720 } 721 722 static void 723 swap_dispose(vnode_t *vp, page_t *pp, int fl, int dn, cred_t *cr) 724 { 725 int err; 726 u_offset_t off = pp->p_offset; 727 vnode_t *pvp; 728 u_offset_t poff; 729 730 ASSERT(PAGE_EXCL(pp)); 731 732 /* 733 * The caller will free/invalidate large page in one shot instead of 734 * one small page at a time. 735 */ 736 if (pp->p_szc != 0) { 737 page_unlock(pp); 738 return; 739 } 740 741 err = swap_getphysname(vp, off, &pvp, &poff); 742 if (!err && pvp != NULL) 743 VOP_DISPOSE(pvp, pp, fl, dn, cr); 744 else 745 fs_dispose(vp, pp, fl, dn, cr); 746 } 747