]> git.proxmox.com Git - mirror_spl-debian.git/blobdiff - module/spl/spl-tsd.c
New upstream version 0.7.2
[mirror_spl-debian.git] / module / spl / spl-tsd.c
index 4d0800e5a11f5d4b570c79d46dd33ccb3f3de1cf..bf8235063be3d4dfd54871cd84658d1566cabbb2 100644 (file)
@@ -527,6 +527,33 @@ tsd_get(uint_t key)
 }
 EXPORT_SYMBOL(tsd_get);
 
+/*
+ * tsd_get_by_thread - get thread specific data for specified thread
+ * @key: lookup key
+ * @thread: thread to lookup
+ *
+ * Caller must prevent racing tsd_create() or tsd_destroy().  This
+ * implementation is designed to be fast and scalable, it does not
+ * lock the entire table only a single hash bin.
+ */
+void *
+tsd_get_by_thread(uint_t key, kthread_t *thread)
+{
+       tsd_hash_entry_t *entry;
+
+       ASSERT3P(tsd_hash_table, !=, NULL);
+
+       if ((key == 0) || (key > TSD_KEYS_MAX))
+               return (NULL);
+
+       entry = tsd_hash_search(tsd_hash_table, key, thread->pid);
+       if (entry == NULL)
+               return (NULL);
+
+       return (entry->he_value);
+}
+EXPORT_SYMBOL(tsd_get_by_thread);
+
 /*
  * tsd_create - create thread specific data key
  * @keyp: lookup key address