From: Ed Cashin <ecashin@coraid.com>
From: Ed Cashin <ecashin@coraid.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, ecashin@coraid.com
Subject: [PATCH 6/8] aoe: make error messages more specific in static minor allocation
Date: Wed, 21 Nov 2012 20:04:16 -0500 [thread overview]
Message-ID: <af9b4b40f3d60914f463599ef1d0ee9c9bdbfb01.1353518444.git.ecashin@coraid.com> (raw)
In-Reply-To: <cover.1353518444.git.ecashin@coraid.com>
For some special-purpose systems where udev isn't present, static
allocation of minor numbers is desirable. This update
distinguishes different failure scenarios, to help the user
understand what went wrong.
Signed-off-by: Ed Cashin <ecashin@coraid.com>
---
drivers/block/aoe/aoedev.c | 31 ++++++++++++++++++++-----------
1 files changed, 20 insertions(+), 11 deletions(-)
diff --git a/drivers/block/aoe/aoedev.c b/drivers/block/aoe/aoedev.c
index 91f7c99..88ccd6d 100644
--- a/drivers/block/aoe/aoedev.c
+++ b/drivers/block/aoe/aoedev.c
@@ -69,25 +69,34 @@ minor_get_static(ulong *sysminor, ulong aoemaj, int aoemin)
NPERSHELF = 16,
};
+ if (aoemin >= NPERSHELF) {
+ pr_err("aoe: %s %d slots per shelf\n",
+ "static minor device numbers support only",
+ NPERSHELF);
+ error = -1;
+ goto out;
+ }
+
n = aoemaj * NPERSHELF + aoemin;
- if (aoemin >= NPERSHELF || n >= N_DEVS) {
+ if (n >= N_DEVS) {
pr_err("aoe: %s with e%ld.%d\n",
"cannot use static minor device numbers",
aoemaj, aoemin);
error = -1;
- } else {
- spin_lock_irqsave(&used_minors_lock, flags);
- if (test_bit(n, used_minors)) {
- pr_err("aoe: %s %lu\n",
- "existing device already has static minor number",
- n);
- error = -1;
- } else
- set_bit(n, used_minors);
- spin_unlock_irqrestore(&used_minors_lock, flags);
+ goto out;
}
+ spin_lock_irqsave(&used_minors_lock, flags);
+ if (test_bit(n, used_minors)) {
+ pr_err("aoe: %s %lu\n",
+ "existing device already has static minor number",
+ n);
+ error = -1;
+ } else
+ set_bit(n, used_minors);
+ spin_unlock_irqrestore(&used_minors_lock, flags);
*sysminor = n;
+out:
return error;
}
--
1.7.1
next prev parent reply other threads:[~2012-11-22 19:19 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-22 0:52 [PATCH 0/8] aoe: miscellaneous fixes follow-up recent patch submissions Ed Cashin, Ed Cashin
2012-11-22 0:54 ` [PATCH 1/8] aoe: copy fallback timing information on destination failover Ed Cashin, Ed Cashin
2012-11-22 0:56 ` [PATCH 2/8] aoe: remove vestigial request queue allocation Ed Cashin, Ed Cashin
2012-11-22 0:58 ` [PATCH 3/8] aoe: increase default cap on outstanding AoE commands in the network Ed Cashin, Ed Cashin
2012-11-22 1:00 ` [PATCH 4/8] aoe: cleanup: correct comment for aoetgt nout Ed Cashin, Ed Cashin
2012-11-22 1:02 ` [PATCH 5/8] aoe: remove call to request handler from I/O completion Ed Cashin, Ed Cashin
2012-11-22 1:04 ` Ed Cashin, Ed Cashin [this message]
2012-11-22 1:06 ` [PATCH 7/8] aoe: initialize sysminor to avoid compiler warning Ed Cashin, Ed Cashin
2012-11-22 1:08 ` [PATCH 8/8] aoe: return real minor number for static minors Ed Cashin, Ed Cashin
2012-11-28 23:42 ` [PATCH 0/8] aoe: miscellaneous fixes follow-up recent patch submissions Andrew Morton
2012-11-29 1:34 ` Ed Cashin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=af9b4b40f3d60914f463599ef1d0ee9c9bdbfb01.1353518444.git.ecashin@coraid.com \
--to=ecashin@coraid.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®