void fileq::fhclean (bool istmo) { if (istmo) tmo = NULL; if (cleanlock) return; cleanlock = true; fhtimer *fht = NULL; if (minopen < 0 && (fht = timeq.first ()) && fht->expire < sfs_get_timenow()) do { fhtimer *nfht = timeq.next (fht); nfs_fh3 *fhp = New nfs_fh3 (fht->fh); closesim *serv = fht->serv; serv->fhfree (fht); vNew nfscall_cb<NFSPROC_CLOSE> (NULL, fhp, wrap (fhcleancb, fhp), serv); fht = nfht; } while (minopen < 0 && fht->expire < sfs_get_timenow()); cleanlock = false; if (!tmo && minopen < 0 && fht) tmo = timecb (min<time_t> (sfs_get_timenow() + 10, fht->expire), wrap (this, &fileq::fhclean, true)); }
void lazycb_check () { time_t my_timenow = 0; restart: lazycb_removed = false; for (lazycb_t *lazy = lazylist->first; lazy; lazy = lazylist->next (lazy)) { if (my_timenow == 0) { sfs_set_global_timestamp (); my_timenow = sfs_get_timenow (); } if (my_timenow < lazy->next) continue; lazy->next = my_timenow + lazy->interval; #ifdef WRAP_DEBUG if (callback_trace & CBTR_LAZY) warn ("CALLBACK_TRACE: %slazy %s <- %s\n", timestring (), lazy->cb->dest, lazy->cb->line); #endif /* WRAP_DEBUG */ STOP_ACHECK_TIMER (); sfs_leave_sel_loop (); (*lazy->cb) (); START_ACHECK_TIMER (); if (lazycb_removed) goto restart; } }
void closesim::fhtouch (fhtimer *fht) { fq->timeq.remove (fht); fht->expire = sfs_get_timenow() + (fht->opened ? closesim_openlife : closesim_minlife); fq->timeq.insert (fht); }
void mtd_thread_t::take_svccb () { svccb *s = cell->sbp; if (s) { start = sfs_get_timenow(); dispatch (s); } }
fhtimer * closesim::fhalloc (const nfs_fh3 &fh) { fhtimer *fht = New fhtimer (this, fh); fht->expire = sfs_get_timenow() + closesim_minlife; fq->minopen--; fq->timeq.insert (fht); fhtab.insert (fht); fq->fhclean (); return fht; }
void mtd_thread_t::did_reply () { time_t tm = sfs_get_timenow() - start; if (tm > LONG_REPLY_TIME) { if (cell->sbp) { TWARN ("long service time (" << tm << " secs) for PROC=" << cell->sbp->proc ()); } else { TWARN ("long service time (" << tm << " secs); no procno given"); } } }
void mtdispatch_t::chld_ready (int i) { readyq.push_back (i); queue_el_t el; while (queue.size () && readyq.size ()) { el = queue.pop_front (); int diff = sfs_get_timenow() - el.timein; if (diff > int (ok_amt_q_timeout)) { warn << "Timeout for object in queue (wait time=" << diff << "s)\n"; el.sbp->reject (PROC_UNAVAIL); g_stats.to (); // report timeout to stats } else { send_svccb (el.sbp); } } }
lazycb_t::lazycb_t (time_t i, cbv c) : interval (i), next (sfs_get_timenow(true) + interval), cb (c) { lazylist->insert_head (this); }