[PATCH v2 2/2] lib/htree: Modified Documentation/core-api/htree.rst

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Implementation of new Hash Tree [PATCH v2]
------------------------------------------
Added description of locking interface

full source:
------------
https://github.com/kernel-bz/htree.git

Manual(PDF):
------------
https://github.com/kernel-bz/htree/blob/main/docs/htree-20240802.pdf

Signed-off-by: JaeJoon Jung <rgbi3307@xxxxxxxxx>
---
 Documentation/core-api/htree.rst | 56 +++++++++++++++++++++++---------
 1 file changed, 40 insertions(+), 16 deletions(-)

diff --git a/Documentation/core-api/htree.rst b/Documentation/core-api/htree.rst
index 78073b413779..186b4c29587f 100644
--- a/Documentation/core-api/htree.rst
+++ b/Documentation/core-api/htree.rst
@@ -85,27 +85,51 @@ Hash Tree Summary (include/linux/htree.h)
 Hash Tree API flow (lib/htree.c, lib/htree-test.c)
 -----------------------------------------------------------------------------
 
-*hts = ht_hts_alloc()           /* alloc hts */
-ht_hts_clear_init(hts, ...)	/* max nr, type(32/64bits), sort(ASC, DES) */
-*htree = ht_table_alloc(hts)    /* alloc first(depth:0) htree */
+DEFINE_HTREE_ROOT(ht_root);     /* define htree_root */
+
+*hts = ht_hts_alloc();          /* alloc hts */
+
+ht_hts_clear_init(hts, ...);    /* max nr, type(32/64bits), sort(ASC, DES) */
+
+htree_root_alloc(hts, &ht_root);/* alloc first(root) hash tree */
 
 run_loop() {
-	*udata = _data_alloc(index)             /* alloc udata */
-	ht_insert(hts, htree, udata->hdata, ..)	/* working data with index */
-	ht_erase(hts, htree, index)
-	hdata = ht_find(hts, htree, index)
-	hdata = ht_most_index(hts, htree)	/* smallest, largest index */
-	ht_statis(hts, htree, ...)		/* statistic */
+        *udata = _data_alloc(index);    /* alloc udata */
+
+        /* working data with index */
+        ht_insert_lock(hts, &ht_root, udata->hdata, ..);
+        ht_erase_lock(hts, &ht_root, index);
+        hdata = ht_find(hts, ht_root.ht_first, index);
+
+        /* smallest, largest index */
+        hdata = ht_most_index(hts, ht_root.ht_first);
+
+        /* statistic */
+        ht_statis(hts, ht_root.ht_first, ...);
 }
 
-htree_erase_all(hts, htree)     /* remove all udata */
-ht_destroy(hts, htree)          /* remove all htree */
-kfree(hts)                      /* remove hts */
+htree_erase_all_lock(hts, &ht_root);    /* remove all udata */
+ht_destroy_lock(hts, &ht_root);         /* remove all htree */
+kfree(hts)                              /* remove hts */
 
 -----------------------------------------------------------------------------
-Please refer to the attached PDF for more detailed information.
+Build (Compile)
 -----------------------------------------------------------------------------
-documents(PDF):
-	https://github.com/kernel-bz/htree/tree/main/docs/htree=20240802.pdf
+lib/Kconfig.debug
 
-Thanks.
++config HTREE_TEST
++       tristate "Hash Tree test"
++       depends on DEBUG_KERNEL
++       help
++         A performance testing of the hash tree library.
++
+
+lib/Makefile
+
++	lib-y += htree.o
++	obj-$(CONFIG_HTREE_TEST) += htree-test.o
+
+-----------------------------------------------------------------------------
+Please refer to the attached PDF for more detailed information:
+https://github.com/kernel-bz/htree/blob/main/docs/htree-20240802.pdf
+-----------------------------------------------------------------------------
-- 
2.17.1





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux