#undef dout_prefix
#define dout_prefix *_dout << "mds." << cache->mds->get_nodeid() << ".cache.dir(" << this->dirfrag() << ") "
-
+int CDir::num_frozen_trees = 0;
+int CDir::num_freezing_trees = 0;
class CDirContext : public MDSInternalContextBase
{
return true;
} else {
state_set(STATE_FREEZINGTREE);
+ ++num_freezing_trees;
dout(10) << "freeze_tree waiting " << *this << dendl;
return false;
}
assert(is_freezeable(true));
// twiddle state
- state_clear(STATE_FREEZINGTREE); // actually, this may get set again by next context?
+ if (state_test(STATE_FREEZINGTREE)) {
+ state_clear(STATE_FREEZINGTREE); // actually, this may get set again by next context?
+ --num_freezing_trees;
+ }
state_set(STATE_FROZENTREE);
+ ++num_frozen_trees;
get(PIN_FROZEN);
// auth_pin inode for duration of freeze, if we are not a subtree root.
if (state_test(STATE_FROZENTREE)) {
// frozen. unfreeze.
state_clear(STATE_FROZENTREE);
+ --num_frozen_trees;
+
put(PIN_FROZEN);
// unpin (may => FREEZEABLE) FIXME: is this order good?
// freezing. stop it.
assert(state_test(STATE_FREEZINGTREE));
state_clear(STATE_FREEZINGTREE);
+ --num_freezing_trees;
auth_unpin(this);
finish_waiting(WAIT_UNFREEZE);
bool CDir::is_freezing_tree() const
{
+ if (num_freezing_trees == 0)
+ return false;
const CDir *dir = this;
while (1) {
if (dir->is_freezing_tree_root()) return true;
bool CDir::is_frozen_tree() const
{
+ if (num_frozen_trees == 0)
+ return false;
const CDir *dir = this;
while (1) {
if (dir->is_frozen_tree_root()) return true;