All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dax: Remove usage of the deprecated ida_simple_xxx API
@ 2022-09-26  1:26 Bo Liu
  2022-09-26 18:01 ` Ira Weiny
  2022-09-30  0:29 ` Dan Williams
  0 siblings, 2 replies; 3+ messages in thread
From: Bo Liu @ 2022-09-26  1:26 UTC (permalink / raw)
  To: dan.j.williams, vishal.l.verma, dave.jiang; +Cc: nvdimm, linux-kernel, Bo Liu

Use ida_alloc_xxx()/ida_free() instead of
ida_simple_get()/ida_simple_remove().
The latter is deprecated and more verbose.

Signed-off-by: Bo Liu <liubo03@inspur.com>
---
 drivers/dax/super.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/dax/super.c b/drivers/dax/super.c
index 9b5e2a5eb0ae..da4438f3188c 100644
--- a/drivers/dax/super.c
+++ b/drivers/dax/super.c
@@ -363,7 +363,7 @@ static void dax_free_inode(struct inode *inode)
 {
 	struct dax_device *dax_dev = to_dax_dev(inode);
 	if (inode->i_rdev)
-		ida_simple_remove(&dax_minor_ida, iminor(inode));
+		ida_free(&dax_minor_ida, iminor(inode));
 	kmem_cache_free(dax_cache, dax_dev);
 }
 
@@ -445,7 +445,7 @@ struct dax_device *alloc_dax(void *private, const struct dax_operations *ops)
 	if (WARN_ON_ONCE(ops && !ops->zero_page_range))
 		return ERR_PTR(-EINVAL);
 
-	minor = ida_simple_get(&dax_minor_ida, 0, MINORMASK+1, GFP_KERNEL);
+	minor = ida_alloc_max(&dax_minor_ida, MINORMASK, GFP_KERNEL);
 	if (minor < 0)
 		return ERR_PTR(-ENOMEM);
 
@@ -459,7 +459,7 @@ struct dax_device *alloc_dax(void *private, const struct dax_operations *ops)
 	return dax_dev;
 
  err_dev:
-	ida_simple_remove(&dax_minor_ida, minor);
+	ida_free(&dax_minor_ida, minor);
 	return ERR_PTR(-ENOMEM);
 }
 EXPORT_SYMBOL_GPL(alloc_dax);
-- 
2.27.0


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

* Re: [PATCH] dax: Remove usage of the deprecated ida_simple_xxx API
  2022-09-26  1:26 [PATCH] dax: Remove usage of the deprecated ida_simple_xxx API Bo Liu
@ 2022-09-26 18:01 ` Ira Weiny
  2022-09-30  0:29 ` Dan Williams
  1 sibling, 0 replies; 3+ messages in thread
From: Ira Weiny @ 2022-09-26 18:01 UTC (permalink / raw)
  To: Bo Liu; +Cc: dan.j.williams, vishal.l.verma, dave.jiang, nvdimm, linux-kernel

On Sun, Sep 25, 2022 at 09:26:35PM -0400, Bo Liu wrote:
> Use ida_alloc_xxx()/ida_free() instead of
> ida_simple_get()/ida_simple_remove().
> The latter is deprecated and more verbose.
> 
> Signed-off-by: Bo Liu <liubo03@inspur.com>

Reviewed-by: Ira Weiny <ira.weiny@intel.com>

> ---
>  drivers/dax/super.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/dax/super.c b/drivers/dax/super.c
> index 9b5e2a5eb0ae..da4438f3188c 100644
> --- a/drivers/dax/super.c
> +++ b/drivers/dax/super.c
> @@ -363,7 +363,7 @@ static void dax_free_inode(struct inode *inode)
>  {
>  	struct dax_device *dax_dev = to_dax_dev(inode);
>  	if (inode->i_rdev)
> -		ida_simple_remove(&dax_minor_ida, iminor(inode));
> +		ida_free(&dax_minor_ida, iminor(inode));
>  	kmem_cache_free(dax_cache, dax_dev);
>  }
>  
> @@ -445,7 +445,7 @@ struct dax_device *alloc_dax(void *private, const struct dax_operations *ops)
>  	if (WARN_ON_ONCE(ops && !ops->zero_page_range))
>  		return ERR_PTR(-EINVAL);
>  
> -	minor = ida_simple_get(&dax_minor_ida, 0, MINORMASK+1, GFP_KERNEL);
> +	minor = ida_alloc_max(&dax_minor_ida, MINORMASK, GFP_KERNEL);
>  	if (minor < 0)
>  		return ERR_PTR(-ENOMEM);
>  
> @@ -459,7 +459,7 @@ struct dax_device *alloc_dax(void *private, const struct dax_operations *ops)
>  	return dax_dev;
>  
>   err_dev:
> -	ida_simple_remove(&dax_minor_ida, minor);
> +	ida_free(&dax_minor_ida, minor);
>  	return ERR_PTR(-ENOMEM);
>  }
>  EXPORT_SYMBOL_GPL(alloc_dax);
> -- 
> 2.27.0
> 
> 

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

* RE: [PATCH] dax: Remove usage of the deprecated ida_simple_xxx API
  2022-09-26  1:26 [PATCH] dax: Remove usage of the deprecated ida_simple_xxx API Bo Liu
  2022-09-26 18:01 ` Ira Weiny
@ 2022-09-30  0:29 ` Dan Williams
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Williams @ 2022-09-30  0:29 UTC (permalink / raw)
  To: Bo Liu, dan.j.williams, vishal.l.verma, dave.jiang
  Cc: nvdimm, linux-kernel, Bo Liu

Bo Liu wrote:
> Use ida_alloc_xxx()/ida_free() instead of
> ida_simple_get()/ida_simple_remove().
> The latter is deprecated and more verbose.

The better justification is:

ida_alloc_max() makes it clear that the
second argument is inclusive, and the alloc/free terminology is more
idiomatic and symmetric then get/remove.

Otherwise, I would not apply the patch is the only justfication was
deprecation and verbosity.

I'll fixup the changelog.

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

end of thread, other threads:[~2022-09-30  0:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-26  1:26 [PATCH] dax: Remove usage of the deprecated ida_simple_xxx API Bo Liu
2022-09-26 18:01 ` Ira Weiny
2022-09-30  0:29 ` Dan Williams

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.