void adjust(double a) {
val += a;
+ if (val < 0)
+ val = 0;
}
void adjust(utime_t now, const DecayRate& rate, double a) {
decay(now, rate);
- val += a;
+ adjust(a);
}
void scale(double f) {
val *= f;
}
}
+void CDir::abort_import(utime_t now)
+{
+ assert(is_auth());
+ state_clear(CDir::STATE_AUTH);
+ remove_bloom();
+ clear_replica_map();
+ set_replica_nonce(CDir::EXPORT_NONCE);
+ if (is_dirty())
+ mark_clean();
+ pop_auth_subtree_nested.sub(now, cache->decayrate, pop_auth_subtree);
+ pop_me.zero(now);
+ pop_auth_subtree.zero(now);
+}
/********************************
put(PIN_TEMPEXPORTING);
}
void decode_import(bufferlist::iterator& blp, utime_t now, LogSegment *ls);
+ void abort_import(utime_t now);
// -- auth pins --
bool can_auth_pin() const override { return is_auth() && !(is_frozen() || is_freezing()); }
import_state_t& stat = import_state[dir->dirfrag()];
stat.state = IMPORT_ABORTING;
+ utime_t now = ceph_clock_now();
+
set<CDir*> bounds;
cache->get_subtree_bounds(dir, bounds);
q.pop_front();
// dir
- assert(cur->is_auth());
- cur->state_clear(CDir::STATE_AUTH);
- cur->remove_bloom();
- cur->clear_replica_map();
- cur->set_replica_nonce(CDir::EXPORT_NONCE);
- if (cur->is_dirty())
- cur->mark_clean();
+ cur->abort_import(now);
for (auto &p : *cur) {
CDentry *dn = p.second;