lkml.org 
[lkml]   [2015]   [Sep]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 05/17] Update the md driver to use idr helper functions.
Date
Signed-off-by: Lee Duncan <lduncan@suse.com>
---
drivers/md/dm.c | 22 +++++-----------------
1 file changed, 5 insertions(+), 17 deletions(-)

diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index f331d888e7f5..53d6895eb13d 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -2202,9 +2202,7 @@ static int dm_any_congested(void *congested_data, int bdi_bits)
*---------------------------------------------------------------*/
static void free_minor(int minor)
{
- spin_lock(&_minor_lock);
- idr_remove(&_minor_idr, minor);
- spin_unlock(&_minor_lock);
+ idr_put_index(&_minor_idr, &_minor_lock, minor);
}

/*
@@ -2217,13 +2215,8 @@ static int specific_minor(int minor)
if (minor >= (1 << MINORBITS))
return -EINVAL;

- idr_preload(GFP_KERNEL);
- spin_lock(&_minor_lock);
-
- r = idr_alloc(&_minor_idr, MINOR_ALLOCED, minor, minor + 1, GFP_NOWAIT);
-
- spin_unlock(&_minor_lock);
- idr_preload_end();
+ r = idr_get_index_in_range(&_minor_idr, &_minor_lock, MINOR_ALLOCED,
+ minor, minor + 1);
if (r < 0)
return r == -ENOSPC ? -EBUSY : r;
return 0;
@@ -2233,13 +2226,8 @@ static int next_free_minor(int *minor)
{
int r;

- idr_preload(GFP_KERNEL);
- spin_lock(&_minor_lock);
-
- r = idr_alloc(&_minor_idr, MINOR_ALLOCED, 0, 1 << MINORBITS, GFP_NOWAIT);
-
- spin_unlock(&_minor_lock);
- idr_preload_end();
+ r = idr_get_index_in_range(&_minor_idr, &_minor_lock, MINOR_ALLOCED,
+ 0, 1 << MINORBITS);
if (r < 0)
return r;
*minor = r;
--
2.1.4


\
 
 \ /
  Last update: 2015-09-16 20:21    [W:0.084 / U:0.544 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site