uint64_t mds_bmap_timeotbl_getnextseq(void) { int locked; uint64_t hwm; locked = reqlock(&mdsBmapTimeoTbl.btt_lock); /* * Skip zero sequence number because the client does not * like it. More work is needed when an IOS decides if * a smaller sequence number is actually ahead of a larger * one after a wrap around happens. */ mdsBmapTimeoTbl.btt_maxseq++; if (mdsBmapTimeoTbl.btt_maxseq == BMAPSEQ_ANY) { OPSTAT_INCR("seqno-wrap"); mdsBmapTimeoTbl.btt_maxseq = 1; } hwm = mdsBmapTimeoTbl.btt_maxseq; mds_bmap_timeotbl_journal_seqno(); ureqlock(&mdsBmapTimeoTbl.btt_lock, locked); return (hwm); }
void psc_memnode_setkey(struct psc_memnode *pmn, int pos, void *val) { int locked; locked = reqlock(&pmn->pmn_lock); if (psc_dynarray_ensurelen(&pmn->pmn_keys, pos + 1) == -1) psc_fatalx("ensurelen"); psc_dynarray_setpos(&pmn->pmn_keys, pos, val); ureqlock(&pmn->pmn_lock, locked); }
void * psc_memnode_getkey(struct psc_memnode *pmn, int key) { int locked; void *val; val = NULL; locked = reqlock(&pmn->pmn_lock); if (psc_dynarray_len(&pmn->pmn_keys) > key) val = psc_dynarray_getpos(&pmn->pmn_keys, key); ureqlock(&pmn->pmn_lock, locked); return (val); }
int mds_bmap_getcurseq(uint64_t *maxseq, uint64_t *minseq) { int locked; locked = reqlock(&mdsBmapTimeoTbl.btt_lock); if (maxseq) *maxseq = mdsBmapTimeoTbl.btt_maxseq; if (minseq) *minseq = mdsBmapTimeoTbl.btt_minseq; ureqlock(&mdsBmapTimeoTbl.btt_lock, locked); return (0); }
int psc_compl_waitrel(struct psc_compl *pc, enum pfl_lockprim type, void *lockp, long sec, long nsec) { reqlock(&pc->pc_lock); PFL_LOCKPRIM_ULOCK(type, lockp); if (pc->pc_done) { freelock(&pc->pc_lock); } else { if (sec || nsec) { if (pfl_waitq_waitrel(&pc->pc_wq, &pc->pc_lock, sec, nsec)) return (0); } else pfl_waitq_wait(&pc->pc_wq, &pc->pc_lock); } return (pc->pc_rc); }