Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1225409 > unrolled thread

[PATCH 05/17] Update the md driver to use idr helper functions.

Started byLee Duncan <lduncan@suse.com>
First post2015-09-15 18:50 +0200
Last post2015-09-17 23:00 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 05/17] Update the md driver to use idr helper functions. Lee Duncan <lduncan@suse.com> - 2015-09-15 18:50 +0200
    Re: [PATCH 05/17] Update the md driver to use idr helper functions. Mike Snitzer <snitzer@redhat.com> - 2015-09-15 20:10 +0200
      Re: [PATCH 05/17] Update the md driver to use idr helper functions. Lee Duncan <lduncan@suse.com> - 2015-09-17 23:00 +0200

#1225409 — [PATCH 05/17] Update the md driver to use idr helper functions.

FromLee Duncan <lduncan@suse.com>
Date2015-09-15 18:50 +0200
Subject[PATCH 05/17] Update the md driver to use idr helper functions.
Message-ID<q91AC-24K-13@gated-at.bofh.it>
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1225482

FromMike Snitzer <snitzer@redhat.com>
Date2015-09-15 20:10 +0200
Message-ID<q92Q1-41y-9@gated-at.bofh.it>
In reply to#1225409
Subject should really be:
"dm: update to use idr helper functions"
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1227388

FromLee Duncan <lduncan@suse.com>
Date2015-09-17 23:00 +0200
Message-ID<q9OrE-6I3-19@gated-at.bofh.it>
In reply to#1225482
On 09/15/2015 11:05 AM, Mike Snitzer wrote:
> Subject should really be:
> "dm: update to use idr helper functions"

Yes, I grabbed the wrong part of the driver pathname.

Would it be better to resubmit just this patch, or to resubmit the series?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web