This replaces get_xlock_by() in cases where only a not-nullptr check
is needed; this eliminates costly implicit reference counter
manipulations.
Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
}
bool can_xlock_local() const {
- return !is_wrlocked() && (get_xlock_by() == MutationRef());
+ return !is_wrlocked() && !has_xlock_by();
}
bool can_wrlock() const {
// xlock
void get_xlock(MutationRef who, client_t client) {
- ceph_assert(get_xlock_by() == MutationRef());
+ ceph_assert(!has_xlock_by());
ceph_assert(state == LOCK_XLOCK || is_locallock() ||
state == LOCK_LOCK /* if we are a peer */);
parent->get(MDSCacheObject::PIN_LOCK);
MutationRef get_xlock_by() const {
return have_more() ? more()->xlock_by : MutationRef();
}
+ bool has_xlock_by() const noexcept {
+ return have_more() && more()->xlock_by;
+ }
// lease
bool is_leased() const {