]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds/SimpleLock: add is_xlocked_by() 60996/head
authorMax Kellermann <max.kellermann@ionos.com>
Wed, 30 Oct 2024 10:51:54 +0000 (11:51 +0100)
committerMax Kellermann <max.kellermann@ionos.com>
Mon, 9 Dec 2024 12:01:02 +0000 (13:01 +0100)
This eliminates more reference counter manipulations.

Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
src/mds/CDentry.h
src/mds/MDCache.cc
src/mds/SimpleLock.h

index ca36da0354f3847ea8641c00cde69166051bb023..205e85b5d3550a0fc7d054d71fb7375f7a8f2832 100644 (file)
@@ -232,7 +232,7 @@ public:
 
   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();
index 3af0d8c6b1ec5ff19f5eca2cb6f090c0fe67a6b0..0c8f8c3665d2a99124dd52832f1b4cbb7840b7ab 100644 (file)
@@ -8524,7 +8524,7 @@ int MDCache::path_traverse(const MDRequestRef& mdr, MDSContextFactory& cf,
        }
       } 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)
index 8ce8970b560afbea9d97fff85158229512feaff9..0749635287837f26ed0b5fdde78d71f969eae230 100644 (file)
@@ -468,6 +468,9 @@ public:
   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 {