Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 89778
b: refs/heads/master
c: 842ea77
h: refs/heads/master
v: v3
  • Loading branch information
FUJITA Tomonori authored and James Bottomley committed Apr 18, 2008
1 parent 8654bf2 commit a32af25
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 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: 43ac9e62c4a0a47fe3de1f1eb9ca7b8c91dce234
refs/heads/master: 842ea771c38a3f0f78bdb1b4d47881e6a210fc15
10 changes: 4 additions & 6 deletions trunk/block/bsg.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ struct bsg_device {
struct list_head done_list;
struct hlist_node dev_list;
atomic_t ref_count;
int minor;
int queued_cmds;
int done_cmds;
wait_queue_head_t wq_done;
Expand Down Expand Up @@ -758,9 +757,8 @@ static struct bsg_device *bsg_add_device(struct inode *inode,
bsg_set_block(bd, file);

atomic_set(&bd->ref_count, 1);
bd->minor = iminor(inode);
mutex_lock(&bsg_mutex);
hlist_add_head(&bd->dev_list, bsg_dev_idx_hash(bd->minor));
hlist_add_head(&bd->dev_list, bsg_dev_idx_hash(iminor(inode)));

strncpy(bd->name, rq->bsg_dev.class_dev->class_id, sizeof(bd->name) - 1);
dprintk("bound to <%s>, max queue %d\n",
Expand All @@ -770,15 +768,15 @@ static struct bsg_device *bsg_add_device(struct inode *inode,
return bd;
}

static struct bsg_device *__bsg_get_device(int minor)
static struct bsg_device *__bsg_get_device(int minor, struct request_queue *q)
{
struct bsg_device *bd;
struct hlist_node *entry;

mutex_lock(&bsg_mutex);

hlist_for_each_entry(bd, entry, bsg_dev_idx_hash(minor), dev_list) {
if (bd->minor == minor) {
if (bd->queue == q) {
atomic_inc(&bd->ref_count);
goto found;
}
Expand Down Expand Up @@ -806,7 +804,7 @@ static struct bsg_device *bsg_get_device(struct inode *inode, struct file *file)
if (!bcd)
return ERR_PTR(-ENODEV);

bd = __bsg_get_device(iminor(inode));
bd = __bsg_get_device(iminor(inode), bcd->queue);
if (bd)
return bd;

Expand Down

0 comments on commit a32af25

Please sign in to comment.