Lines Matching defs:sp
369 static void swap_pager_swapoff(struct swdevt *sp);
400 static int swapoff_one(struct swdevt *sp, struct ucred *cred);
712 struct swdevt *sp;
717 sp = swdevhd;
719 if (sp == NULL)
720 sp = TAILQ_FIRST(&swtailq);
721 if (!(sp->sw_flags & SW_CLOSING)) {
722 blk = blist_alloc(sp->sw_blist, npages);
724 blk += sp->sw_first;
725 sp->sw_used += npages;
728 swdevhd = TAILQ_NEXT(sp, sw_list);
732 sp = TAILQ_NEXT(sp, sw_list);
746 swp_pager_isondev(daddr_t blk, struct swdevt *sp)
749 return (blk >= sp->sw_first && blk < sp->sw_end);
755 struct swdevt *sp;
758 TAILQ_FOREACH(sp, &swtailq, sw_list) {
759 if (bp->b_blkno >= sp->sw_first && bp->b_blkno < sp->sw_end) {
761 if ((sp->sw_flags & SW_UNMAPPED) != 0 &&
769 sp->sw_strategy(bp, sp);
787 struct swdevt *sp;
790 TAILQ_FOREACH(sp, &swtailq, sw_list) {
791 if (blk >= sp->sw_first && blk < sp->sw_end) {
792 sp->sw_used -= npages;
798 if ((sp->sw_flags & SW_CLOSING) == 0) {
799 blist_free(sp->sw_blist, blk - sp->sw_first,
1582 swap_pager_isswapped(vm_object_t object, struct swdevt *sp)
1598 if (swp_pager_isondev(swap->swb_pages[i], sp)) {
1664 swap_pager_swapoff(struct swdevt *sp)
1680 if (swp_pager_isondev(swap->swb_pages[j], sp)) {
1697 if (sp->sw_used) {
1707 sp->sw_used);
2069 struct swdevt *sp, *tsp;
2094 sp = malloc(sizeof *sp, M_VMPGDATA, M_WAITOK | M_ZERO);
2095 sp->sw_vp = vp;
2096 sp->sw_id = id;
2097 sp->sw_dev = dev;
2098 sp->sw_flags = 0;
2099 sp->sw_nblks = nblks;
2100 sp->sw_used = 0;
2101 sp->sw_strategy = strategy;
2102 sp->sw_close = close;
2103 sp->sw_flags = flags;
2105 sp->sw_blist = blist_create(nblks, M_WAITOK);
2110 blist_free(sp->sw_blist, 2, nblks - 2);
2124 sp->sw_first = dvbase;
2125 sp->sw_end = dvbase + nblks;
2126 TAILQ_INSERT_TAIL(&swtailq, sp, sw_list);
2159 struct swdevt *sp;
2177 TAILQ_FOREACH(sp, &swtailq, sw_list) {
2178 if (sp->sw_vp == vp)
2182 if (sp == NULL) {
2186 error = swapoff_one(sp, td->td_ucred);
2193 swapoff_one(struct swdevt *sp, struct ucred *cred)
2202 (void) vn_lock(sp->sw_vp, LK_EXCLUSIVE | LK_RETRY);
2203 error = mac_system_check_swapoff(cred, sp->sw_vp);
2204 (void) VOP_UNLOCK(sp->sw_vp, 0);
2208 nblks = sp->sw_nblks;
2225 sp->sw_flags |= SW_CLOSING;
2226 for (dvbase = 0; dvbase < sp->sw_end; dvbase += dmmax) {
2227 swap_pager_avail -= blist_fill(sp->sw_blist,
2236 swap_pager_swapoff(sp);
2238 sp->sw_close(curthread, sp);
2240 sp->sw_id = NULL;
2241 TAILQ_REMOVE(&swtailq, sp, sw_list);
2247 if (swdevhd == sp)
2250 blist_destroy(sp->sw_blist);
2251 free(sp, M_VMPGDATA);
2258 struct swdevt *sp, *spt;
2265 TAILQ_FOREACH_SAFE(sp, &swtailq, sw_list, spt) {
2267 if (vn_isdisk(sp->sw_vp, NULL))
2268 devname = devtoname(sp->sw_vp->v_rdev);
2271 error = swapoff_one(sp, thread0.td_ucred);
2288 struct swdevt *sp;
2293 TAILQ_FOREACH(sp, &swtailq, sw_list) {
2294 *total += sp->sw_nblks;
2295 *used += sp->sw_used;
2303 struct swdevt *sp;
2310 TAILQ_FOREACH(sp, &swtailq, sw_list) {
2316 xs->xsw_dev = sp->sw_dev;
2317 xs->xsw_flags = sp->sw_flags;
2318 xs->xsw_nblks = sp->sw_nblks;
2319 xs->xsw_used = sp->sw_used;
2321 if (vn_isdisk(sp->sw_vp, NULL))
2322 tmp_devname = devtoname(sp->sw_vp->v_rdev);
2439 swapgeom_release(struct g_consumer *cp, struct swdevt *sp)
2446 sp->sw_id = NULL;
2453 struct swdevt *sp;
2465 sp = bp2->bio_caller1;
2467 swapgeom_release(cp, sp);
2473 swapgeom_strategy(struct buf *bp, struct swdevt *sp)
2479 cp = sp->sw_id;
2495 swapgeom_release(cp, sp);
2503 bio->bio_caller1 = sp;
2506 bio->bio_offset = (bp->b_blkno - sp->sw_first) * PAGE_SIZE;
2526 struct swdevt *sp;
2530 TAILQ_FOREACH(sp, &swtailq, sw_list) {
2531 if (sp->sw_id == cp) {
2532 sp->sw_flags |= SW_CLOSING;
2542 destroy = ((sp != NULL) && (cp->index == 0));
2544 sp->sw_id = NULL;
2575 struct swdevt *sp;
2583 TAILQ_FOREACH(sp, &swtailq, sw_list) {
2584 cp = sp->sw_id;
2642 swapdev_strategy(struct buf *bp, struct swdevt *sp)
2646 bp->b_blkno = ctodb(bp->b_blkno - sp->sw_first);
2648 vp2 = sp->sw_id;
2664 swapdev_close(struct thread *td, struct swdevt *sp)
2667 VOP_CLOSE(sp->sw_vp, FREAD | FWRITE, td->td_ucred, td);
2668 vrele(sp->sw_vp);
2675 struct swdevt *sp;
2681 TAILQ_FOREACH(sp, &swtailq, sw_list) {
2682 if (sp->sw_id == vp) {