[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 12/17] xen/hypfs: add new enter() and exit() per node callbacks
 
 
On 03.12.20 16:29, Jan Beulich wrote:
 
On 03.12.2020 16:14, Jürgen Groß wrote:
 
On 03.12.20 15:59, Jan Beulich wrote:
 
On 01.12.2020 09:21, Juergen Gross wrote:
 
@@ -100,11 +112,58 @@ static void hypfs_unlock(void)
       }
   }
   
+const struct hypfs_entry *hypfs_node_enter(const struct hypfs_entry *entry)
+{
+    return entry;
+}
+
+void hypfs_node_exit(const struct hypfs_entry *entry)
+{
+}
+
+static int node_enter(const struct hypfs_entry *entry)
+{
+    const struct hypfs_entry **last = &this_cpu(hypfs_last_node_entered);
+
+    entry = entry->funcs->enter(entry);
+    if ( IS_ERR(entry) )
+        return PTR_ERR(entry);
+
+    ASSERT(!*last || *last == entry->parent);
+
+    *last = entry;
+
+    return 0;
+}
+
+static void node_exit(const struct hypfs_entry *entry)
+{
+    const struct hypfs_entry **last = &this_cpu(hypfs_last_node_entered);
+
+    if ( !*last )
+        return;
 
Under what conditions is this legitimate to happen? IOW shouldn't
there be an ASSERT_UNREACHABLE() here?
 
 
This is for the "/" node.
 
 
I.e. would ASSERT(!entry->parent) be appropriate to add here, at
the same time serving as documentation of what you've just said?
 
 
I rechecked and have found that this was a remnant from an earlier
variant. *last won't ever be NULL, so the if can be dropped (a NULL
will be catched by the following ASSERT()).
Juergen
 Attachment:
OpenPGP_0xB0DE9DD628BF132F.asc 
Description: application/pgp-keys 
Attachment:
OpenPGP_signature 
Description: OpenPGP digital signature 
 
    
     |