Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
28935ab5
Commit
28935ab5
authored
Jul 31, 2013
by
Kent Overstreet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcache: Use ida for bcache block dev minor
Signed-off-by:
Kent Overstreet
<
kmo@daterainc.com
>
parent
c4d951dd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
6 deletions
+20
-6
drivers/md/bcache/super.c
drivers/md/bcache/super.c
+20
-6
No files found.
drivers/md/bcache/super.c
View file @
28935ab5
...
...
@@ -16,6 +16,7 @@
#include <linux/buffer_head.h>
#include <linux/debugfs.h>
#include <linux/genhd.h>
#include <linux/idr.h>
#include <linux/kthread.h>
#include <linux/module.h>
#include <linux/random.h>
...
...
@@ -50,7 +51,8 @@ struct mutex bch_register_lock;
LIST_HEAD
(
bch_cache_sets
);
static
LIST_HEAD
(
uncached_devices
);
static
int
bcache_major
,
bcache_minor
;
static
int
bcache_major
;
static
DEFINE_IDA
(
bcache_minor
);
static
wait_queue_head_t
unregister_wait
;
struct
workqueue_struct
*
bcache_wq
;
...
...
@@ -731,8 +733,10 @@ static void bcache_device_free(struct bcache_device *d)
del_gendisk
(
d
->
disk
);
if
(
d
->
disk
&&
d
->
disk
->
queue
)
blk_cleanup_queue
(
d
->
disk
->
queue
);
if
(
d
->
disk
)
if
(
d
->
disk
)
{
ida_simple_remove
(
&
bcache_minor
,
d
->
disk
->
first_minor
);
put_disk
(
d
->
disk
);
}
bio_split_pool_free
(
&
d
->
bio_split_hook
);
if
(
d
->
unaligned_bvec
)
...
...
@@ -756,6 +760,7 @@ static int bcache_device_init(struct bcache_device *d, unsigned block_size,
{
struct
request_queue
*
q
;
size_t
n
;
int
minor
;
if
(
!
d
->
stripe_size
)
d
->
stripe_size
=
1
<<
31
;
...
...
@@ -783,22 +788,31 @@ static int bcache_device_init(struct bcache_device *d, unsigned block_size,
if
(
!
d
->
full_dirty_stripes
)
return
-
ENOMEM
;
minor
=
ida_simple_get
(
&
bcache_minor
,
0
,
MINORMASK
+
1
,
GFP_KERNEL
);
if
(
minor
<
0
)
return
minor
;
if
(
!
(
d
->
bio_split
=
bioset_create
(
4
,
offsetof
(
struct
bbio
,
bio
)))
||
!
(
d
->
unaligned_bvec
=
mempool_create_kmalloc_pool
(
1
,
sizeof
(
struct
bio_vec
)
*
BIO_MAX_PAGES
))
||
bio_split_pool_init
(
&
d
->
bio_split_hook
)
||
!
(
d
->
disk
=
alloc_disk
(
1
))
||
!
(
q
=
blk_alloc_queue
(
GFP_KERNEL
)))
!
(
d
->
disk
=
alloc_disk
(
1
))
)
{
ida_simple_remove
(
&
bcache_minor
,
minor
);
return
-
ENOMEM
;
}
set_capacity
(
d
->
disk
,
sectors
);
snprintf
(
d
->
disk
->
disk_name
,
DISK_NAME_LEN
,
"bcache%i"
,
bcache_
minor
);
snprintf
(
d
->
disk
->
disk_name
,
DISK_NAME_LEN
,
"bcache%i"
,
minor
);
d
->
disk
->
major
=
bcache_major
;
d
->
disk
->
first_minor
=
bcache_minor
++
;
d
->
disk
->
first_minor
=
minor
;
d
->
disk
->
fops
=
&
bcache_ops
;
d
->
disk
->
private_data
=
d
;
q
=
blk_alloc_queue
(
GFP_KERNEL
);
if
(
!
q
)
return
-
ENOMEM
;
blk_queue_make_request
(
q
,
NULL
);
d
->
disk
->
queue
=
q
;
q
->
queuedata
=
d
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment