linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] radix tree test suite: Remove usage of the deprecated ida_simple_xx() API
@ 2024-08-21  6:59 Hongbo Li
  2024-08-21 12:57 ` Matthew Wilcox
  0 siblings, 1 reply; 3+ messages in thread
From: Hongbo Li @ 2024-08-21  6:59 UTC (permalink / raw)
  To: willy; +Cc: lihongbo22, linux-fsdevel

ida_alloc() and ida_free() should be preferred to the deprecated
ida_simple_get() and ida_simple_remove().

Note that the upper limit of ida_simple_get() is exclusive, but
the one of ida_alloc_max() is inclusive. So a -1 has been added
when needed.

Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
---
 tools/testing/radix-tree/idr-test.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/testing/radix-tree/idr-test.c b/tools/testing/radix-tree/idr-test.c
index 84b8c3c92c79..06ad10b5719c 100644
--- a/tools/testing/radix-tree/idr-test.c
+++ b/tools/testing/radix-tree/idr-test.c
@@ -499,18 +499,18 @@ void ida_check_random(void)
 		goto repeat;
 }
 
-void ida_simple_get_remove_test(void)
+void ida_alloc_free_test(void)
 {
 	DEFINE_IDA(ida);
 	unsigned long i;
 
 	for (i = 0; i < 10000; i++) {
-		assert(ida_simple_get(&ida, 0, 20000, GFP_KERNEL) == i);
+		assert(ida_alloc_max(&ida, 0, 19999, GFP_KERNEL) == i);
 	}
-	assert(ida_simple_get(&ida, 5, 30, GFP_KERNEL) < 0);
+	assert(ida_alloc_max(&ida, 5, 29, GFP_KERNEL) < 0);
 
 	for (i = 0; i < 10000; i++) {
-		ida_simple_remove(&ida, i);
+		ida_free(&ida, i);
 	}
 	assert(ida_is_empty(&ida));
 
@@ -524,7 +524,7 @@ void user_ida_checks(void)
 	ida_check_nomem();
 	ida_check_conv_user();
 	ida_check_random();
-	ida_simple_get_remove_test();
+	ida_alloc_free_test();
 
 	radix_tree_cpu_dead(1);
 }
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] radix tree test suite: Remove usage of the deprecated ida_simple_xx() API
  2024-08-21  6:59 [PATCH -next] radix tree test suite: Remove usage of the deprecated ida_simple_xx() API Hongbo Li
@ 2024-08-21 12:57 ` Matthew Wilcox
  2024-08-22  2:56   ` Hongbo Li
  0 siblings, 1 reply; 3+ messages in thread
From: Matthew Wilcox @ 2024-08-21 12:57 UTC (permalink / raw)
  To: Hongbo Li; +Cc: linux-fsdevel

On Wed, Aug 21, 2024 at 02:59:27PM +0800, Hongbo Li wrote:
> ida_alloc() and ida_free() should be preferred to the deprecated
> ida_simple_get() and ida_simple_remove().

Already sent by Christopher JAILLET.
https://lore.kernel.org/linux-fsdevel/cover.1722853349.git.christophe.jaillet@wanadoo.fr/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] radix tree test suite: Remove usage of the deprecated ida_simple_xx() API
  2024-08-21 12:57 ` Matthew Wilcox
@ 2024-08-22  2:56   ` Hongbo Li
  0 siblings, 0 replies; 3+ messages in thread
From: Hongbo Li @ 2024-08-22  2:56 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: linux-fsdevel



On 2024/8/21 20:57, Matthew Wilcox wrote:
> On Wed, Aug 21, 2024 at 02:59:27PM +0800, Hongbo Li wrote:
>> ida_alloc() and ida_free() should be preferred to the deprecated
>> ida_simple_get() and ida_simple_remove().
> 
> Already sent by Christopher JAILLET.
> https://lore.kernel.org/linux-fsdevel/cover.1722853349.git.christophe.jaillet@wanadoo.fr/
> 
ha, I haven't notice that. I'll drop this.

Thanks
Hongbo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-08-22  2:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-21  6:59 [PATCH -next] radix tree test suite: Remove usage of the deprecated ida_simple_xx() API Hongbo Li
2024-08-21 12:57 ` Matthew Wilcox
2024-08-22  2:56   ` Hongbo Li

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).