linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] eventfd: Remove usage of the deprecated ida_simple_xx() API
@ 2023-12-10 17:32 Christophe JAILLET
  2023-12-11 10:06 ` Christian Brauner
  2023-12-11 12:30 ` Jan Kara
  0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2023-12-10 17:32 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, Jan Kara
  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().

This is less verbose.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 fs/eventfd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/eventfd.c b/fs/eventfd.c
index 16bea05a7c78..ad8186d47ba7 100644
--- a/fs/eventfd.c
+++ b/fs/eventfd.c
@@ -82,7 +82,7 @@ EXPORT_SYMBOL_GPL(eventfd_signal_mask);
 static void eventfd_free_ctx(struct eventfd_ctx *ctx)
 {
 	if (ctx->id >= 0)
-		ida_simple_remove(&eventfd_ida, ctx->id);
+		ida_free(&eventfd_ida, ctx->id);
 	kfree(ctx);
 }
 
@@ -395,7 +395,7 @@ static int do_eventfd(unsigned int count, int flags)
 	init_waitqueue_head(&ctx->wqh);
 	ctx->count = count;
 	ctx->flags = flags;
-	ctx->id = ida_simple_get(&eventfd_ida, 0, 0, GFP_KERNEL);
+	ctx->id = ida_alloc(&eventfd_ida, GFP_KERNEL);
 
 	flags &= EFD_SHARED_FCNTL_FLAGS;
 	flags |= O_RDWR;
-- 
2.34.1


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

* Re: [PATCH] eventfd: Remove usage of the deprecated ida_simple_xx() API
  2023-12-10 17:32 [PATCH] eventfd: Remove usage of the deprecated ida_simple_xx() API Christophe JAILLET
@ 2023-12-11 10:06 ` Christian Brauner
  2023-12-11 12:30 ` Jan Kara
  1 sibling, 0 replies; 3+ messages in thread
From: Christian Brauner @ 2023-12-11 10:06 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Christian Brauner, linux-kernel, kernel-janitors, linux-fsdevel,
	Alexander Viro, Jan Kara

On Sun, 10 Dec 2023 18:32:18 +0100, Christophe JAILLET wrote:
> ida_alloc() and ida_free() should be preferred to the deprecated
> ida_simple_get() and ida_simple_remove().
> 
> This is less verbose.
> 
> 

Applied to the vfs.misc branch of the vfs/vfs.git tree.
Patches in the vfs.misc branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.misc

[1/1] eventfd: Remove usage of the deprecated ida_simple_xx() API
      https://git.kernel.org/vfs/vfs/c/ece491e762cc

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

* Re: [PATCH] eventfd: Remove usage of the deprecated ida_simple_xx() API
  2023-12-10 17:32 [PATCH] eventfd: Remove usage of the deprecated ida_simple_xx() API Christophe JAILLET
  2023-12-11 10:06 ` Christian Brauner
@ 2023-12-11 12:30 ` Jan Kara
  1 sibling, 0 replies; 3+ messages in thread
From: Jan Kara @ 2023-12-11 12:30 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Alexander Viro, Christian Brauner, Jan Kara, linux-kernel,
	kernel-janitors, linux-fsdevel

On Sun 10-12-23 18:32:18, Christophe JAILLET wrote:
> ida_alloc() and ida_free() should be preferred to the deprecated
> ida_simple_get() and ida_simple_remove().
> 
> This is less verbose.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/eventfd.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/eventfd.c b/fs/eventfd.c
> index 16bea05a7c78..ad8186d47ba7 100644
> --- a/fs/eventfd.c
> +++ b/fs/eventfd.c
> @@ -82,7 +82,7 @@ EXPORT_SYMBOL_GPL(eventfd_signal_mask);
>  static void eventfd_free_ctx(struct eventfd_ctx *ctx)
>  {
>  	if (ctx->id >= 0)
> -		ida_simple_remove(&eventfd_ida, ctx->id);
> +		ida_free(&eventfd_ida, ctx->id);
>  	kfree(ctx);
>  }
>  
> @@ -395,7 +395,7 @@ static int do_eventfd(unsigned int count, int flags)
>  	init_waitqueue_head(&ctx->wqh);
>  	ctx->count = count;
>  	ctx->flags = flags;
> -	ctx->id = ida_simple_get(&eventfd_ida, 0, 0, GFP_KERNEL);
> +	ctx->id = ida_alloc(&eventfd_ida, GFP_KERNEL);
>  
>  	flags &= EFD_SHARED_FCNTL_FLAGS;
>  	flags |= O_RDWR;
> -- 
> 2.34.1
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

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

end of thread, other threads:[~2023-12-11 12:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-10 17:32 [PATCH] eventfd: Remove usage of the deprecated ida_simple_xx() API Christophe JAILLET
2023-12-11 10:06 ` Christian Brauner
2023-12-11 12:30 ` Jan Kara

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