Lines Matching full:sn
216 struct snapdata *sn; in ffs_snapshot() local
224 sn = NULL; in ffs_snapshot()
670 sn = ffs_snapdata_acquire(devvp); in ffs_snapshot()
675 vp->v_vnlock = &sn->sn_lock; in ffs_snapshot()
677 xp = TAILQ_FIRST(&sn->sn_head); in ffs_snapshot()
702 if (sn->sn_blklist != NULL) in ffs_snapshot()
704 sn->sn_blklist = snapblklist; in ffs_snapshot()
705 sn->sn_listsize = blkp - snapblklist; in ffs_snapshot()
717 TAILQ_INSERT_TAIL(&sn->sn_head, ip, i_nextsnap); in ffs_snapshot()
728 KASSERT(error != 0 || (sn != NULL && copy_fs != NULL), in ffs_snapshot()
749 TAILQ_FOREACH(xp, &sn->sn_head, i_nextsnap) { in ffs_snapshot()
850 space = sn->sn_blklist; in ffs_snapshot()
851 sn->sn_blklist = snapblklist; in ffs_snapshot()
852 sn->sn_listsize = snaplistsize; in ffs_snapshot()
1604 struct snapdata *sn; in ffs_snapgone() local
1611 sn = ITODEVVP(ip)->v_rdev->si_snapdata; in ffs_snapgone()
1612 if (sn != NULL) in ffs_snapgone()
1613 TAILQ_FOREACH(xp, &sn->sn_head, i_nextsnap) in ffs_snapgone()
1655 struct snapdata *sn; in ffs_snapremove() local
1669 sn = devvp->v_rdev->si_snapdata; in ffs_snapremove()
1670 TAILQ_REMOVE(&sn->sn_head, ip, i_nextsnap); in ffs_snapremove()
1672 revert_snaplock(vp, devvp, sn); in ffs_snapremove()
1791 struct snapdata *sn; in ffs_snapblkfree() local
1796 sn = devvp->v_rdev->si_snapdata; in ffs_snapblkfree()
1797 if (sn == NULL) { in ffs_snapblkfree()
1803 * Use LK_SLEEPFAIL because sn might be freed under us while in ffs_snapblkfree()
1806 if (lockmgr(&sn->sn_lock, LK_INTERLOCK | LK_EXCLUSIVE | LK_SLEEPFAIL, in ffs_snapblkfree()
1810 TAILQ_FOREACH(ip, &sn->sn_head, i_nextsnap) { in ffs_snapblkfree()
1986 lockmgr(&sn->sn_lock, LK_RELEASE, NULL); in ffs_snapblkfree()
2000 struct snapdata *sn; in ffs_snapshot_mount() local
2021 sn = NULL; in ffs_snapshot_mount()
2061 sn = ffs_snapdata_acquire(devvp); in ffs_snapshot_mount()
2066 vp->v_vnlock = &sn->sn_lock; in ffs_snapshot_mount()
2076 TAILQ_INSERT_TAIL(&sn->sn_head, ip, i_nextsnap); in ffs_snapshot_mount()
2086 if (sn == NULL || vp == NULL) in ffs_snapshot_mount()
2123 sn->sn_listsize = snaplistsize; in ffs_snapshot_mount()
2124 sn->sn_blklist = (daddr_t *)snapblklist; in ffs_snapshot_mount()
2136 struct snapdata *sn; in ffs_snapshot_unmount() local
2141 sn = devvp->v_rdev->si_snapdata; in ffs_snapshot_unmount()
2142 while (sn != NULL && (xp = TAILQ_FIRST(&sn->sn_head)) != NULL) { in ffs_snapshot_unmount()
2144 TAILQ_REMOVE(&sn->sn_head, xp, i_nextsnap); in ffs_snapshot_unmount()
2146 lockmgr(&sn->sn_lock, LK_INTERLOCK | LK_EXCLUSIVE, in ffs_snapshot_unmount()
2149 revert_snaplock(vp, devvp, sn); in ffs_snapshot_unmount()
2156 sn = devvp->v_rdev->si_snapdata; in ffs_snapshot_unmount()
2170 struct snapdata *sn; in ffs_bp_snapblk() local
2177 sn = devvp->v_rdev->si_snapdata; in ffs_bp_snapblk()
2178 if (sn == NULL || TAILQ_FIRST(&sn->sn_head) == NULL) in ffs_bp_snapblk()
2180 fs = ITOFS(TAILQ_FIRST(&sn->sn_head)); in ffs_bp_snapblk()
2182 snapblklist = sn->sn_blklist; in ffs_bp_snapblk()
2183 upper = sn->sn_listsize - 1; in ffs_bp_snapblk()
2276 struct snapdata *sn; in ffs_copyonwrite() local
2296 sn = devvp->v_rdev->si_snapdata; in ffs_copyonwrite()
2297 if (sn == NULL || in ffs_copyonwrite()
2298 TAILQ_EMPTY(&sn->sn_head)) { in ffs_copyonwrite()
2302 ip = TAILQ_FIRST(&sn->sn_head); in ffs_copyonwrite()
2309 snapblklist = sn->sn_blklist; in ffs_copyonwrite()
2310 upper = sn->sn_listsize - 1; in ffs_copyonwrite()
2338 while (lockmgr(&sn->sn_lock, LK_INTERLOCK | LK_EXCLUSIVE | LK_SLEEPFAIL, in ffs_copyonwrite()
2341 sn = devvp->v_rdev->si_snapdata; in ffs_copyonwrite()
2342 if (sn == NULL || in ffs_copyonwrite()
2343 TAILQ_EMPTY(&sn->sn_head)) { in ffs_copyonwrite()
2352 TAILQ_FOREACH(ip, &sn->sn_head, i_nextsnap) { in ffs_copyonwrite()
2493 struct snapdata *sn; in ffs_sync_snap() local
2503 sn = devvp->v_rdev->si_snapdata; in ffs_sync_snap()
2504 if (sn == NULL) { in ffs_sync_snap()
2508 if (lockmgr(&sn->sn_lock, in ffs_sync_snap()
2513 TAILQ_FOREACH(ip, &sn->sn_head, i_nextsnap) { in ffs_sync_snap()
2517 lockmgr(&sn->sn_lock, LK_RELEASE, NULL); in ffs_sync_snap()
2605 struct snapdata *sn; in ffs_snapdata_alloc() local
2611 sn = LIST_FIRST(&snapfree); in ffs_snapdata_alloc()
2612 if (sn != NULL) in ffs_snapdata_alloc()
2613 LIST_REMOVE(sn, sn_link); in ffs_snapdata_alloc()
2615 if (sn != NULL) in ffs_snapdata_alloc()
2616 return (sn); in ffs_snapdata_alloc()
2620 sn = malloc(sizeof *sn, M_UFSMNT, M_WAITOK | M_ZERO); in ffs_snapdata_alloc()
2621 TAILQ_INIT(&sn->sn_head); in ffs_snapdata_alloc()
2622 lockinit(&sn->sn_lock, PVFS, "snaplk", VLKTIMEOUT, in ffs_snapdata_alloc()
2624 return (sn); in ffs_snapdata_alloc()
2633 ffs_snapdata_free(struct snapdata *sn) in ffs_snapdata_free() argument
2636 LIST_INSERT_HEAD(&snapfree, sn, sn_link); in ffs_snapdata_free()
2644 struct snapdata *sn; in try_free_snapdata() local
2648 sn = devvp->v_rdev->si_snapdata; in try_free_snapdata()
2650 if (sn == NULL || TAILQ_FIRST(&sn->sn_head) != NULL || in try_free_snapdata()
2656 lockmgr(&sn->sn_lock, LK_DRAIN|LK_INTERLOCK, VI_MTX(devvp)); in try_free_snapdata()
2657 snapblklist = sn->sn_blklist; in try_free_snapdata()
2658 sn->sn_blklist = NULL; in try_free_snapdata()
2659 sn->sn_listsize = 0; in try_free_snapdata()
2660 lockmgr(&sn->sn_lock, LK_RELEASE, NULL); in try_free_snapdata()
2663 ffs_snapdata_free(sn); in try_free_snapdata()
2677 struct snapdata *sn) in revert_snaplock() argument
2687 for (i = 0; i <= sn->sn_lock.lk_recurse; i++) { in revert_snaplock()
2697 KASSERT(vp->v_vnlock == &sn->sn_lock, in revert_snaplock()
2700 while (sn->sn_lock.lk_recurse > 0) in revert_snaplock()
2701 lockmgr(&sn->sn_lock, LK_RELEASE, NULL); in revert_snaplock()
2702 lockmgr(&sn->sn_lock, LK_RELEASE, NULL); in revert_snaplock()
2708 struct snapdata *nsn, *sn; in ffs_snapdata_acquire() local
2720 sn = devvp->v_rdev->si_snapdata; in ffs_snapdata_acquire()
2721 if (sn == NULL) { in ffs_snapdata_acquire()
2725 * snapdata. Publish sn with the sn_lock in ffs_snapdata_acquire()
2731 panic("leaked sn, lockmgr error %d", error); in ffs_snapdata_acquire()
2732 sn = devvp->v_rdev->si_snapdata = nsn; in ffs_snapdata_acquire()
2742 error = lockmgr(&sn->sn_lock, LK_INTERLOCK | in ffs_snapdata_acquire()
2754 return (sn); in ffs_snapdata_acquire()