out << ")";
}
- out << " " << dn.lock;
- out << " " << dn.versionlock;
+ if (!dn.lock.is_sync_and_unlocked())
+ out << " " << dn.lock;
+ if (!dn.versionlock.is_sync_and_unlocked())
+ out << " " << dn.versionlock;
if (dn.get_projected_version() != dn.get_version())
out << " pv=" << dn.get_projected_version();
// locks
- out << " " << in.authlock;
- out << " " << in.linklock;
+ if (!in.authlock.is_sync_and_unlocked())
+ out << " " << in.authlock;
+ if (!in.linklock.is_sync_and_unlocked())
+ out << " " << in.linklock;
if (in.inode.is_dir()) {
- out << " " << in.dirfragtreelock;
- out << " " << in.snaplock;
- out << " " << in.nestlock;
+ if (!in.dirfragtreelock.is_sync_and_unlocked())
+ out << " " << in.dirfragtreelock;
+ if (!in.snaplock.is_sync_and_unlocked())
+ out << " " << in.snaplock;
+ if (!in.nestlock.is_sync_and_unlocked())
+ out << " " << in.nestlock;
} else {
- out << " " << in.flocklock;
+ if (!in.flocklock.is_sync_and_unlocked())
+ out << " " << in.flocklock;
}
- out << " " << in.filelock;
- out << " " << in.xattrlock;
- out << " " << in.versionlock;
+ if (!in.filelock.is_sync_and_unlocked())
+ out << " " << in.filelock;
+ if (!in.xattrlock.is_sync_and_unlocked())
+ out << " " << in.xattrlock;
+ if (!in.versionlock.is_sync_and_unlocked())
+ out << " " << in.versionlock;
// hack: spit out crap on which clients have caps
if (in.inode.client_ranges.size())
};
more_bits_t *_more;
- bool have_more() { return _more ? true : false; }
+ bool have_more() const { return _more ? true : false; }
void try_clear_more() {
if (_more && _more->empty()) {
delete _more;
}
}
+ bool is_sync_and_unlocked() const {
+ return
+ SimpleLock::is_sync_and_unlocked() &&
+ !is_dirty() &&
+ !is_flushing();
+ }
+
+
xlist<ScatterLock*>::item *get_updated_item() { return &more()->item_updated; }
utime_t get_update_stamp() { return more()->update_stamp; }
void set_update_stamp(utime_t t) { more()->update_stamp = t; }
return have_more() ? _more->scatter_wanted : false;
}
- bool is_dirty() {
+ bool is_dirty() const {
return have_more() ? _more->dirty : false;
}
- bool is_flushing() {
+ bool is_flushing() const {
return have_more() ? _more->flushing : false;
}
// state
- int get_state() { return state; }
+ int get_state() const { return state; }
int set_state(int s) {
state = s;
//assert(!is_stable() || gather_set.size() == 0); // gather should be empty in stable states.
take_waiting(SimpleLock::WAIT_ALL, waiters);
}
- bool is_stable() {
+ bool is_stable() const {
return get_sm()->states[state].next == 0;
}
int get_next_state() {
return get_sm()->states[state].next;
}
+
+ bool is_sync_and_unlocked() const {
+ return
+ get_state() == LOCK_SYNC &&
+ !is_rdlocked() &&
+ !is_leased() &&
+ !is_wrlocked() &&
+ !is_xlocked();
+ }
+
+
/*
bool fw_rdlock_to_auth() {
return get_sm()->states[state].can_rdlock == FW;
}
// rdlock
- bool is_rdlocked() { return num_rdlock > 0; }
+ bool is_rdlocked() const { return num_rdlock > 0; }
int get_rdlock() {
if (!num_rdlock)
parent->get(MDSCacheObject::PIN_LOCK);
try_clear_more();
}
}
- bool is_wrlocked() { return have_more() && more()->num_wrlock > 0; }
+ bool is_wrlocked() const { return have_more() && more()->num_wrlock > 0; }
int get_num_wrlocks() { return have_more() ? more()->num_wrlock : 0; }
// xlock
try_clear_more();
}
}
- bool is_xlocked() { return have_more() && more()->num_xlock > 0; }
+ bool is_xlocked() const { return have_more() && more()->num_xlock > 0; }
int get_num_xlocks() { return have_more() ? more()->num_xlock : 0; }
client_t get_xlock_by_client() {
return have_more() ? more()->xlock_by_client : -1;
try_clear_more();
}
}
- bool is_leased() { return num_client_lease > 0; }
+ bool is_leased() const { return num_client_lease > 0; }
int get_num_client_lease() {
return num_client_lease;
}