From: Tejun Heo <tj@kernel.org>
To: akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, bfields@fieldses.org,
jackm@dev.mellanox.co.il, ogerlitz@mellanox.com,
roland@purestorage.com, dan.magenheimer@oracle.com,
gregkh@linuxfoundation.org, vjaquez@igalia.com,
rene.sapiens@ti.com, x0095078@ti.com, omar.ramirez@ti.com,
Tejun Heo <tj@kernel.org>
Subject: [PATCH 5/7] zcache: convert to idr_alloc()
Date: Tue, 5 Mar 2013 12:02:50 -0800 [thread overview]
Message-ID: <1362513772-15174-6-git-send-email-tj@kernel.org> (raw)
In-Reply-To: <1362513772-15174-1-git-send-email-tj@kernel.org>
idr_get_new*() and friends are about to be deprecated. Convert to the
new idr_alloc() interface.
Only compile tested.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Dan Magenheimer <dan.magenheimer@oracle.com>
---
drivers/staging/zcache/ramster/tcp.c | 25 ++++++++++---------------
1 file changed, 10 insertions(+), 15 deletions(-)
diff --git a/drivers/staging/zcache/ramster/tcp.c b/drivers/staging/zcache/ramster/tcp.c
index aa2a1a7..f6e1e52 100644
--- a/drivers/staging/zcache/ramster/tcp.c
+++ b/drivers/staging/zcache/ramster/tcp.c
@@ -300,27 +300,22 @@ static u8 r2net_num_from_nn(struct r2net_node *nn)
static int r2net_prep_nsw(struct r2net_node *nn, struct r2net_status_wait *nsw)
{
- int ret = 0;
+ int ret;
- do {
- if (!idr_pre_get(&nn->nn_status_idr, GFP_ATOMIC)) {
- ret = -EAGAIN;
- break;
- }
- spin_lock(&nn->nn_lock);
- ret = idr_get_new(&nn->nn_status_idr, nsw, &nsw->ns_id);
- if (ret == 0)
- list_add_tail(&nsw->ns_node_item,
- &nn->nn_status_list);
- spin_unlock(&nn->nn_lock);
- } while (ret == -EAGAIN);
+ spin_lock(&nn->nn_lock);
+ ret = idr_alloc(&nn->nn_status_idr, nsw, 0, 0, GFP_ATOMIC);
+ if (ret >= 0) {
+ nsw->ns_id = ret;
+ list_add_tail(&nsw->ns_node_item, &nn->nn_status_list);
+ }
+ spin_unlock(&nn->nn_lock);
- if (ret == 0) {
+ if (ret >= 0) {
init_waitqueue_head(&nsw->ns_wq);
nsw->ns_sys_status = R2NET_ERR_NONE;
nsw->ns_status = 0;
+ return 0;
}
-
return ret;
}
--
1.8.1.4
next prev parent reply other threads:[~2013-03-05 20:04 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-05 20:02 [PATCHSET 3.9-rc1] idr: final idr_alloc() conversions and deprecation of old interface Tejun Heo
2013-03-05 20:02 ` [PATCH 1/7] nfsd: remove unused get_new_stid() Tejun Heo
2013-03-05 20:05 ` J. Bruce Fields
2013-03-05 20:02 ` [PATCH 2/7] nfsd: convert to idr_alloc() Tejun Heo
2013-03-05 22:31 ` J. Bruce Fields
2013-03-05 20:02 ` [PATCH 3/7] workqueue: " Tejun Heo
2013-03-05 20:02 ` [PATCH 4/7] mlx4: remove leftover idr_pre_get() call Tejun Heo
2013-03-05 20:02 ` Tejun Heo [this message]
2013-03-05 21:37 ` [PATCH 5/7] zcache: convert to idr_alloc() Greg KH
2013-03-05 20:02 ` [PATCH 6/7] tidspbridge: " Tejun Heo
2013-03-05 21:37 ` Greg KH
2013-03-05 20:02 ` [PATCH 7/7] idr: deprecate idr_pre_get() and idr_get_new[_above]() Tejun Heo
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=1362513772-15174-6-git-send-email-tj@kernel.org \
--to=tj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=bfields@fieldses.org \
--cc=dan.magenheimer@oracle.com \
--cc=gregkh@linuxfoundation.org \
--cc=jackm@dev.mellanox.co.il \
--cc=linux-kernel@vger.kernel.org \
--cc=ogerlitz@mellanox.com \
--cc=omar.ramirez@ti.com \
--cc=rene.sapiens@ti.com \
--cc=roland@purestorage.com \
--cc=vjaquez@igalia.com \
--cc=x0095078@ti.com \
/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