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
nexedi
linux
Commits
ee668506
Commit
ee668506
authored
Feb 01, 2013
by
Kent Overstreet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcache: Use bd_link_disk_holder()
Signed-off-by:
Kent Overstreet
<
koverstreet@google.com
>
parent
86b26b82
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
17 deletions
+35
-17
drivers/md/bcache/super.c
drivers/md/bcache/super.c
+35
-17
No files found.
drivers/md/bcache/super.c
View file @
ee668506
...
@@ -661,6 +661,35 @@ void bcache_device_stop(struct bcache_device *d)
...
@@ -661,6 +661,35 @@ void bcache_device_stop(struct bcache_device *d)
closure_queue
(
&
d
->
cl
);
closure_queue
(
&
d
->
cl
);
}
}
static
void
bcache_device_unlink
(
struct
bcache_device
*
d
)
{
unsigned
i
;
struct
cache
*
ca
;
sysfs_remove_link
(
&
d
->
c
->
kobj
,
d
->
name
);
sysfs_remove_link
(
&
d
->
kobj
,
"cache"
);
for_each_cache
(
ca
,
d
->
c
,
i
)
bd_unlink_disk_holder
(
ca
->
bdev
,
d
->
disk
);
}
static
void
bcache_device_link
(
struct
bcache_device
*
d
,
struct
cache_set
*
c
,
const
char
*
name
)
{
unsigned
i
;
struct
cache
*
ca
;
for_each_cache
(
ca
,
d
->
c
,
i
)
bd_link_disk_holder
(
ca
->
bdev
,
d
->
disk
);
snprintf
(
d
->
name
,
BCACHEDEVNAME_SIZE
,
"%s%u"
,
name
,
d
->
id
);
WARN
(
sysfs_create_link
(
&
d
->
kobj
,
&
c
->
kobj
,
"cache"
)
||
sysfs_create_link
(
&
c
->
kobj
,
&
d
->
kobj
,
d
->
name
),
"Couldn't create device <-> cache set symlinks"
);
}
static
void
bcache_device_detach
(
struct
bcache_device
*
d
)
static
void
bcache_device_detach
(
struct
bcache_device
*
d
)
{
{
lockdep_assert_held
(
&
bch_register_lock
);
lockdep_assert_held
(
&
bch_register_lock
);
...
@@ -676,6 +705,8 @@ static void bcache_device_detach(struct bcache_device *d)
...
@@ -676,6 +705,8 @@ static void bcache_device_detach(struct bcache_device *d)
atomic_set
(
&
d
->
detaching
,
0
);
atomic_set
(
&
d
->
detaching
,
0
);
}
}
bcache_device_unlink
(
d
);
d
->
c
->
devices
[
d
->
id
]
=
NULL
;
d
->
c
->
devices
[
d
->
id
]
=
NULL
;
closure_put
(
&
d
->
c
->
caching
);
closure_put
(
&
d
->
c
->
caching
);
d
->
c
=
NULL
;
d
->
c
=
NULL
;
...
@@ -693,17 +724,6 @@ static void bcache_device_attach(struct bcache_device *d, struct cache_set *c,
...
@@ -693,17 +724,6 @@ static void bcache_device_attach(struct bcache_device *d, struct cache_set *c,
closure_get
(
&
c
->
caching
);
closure_get
(
&
c
->
caching
);
}
}
static
void
bcache_device_link
(
struct
bcache_device
*
d
,
struct
cache_set
*
c
,
const
char
*
name
)
{
snprintf
(
d
->
name
,
BCACHEDEVNAME_SIZE
,
"%s%u"
,
name
,
d
->
id
);
WARN
(
sysfs_create_link
(
&
d
->
kobj
,
&
c
->
kobj
,
"cache"
)
||
sysfs_create_link
(
&
c
->
kobj
,
&
d
->
kobj
,
d
->
name
),
"Couldn't create device <-> cache set symlinks"
);
}
static
void
bcache_device_free
(
struct
bcache_device
*
d
)
static
void
bcache_device_free
(
struct
bcache_device
*
d
)
{
{
lockdep_assert_held
(
&
bch_register_lock
);
lockdep_assert_held
(
&
bch_register_lock
);
...
@@ -804,6 +824,7 @@ void bch_cached_dev_run(struct cached_dev *dc)
...
@@ -804,6 +824,7 @@ void bch_cached_dev_run(struct cached_dev *dc)
}
}
add_disk
(
d
->
disk
);
add_disk
(
d
->
disk
);
bd_link_disk_holder
(
dc
->
bdev
,
dc
->
disk
.
disk
);
#if 0
#if 0
char *env[] = { "SYMLINK=label" , NULL };
char *env[] = { "SYMLINK=label" , NULL };
kobject_uevent_env(&disk_to_dev(d->disk)->kobj, KOBJ_CHANGE, env);
kobject_uevent_env(&disk_to_dev(d->disk)->kobj, KOBJ_CHANGE, env);
...
@@ -823,9 +844,6 @@ static void cached_dev_detach_finish(struct work_struct *w)
...
@@ -823,9 +844,6 @@ static void cached_dev_detach_finish(struct work_struct *w)
BUG_ON
(
!
atomic_read
(
&
dc
->
disk
.
detaching
));
BUG_ON
(
!
atomic_read
(
&
dc
->
disk
.
detaching
));
BUG_ON
(
atomic_read
(
&
dc
->
count
));
BUG_ON
(
atomic_read
(
&
dc
->
count
));
sysfs_remove_link
(
&
dc
->
disk
.
c
->
kobj
,
dc
->
disk
.
name
);
sysfs_remove_link
(
&
dc
->
disk
.
kobj
,
"cache"
);
mutex_lock
(
&
bch_register_lock
);
mutex_lock
(
&
bch_register_lock
);
memset
(
&
dc
->
sb
.
set_uuid
,
0
,
16
);
memset
(
&
dc
->
sb
.
set_uuid
,
0
,
16
);
...
@@ -940,7 +958,6 @@ int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c)
...
@@ -940,7 +958,6 @@ int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c)
}
}
bcache_device_attach
(
&
dc
->
disk
,
c
,
u
-
c
->
uuids
);
bcache_device_attach
(
&
dc
->
disk
,
c
,
u
-
c
->
uuids
);
bcache_device_link
(
&
dc
->
disk
,
c
,
"bdev"
);
list_move
(
&
dc
->
list
,
&
c
->
cached_devs
);
list_move
(
&
dc
->
list
,
&
c
->
cached_devs
);
calc_cached_dev_sectors
(
c
);
calc_cached_dev_sectors
(
c
);
...
@@ -958,6 +975,7 @@ int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c)
...
@@ -958,6 +975,7 @@ int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c)
}
}
bch_cached_dev_run
(
dc
);
bch_cached_dev_run
(
dc
);
bcache_device_link
(
&
dc
->
disk
,
c
,
"bdev"
);
pr_info
(
"Caching %s as %s on set %pU"
,
pr_info
(
"Caching %s as %s on set %pU"
,
bdevname
(
dc
->
bdev
,
buf
),
dc
->
disk
.
disk
->
disk_name
,
bdevname
(
dc
->
bdev
,
buf
),
dc
->
disk
.
disk
->
disk_name
,
...
@@ -981,6 +999,7 @@ static void cached_dev_free(struct closure *cl)
...
@@ -981,6 +999,7 @@ static void cached_dev_free(struct closure *cl)
mutex_lock
(
&
bch_register_lock
);
mutex_lock
(
&
bch_register_lock
);
bd_unlink_disk_holder
(
dc
->
bdev
,
dc
->
disk
.
disk
);
bcache_device_free
(
&
dc
->
disk
);
bcache_device_free
(
&
dc
->
disk
);
list_del
(
&
dc
->
list
);
list_del
(
&
dc
->
list
);
...
@@ -1123,8 +1142,7 @@ static void flash_dev_flush(struct closure *cl)
...
@@ -1123,8 +1142,7 @@ static void flash_dev_flush(struct closure *cl)
{
{
struct
bcache_device
*
d
=
container_of
(
cl
,
struct
bcache_device
,
cl
);
struct
bcache_device
*
d
=
container_of
(
cl
,
struct
bcache_device
,
cl
);
sysfs_remove_link
(
&
d
->
c
->
kobj
,
d
->
name
);
bcache_device_unlink
(
d
);
sysfs_remove_link
(
&
d
->
kobj
,
"cache"
);
kobject_del
(
&
d
->
kobj
);
kobject_del
(
&
d
->
kobj
);
continue_at
(
cl
,
flash_dev_free
,
system_wq
);
continue_at
(
cl
,
flash_dev_free
,
system_wq
);
}
}
...
...
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