Lines Matching refs:sidp

165 static int snap_getchunk(struct snapshot_id *sidp, chunknumber_t chunk,
436 struct snapshot_id *sidp, *sidnextp; in snap_detach() local
449 for (sidp = snapshot; sidp != NULL; sidp = sidnextp) { in snap_detach()
450 ASSERT(SID_AVAILABLE(sidp) && in snap_detach()
451 !RW_LOCK_HELD(&sidp->sid_rwlock)); in snap_detach()
452 sidnextp = sidp->sid_next; in snap_detach()
453 rw_destroy(&sidp->sid_rwlock); in snap_detach()
454 kmem_free(sidp, sizeof (struct snapshot_id)); in snap_detach()
484 struct snapshot_id **sidpp, *sidp; in snap_open() local
512 sidp = *sidpp; in snap_open()
513 rw_enter(&sidp->sid_rwlock, RW_WRITER); in snap_open()
515 if ((flag & FEXCL) && SID_BUSY(sidp)) { in snap_open()
516 rw_exit(&sidp->sid_rwlock); in snap_open()
520 ASSERT(sidpp != NULL && sidp != NULL); in snap_open()
522 if (SID_INACTIVE(sidp)) { in snap_open()
525 rw_exit(&sidp->sid_rwlock); in snap_open()
531 sidp->sid_flags |= SID_CHAR_BUSY; in snap_open()
534 sidp->sid_flags |= SID_BLOCK_BUSY; in snap_open()
537 rw_exit(&sidp->sid_rwlock); in snap_open()
541 rw_exit(&sidp->sid_rwlock); in snap_open()
561 struct snapshot_id **sidpp, *sidp; in snap_close() local
581 sidp = *sidpp; in snap_close()
583 rw_enter(&sidp->sid_rwlock, RW_WRITER); in snap_close()
588 sidp->sid_flags &= ~(SID_CHAR_BUSY); in snap_close()
591 sidp->sid_flags &= ~(SID_BLOCK_BUSY); in snap_close()
595 rw_exit(&sidp->sid_rwlock); in snap_close()
599 if (SID_AVAILABLE(sidp)) { in snap_close()
610 sidp->sid_snapnumber); in snap_close()
613 sidp->sid_snapnumber); in snap_close()
617 ddi_soft_state_free(statep, sidp->sid_snapnumber); in snap_close()
622 rw_exit(&sidp->sid_rwlock); in snap_close()
660 struct snapshot_id **sidpp, *sidp; in snap_strategy() local
688 sidp = *sidpp; in snap_strategy()
689 ASSERT(sidp); in snap_strategy()
690 rw_enter(&sidp->sid_rwlock, RW_READER); in snap_strategy()
692 if (SID_INACTIVE(sidp)) { in snap_strategy()
696 rw_exit(&sidp->sid_rwlock); in snap_strategy()
707 chunksz = sidp->sid_cowinfo->cow_map.cmap_chunksz; in snap_strategy()
715 chunk = dbtocowchunk(&sidp->sid_cowinfo->cow_map, reqptr); in snap_strategy()
720 if ((error = snap_getchunk(sidp, chunk, off, len, buf)) != 0) { in snap_strategy()
735 rw_exit(&sidp->sid_rwlock); in snap_strategy()
746 rw_exit(&sidp->sid_rwlock); in snap_strategy()
772 snap_getchunk(struct snapshot_id *sidp, chunknumber_t chunk, int offset, in snap_getchunk() argument
775 cow_map_t *cmap = &sidp->sid_cowinfo->cow_map; in snap_getchunk()
783 ASSERT(RW_READ_HELD(&sidp->sid_rwlock)); in snap_getchunk()
833 snapbuf->b_edev = sidp->sid_fvp->v_vfsp->vfs_dev; in snap_getchunk()
904 (sidp->sid_cowinfo->cow_backfile_array)[bf_index], in snap_getchunk()
1070 snapshot_id_t *sidp = NULL; in snap_ioctl() local
1101 for (sidp = snapshot; sidp != NULL; sidp = sidnextp) { in snap_ioctl()
1102 rw_enter(&sidp->sid_rwlock, RW_READER); in snap_ioctl()
1103 sidnextp = sidp->sid_next; in snap_ioctl()
1107 if (sidp->sid_snapnumber == (uint_t)minor && in snap_ioctl()
1108 sidp->sid_fvp) { in snap_ioctl()
1110 vp = sidp->sid_fvp; in snap_ioctl()
1112 rw_exit(&sidp->sid_rwlock); in snap_ioctl()
1117 if (sidp->sid_fvp == vp) { in snap_ioctl()
1118 minor = sidp->sid_snapnumber; in snap_ioctl()
1119 rw_exit(&sidp->sid_rwlock); in snap_ioctl()
1123 rw_exit(&sidp->sid_rwlock); in snap_ioctl()
1336 struct snapshot_id *sidp; in fssnap_strategy_impl() local
1358 sidp = *sidpp; in fssnap_strategy_impl()
1364 if (sidp == NULL) { in fssnap_strategy_impl()
1373 rw_enter(&sidp->sid_rwlock, RW_READER); in fssnap_strategy_impl()
1380 if (sidp->sid_flags & SID_DELETE) { in fssnap_strategy_impl()
1381 rw_exit(&sidp->sid_rwlock); in fssnap_strategy_impl()
1394 if (sidp != *sidpp || SID_INACTIVE(sidp)) { in fssnap_strategy_impl()
1395 rw_exit(&sidp->sid_rwlock); in fssnap_strategy_impl()
1412 if (sidp != *sidpp || SID_INACTIVE(sidp)) { in fssnap_strategy_impl()
1413 rw_exit(&sidp->sid_rwlock); in fssnap_strategy_impl()
1420 rw_exit(&sidp->sid_rwlock); in fssnap_strategy_impl()
1444 snapshot_id_t *sidp = *sidpp; in fssnap_translate() local
1446 struct cow_info *cowp = sidp->sid_cowinfo; in fssnap_translate()
1454 ASSERT(RW_READ_HELD(&sidp->sid_rwlock)); in fssnap_translate()
1546 rw_exit(&sidp->sid_rwlock); in fssnap_translate()
1550 rw_enter(&sidp->sid_rwlock, RW_READER); in fssnap_translate()
1556 if (sidp != *sidpp || SID_INACTIVE(sidp)) { in fssnap_translate()
1600 "%lld, size %lu, error %d.", sidp->sid_snapnumber, in fssnap_translate()
1622 cmn->cmn_sid = sidp; in fssnap_translate()
1659 snapshot_id_t *sidp = cmn->cmn_sid; in fssnap_write_taskq() local
1660 cow_info_t *cowp = sidp->sid_cowinfo; in fssnap_write_taskq()
1674 rw_enter(&sidp->sid_rwlock, RW_READER); in fssnap_write_taskq()
1675 if (SID_INACTIVE(sidp)) { in fssnap_write_taskq()
1676 rw_exit(&sidp->sid_rwlock); in fssnap_write_taskq()
1681 rw_exit(&sidp->sid_rwlock); in fssnap_write_taskq()
1689 "bytes) and will be deleted.", sidp->sid_snapnumber, in fssnap_write_taskq()
1694 atomic_or_uint(&sidp->sid_flags, SID_DELETE); in fssnap_write_taskq()
1707 "%s, offset %llu bytes, error %d.", sidp->sid_snapnumber, in fssnap_write_taskq()
1712 atomic_or_uint(&sidp->sid_flags, SID_DELETE); in fssnap_write_taskq()
1755 struct snapshot_id *sidp; in fssnap_create_impl() local
1776 for (sidp = snapshot; sidp != NULL; sidp = sidp->sid_next) { in fssnap_create_impl()
1777 if (sidp->sid_snapnumber > lastsnap) in fssnap_create_impl()
1778 lastsnap = sidp->sid_snapnumber; in fssnap_create_impl()
1785 rw_enter(&sidp->sid_rwlock, RW_READER); in fssnap_create_impl()
1793 if (SID_AVAILABLE(sidp)) in fssnap_create_impl()
1795 rw_exit(&sidp->sid_rwlock); in fssnap_create_impl()
1803 if (sidp) { in fssnap_create_impl()
1804 if (rw_tryupgrade(&sidp->sid_rwlock) == 0) { in fssnap_create_impl()
1806 rw_exit(&sidp->sid_rwlock); in fssnap_create_impl()
1811 sidp = kmem_alloc(sizeof (struct snapshot_id), KM_SLEEP); in fssnap_create_impl()
1812 rw_init(&sidp->sid_rwlock, NULL, RW_DEFAULT, NULL); in fssnap_create_impl()
1813 rw_enter(&sidp->sid_rwlock, RW_WRITER); in fssnap_create_impl()
1814 sidp->sid_snapnumber = (snapshot == NULL) ? 0 : lastsnap + 1; in fssnap_create_impl()
1815 sidp->sid_cowinfo = NULL; in fssnap_create_impl()
1816 sidp->sid_flags = 0; in fssnap_create_impl()
1817 sidp->sid_next = snapshot; in fssnap_create_impl()
1818 snapshot = sidp; in fssnap_create_impl()
1821 ASSERT(RW_WRITE_HELD(&sidp->sid_rwlock)); in fssnap_create_impl()
1822 ASSERT(sidp->sid_cowinfo == NULL); in fssnap_create_impl()
1823 ASSERT(sidp->sid_snapnumber <= (lastsnap + 1)); in fssnap_create_impl()
1825 sidp->sid_flags |= SID_CREATING; in fssnap_create_impl()
1828 sidp->sid_fvp = fsvp; in fssnap_create_impl()
1845 sidp->sid_snapnumber); in fssnap_create_impl()
1871 sidp->sid_cowinfo = cowp; in fssnap_create_impl()
1875 fssnap_create_kstats(sidp, sidp->sid_snapnumber, in fssnap_create_impl()
1885 return (sidp); in fssnap_create_impl()
1941 struct snapshot_id **sidpp, *sidp = snapshot_id; in fssnap_create_done_impl() local
1948 ASSERT(sidp); in fssnap_create_done_impl()
1949 ASSERT(RW_WRITE_HELD(&sidp->sid_rwlock)); in fssnap_create_done_impl()
1950 ASSERT(sidp->sid_cowinfo); in fssnap_create_done_impl()
1952 cowp = sidp->sid_cowinfo; in fssnap_create_done_impl()
1957 sidp->sid_flags &= ~(SID_CREATING | SID_DISABLED); in fssnap_create_done_impl()
1958 snapnumber = sidp->sid_snapnumber; in fssnap_create_done_impl()
1970 *sidpp = sidp; in fssnap_create_done_impl()
1992 rw_exit(&sidp->sid_rwlock); in fssnap_create_done_impl()
2022 struct snapshot_id *sidp; in fssnap_delete_impl() local
2038 sidp = *sidpp; in fssnap_delete_impl()
2039 rw_enter(&sidp->sid_rwlock, RW_WRITER); in fssnap_delete_impl()
2041 ASSERT(RW_WRITE_HELD(&sidp->sid_rwlock)); in fssnap_delete_impl()
2047 rw_exit(&sidp->sid_rwlock); in fssnap_delete_impl()
2058 sidp->sid_flags |= SID_DISABLING; in fssnap_delete_impl()
2059 if (sidp->sid_flags & SID_DELETE) { in fssnap_delete_impl()
2061 sidp->sid_snapnumber); in fssnap_delete_impl()
2062 sidp->sid_flags &= ~(SID_DELETE); in fssnap_delete_impl()
2075 cowp = sidp->sid_cowinfo; in fssnap_delete_impl()
2077 rw_exit(&sidp->sid_rwlock); in fssnap_delete_impl()
2080 rw_exit(&sidp->sid_rwlock); in fssnap_delete_impl()
2096 sidp->sid_cowinfo = NULL; in fssnap_delete_impl()
2124 statesidpp = ddi_get_soft_state(statep, sidp->sid_snapnumber); in fssnap_delete_impl()
2128 sidp->sid_snapnumber); in fssnap_delete_impl()
2130 ASSERT(*statesidpp == sidp); in fssnap_delete_impl()
2138 rw_enter(&sidp->sid_rwlock, RW_WRITER); in fssnap_delete_impl()
2139 sidp->sid_flags &= ~(SID_DISABLING); in fssnap_delete_impl()
2140 sidp->sid_flags |= SID_DISABLED; in fssnap_delete_impl()
2141 VN_RELE(sidp->sid_fvp); in fssnap_delete_impl()
2142 sidp->sid_fvp = NULL; in fssnap_delete_impl()
2143 snapnumber = sidp->sid_snapnumber; in fssnap_delete_impl()
2150 if (SID_AVAILABLE(sidp)) { in fssnap_delete_impl()
2154 sidp->sid_snapnumber); in fssnap_delete_impl()
2157 sidp->sid_snapnumber); in fssnap_delete_impl()
2161 ddi_soft_state_free(statep, sidp->sid_snapnumber); in fssnap_delete_impl()
2166 rw_exit(&sidp->sid_rwlock); in fssnap_delete_impl()
2176 fssnap_create_kstats(snapshot_id_t *sidp, int snapnum, in fssnap_create_kstats() argument
2181 struct cow_info *cowp = sidp->sid_cowinfo; in fssnap_create_kstats()
2254 num->ks_private = sidp; in fssnap_create_kstats()
2282 snapshot_id_t *sidp = (snapshot_id_t *)ksp->ks_private; in fssnap_update_kstat_num() local
2283 struct cow_info *cowp = sidp->sid_cowinfo; in fssnap_update_kstat_num()
2290 if (sidp->sid_flags & SID_CREATING) in fssnap_update_kstat_num()
2292 else if (SID_INACTIVE(sidp)) in fssnap_update_kstat_num()
2294 else if (SID_BUSY(sidp)) in fssnap_update_kstat_num()