Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 359326
b: refs/heads/master
c: c718aa6
h: refs/heads/master
v: v3
  • Loading branch information
Tejun Heo authored and Linus Torvalds committed Feb 28, 2013
1 parent 68cd478 commit 0a32afe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 19 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bab998d62f12db12b3ddf1e06b2ecd4ed9e7ae45
refs/heads/master: c718aa652d3def382a79c25442c2a830263e52ed
23 changes: 5 additions & 18 deletions trunk/drivers/block/loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -1624,30 +1624,17 @@ static int loop_add(struct loop_device **l, int i)
if (!lo)
goto out;

if (!idr_pre_get(&loop_index_idr, GFP_KERNEL))
goto out_free_dev;

/* allocate id, if @id >= 0, we're requesting that specific id */
if (i >= 0) {
int m;

/* create specific i in the index */
err = idr_get_new_above(&loop_index_idr, lo, i, &m);
if (err >= 0 && i != m) {
idr_remove(&loop_index_idr, m);
err = idr_alloc(&loop_index_idr, lo, i, i + 1, GFP_KERNEL);
if (err == -ENOSPC)
err = -EEXIST;
}
} else if (i == -1) {
int m;

/* get next free nr */
err = idr_get_new(&loop_index_idr, lo, &m);
if (err >= 0)
i = m;
} else {
err = -EINVAL;
err = idr_alloc(&loop_index_idr, lo, 0, 0, GFP_KERNEL);
}
if (err < 0)
goto out_free_dev;
i = err;

lo->lo_queue = blk_alloc_queue(GFP_KERNEL);
if (!lo->lo_queue)
Expand Down

0 comments on commit 0a32afe

Please sign in to comment.