From: JaeJoon Jung <rgbi3307@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>,
Sasha Levin <levinsasha928@gmail.com>,
"Liam R . Howlett" <Liam.Howlett@oracle.com>,
Matthew Wilcox <willy@infradead.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: JaeJoon Jung <rgbi3307@gmail.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
maple-tree@lists.infradead.org, linux-fsdevel@vger.kernel.org
Subject: [PATCH v2 2/2] lib/htree: Modified Documentation/core-api/htree.rst
Date: Mon, 5 Aug 2024 19:01:49 +0900 [thread overview]
Message-ID: <20240805100149.14445-1-rgbi3307@gmail.com> (raw)
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@gmail.com>
---
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
reply other threads:[~2024-08-05 10:02 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240805100149.14445-1-rgbi3307@gmail.com \
--to=rgbi3307@gmail.com \
--cc=Liam.Howlett@oracle.com \
--cc=gregkh@linuxfoundation.org \
--cc=levinsasha928@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=maple-tree@lists.infradead.org \
--cc=torvalds@linux-foundation.org \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).