uint64_t sx_vlsn(sxmanager *m) { ss_spinlock(&m->lock); uint64_t vlsn; if (sx_count(m) > 0) { ssrbnode *node = ss_rbmin(&m->i); sx *min = sscast(node, sx, node); vlsn = min->vlsn; } else { vlsn = sr_seq(m->seq, SR_LSN); } ss_spinunlock(&m->lock); return vlsn; } ss_rbget(sx_matchtx, ss_cmp((sscast(n, sx, node))->id, sscastu64(key))) sx *sx_find(sxmanager *m, uint64_t id) { ssrbnode *n = NULL; int rc = sx_matchtx(&m->i, NULL, (char*)&id, sizeof(id), &n); if (rc == 0 && n) return sscast(n, sx, node); return NULL; } static inline sxstate sx_promote(sx *x, sxstate state) { x->state = state; return state;
uint64_t sx_vlsn(sxmanager *m) { ss_spinlock(&m->lock); uint64_t vlsn; if (sx_count(m) > 0) { ssrbnode *node = ss_rbmin(&m->i); sx *min = sscast(node, sx, node); vlsn = min->vlsn; } else { vlsn = sr_seq(m->r->seq, SR_LSN); } ss_spinunlock(&m->lock); return vlsn; } ss_rbget(sx_matchtx, ss_cmp((sscast(n, sx, node))->id, *(uint64_t*)key)) sx *sx_find(sxmanager *m, uint64_t id) { ssrbnode *n = NULL; int rc = sx_matchtx(&m->i, NULL, (char*)&id, sizeof(id), &n); if (rc == 0 && n) return sscast(n, sx, node); return NULL; } void sx_init(sxmanager *m, sx *x) { x->manager = m; sv_loginit(&x->log); ss_listinit(&x->deadlock);
static int cmp_s(const struct SMapSx *a, const struct SMapSx *b) { return ss_cmp(a->k, b->k); }