linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] proc: Remove usage of the deprecated ida_simple_xx() API
@ 2024-01-15 17:53 Christophe JAILLET
  2024-01-15 18:01 ` Matthew Wilcox
  0 siblings, 1 reply; 3+ messages in thread
From: Christophe JAILLET @ 2024-01-15 17:53 UTC (permalink / raw)
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, 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: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 fs/proc/generic.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index 775ce0bcf08c..c02f1e63f82d 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -202,8 +202,8 @@ int proc_alloc_inum(unsigned int *inum)
 {
 	int i;
 
-	i = ida_simple_get(&proc_inum_ida, 0, UINT_MAX - PROC_DYNAMIC_FIRST + 1,
-			   GFP_KERNEL);
+	i = ida_alloc_max(&proc_inum_ida, UINT_MAX - PROC_DYNAMIC_FIRST,
+			  GFP_KERNEL);
 	if (i < 0)
 		return i;
 
@@ -213,7 +213,7 @@ int proc_alloc_inum(unsigned int *inum)
 
 void proc_free_inum(unsigned int inum)
 {
-	ida_simple_remove(&proc_inum_ida, inum - PROC_DYNAMIC_FIRST);
+	ida_free(&proc_inum_ida, inum - PROC_DYNAMIC_FIRST);
 }
 
 static int proc_misc_d_revalidate(struct dentry *dentry, unsigned int flags)
-- 
2.43.0


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

* Re: [PATCH] proc: Remove usage of the deprecated ida_simple_xx() API
  2024-01-15 17:53 [PATCH] proc: Remove usage of the deprecated ida_simple_xx() API Christophe JAILLET
@ 2024-01-15 18:01 ` Matthew Wilcox
  2024-04-14  8:25   ` Christophe JAILLET
  0 siblings, 1 reply; 3+ messages in thread
From: Matthew Wilcox @ 2024-01-15 18:01 UTC (permalink / raw)
  To: Christophe JAILLET; +Cc: linux-kernel, kernel-janitors, linux-fsdevel

On Mon, Jan 15, 2024 at 06:53:37PM +0100, Christophe JAILLET wrote:
> 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: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>

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

* Re: [PATCH] proc: Remove usage of the deprecated ida_simple_xx() API
  2024-01-15 18:01 ` Matthew Wilcox
@ 2024-04-14  8:25   ` Christophe JAILLET
  0 siblings, 0 replies; 3+ messages in thread
From: Christophe JAILLET @ 2024-04-14  8:25 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: linux-kernel, kernel-janitors, linux-fsdevel

Le 15/01/2024 à 19:01, Matthew Wilcox a écrit :
> On Mon, Jan 15, 2024 at 06:53:37PM +0100, Christophe JAILLET wrote:
>> 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: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> 
> Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> 
> 

Hi,

polite minder ;-)

CJ

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

end of thread, other threads:[~2024-04-14  8:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-15 17:53 [PATCH] proc: Remove usage of the deprecated ida_simple_xx() API Christophe JAILLET
2024-01-15 18:01 ` Matthew Wilcox
2024-04-14  8:25   ` Christophe JAILLET

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