提交 a37c3010 编写于 作者: T Tejun Heo 提交者: Linus Torvalds

zcache: convert to idr_alloc()

idr_get_new*() and friends are about to be deprecated.  Convert to the
new idr_alloc() interface.

Only compile tested.
Signed-off-by: NTejun Heo <tj@kernel.org>
Cc: Dan Magenheimer <dan.magenheimer@oracle.com>
Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 95e1b714
...@@ -300,27 +300,22 @@ static u8 r2net_num_from_nn(struct r2net_node *nn) ...@@ -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) 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); spin_lock(&nn->nn_lock);
ret = idr_get_new(&nn->nn_status_idr, nsw, &nsw->ns_id); ret = idr_alloc(&nn->nn_status_idr, nsw, 0, 0, GFP_ATOMIC);
if (ret == 0) if (ret >= 0) {
list_add_tail(&nsw->ns_node_item, nsw->ns_id = ret;
&nn->nn_status_list); list_add_tail(&nsw->ns_node_item, &nn->nn_status_list);
}
spin_unlock(&nn->nn_lock); spin_unlock(&nn->nn_lock);
} while (ret == -EAGAIN);
if (ret == 0) { if (ret >= 0) {
init_waitqueue_head(&nsw->ns_wq); init_waitqueue_head(&nsw->ns_wq);
nsw->ns_sys_status = R2NET_ERR_NONE; nsw->ns_sys_status = R2NET_ERR_NONE;
nsw->ns_status = 0; nsw->ns_status = 0;
return 0;
} }
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册