This eliminates more reference counter manipulations.
Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
bool use_projected(client_t client, const MutationRef& mut) const {
return lock.can_read_projected(client) ||
- lock.get_xlock_by() == mut;
+ lock.is_xlocked_by(mut);
}
linkage_t *get_linkage(client_t client, const MutationRef& mut) {
return use_projected(client, mut) ? get_projected_linkage() : get_linkage();
}
} else if (!path_locked &&
!dn->lock.can_read(client) &&
- !(dn->lock.is_xlocked() && dn->lock.get_xlock_by() == mdr)) {
+ !(dn->lock.is_xlocked() && dn->lock.is_xlocked_by(mdr))) {
dout(10) << "traverse: non-readable dentry at " << *dn << dendl;
dn->lock.add_waiter(SimpleLock::WAIT_RD, cf.build());
if (mds->logger)
bool has_xlock_by() const noexcept {
return have_more() && more()->xlock_by;
}
+ bool is_xlocked_by(const MutationRef &who) const noexcept {
+ return have_more() && more()->xlock_by == who;
+ }
// lease
bool is_leased() const {