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
65d22e91
Commit
65d22e91
authored
Jul 31, 2013
by
Kent Overstreet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcache: Move spinlock into struct time_stats
Minor cleanup. Signed-off-by:
Kent Overstreet
<
kmo@daterainc.com
>
parent
8aee1220
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
17 additions
and
16 deletions
+17
-16
drivers/md/bcache/bcache.h
drivers/md/bcache/bcache.h
+0
-2
drivers/md/bcache/bset.c
drivers/md/bcache/bset.c
+1
-6
drivers/md/bcache/btree.c
drivers/md/bcache/btree.c
+0
-3
drivers/md/bcache/super.c
drivers/md/bcache/super.c
+6
-2
drivers/md/bcache/util.c
drivers/md/bcache/util.c
+9
-3
drivers/md/bcache/util.h
drivers/md/bcache/util.h
+1
-0
No files found.
drivers/md/bcache/bcache.h
View file @
65d22e91
...
...
@@ -666,11 +666,9 @@ struct cache_set {
unsigned
congested_read_threshold_us
;
unsigned
congested_write_threshold_us
;
spinlock_t
sort_time_lock
;
struct
time_stats
sort_time
;
struct
time_stats
btree_gc_time
;
struct
time_stats
btree_split_time
;
spinlock_t
btree_read_time_lock
;
struct
time_stats
btree_read_time
;
struct
time_stats
try_harder_time
;
...
...
drivers/md/bcache/bset.c
View file @
65d22e91
...
...
@@ -1077,11 +1077,8 @@ static void __btree_sort(struct btree *b, struct btree_iter *iter,
if
(
b
->
written
)
bset_build_written_tree
(
b
);
if
(
!
start
)
{
spin_lock
(
&
b
->
c
->
sort_time_lock
);
if
(
!
start
)
bch_time_stats_update
(
&
b
->
c
->
sort_time
,
start_time
);
spin_unlock
(
&
b
->
c
->
sort_time_lock
);
}
}
void
bch_btree_sort_partial
(
struct
btree
*
b
,
unsigned
start
)
...
...
@@ -1128,9 +1125,7 @@ void bch_btree_sort_into(struct btree *b, struct btree *new)
btree_mergesort
(
b
,
new
->
sets
->
data
,
&
iter
,
false
,
true
);
spin_lock
(
&
b
->
c
->
sort_time_lock
);
bch_time_stats_update
(
&
b
->
c
->
sort_time
,
start_time
);
spin_unlock
(
&
b
->
c
->
sort_time_lock
);
bkey_copy_key
(
&
new
->
key
,
&
b
->
key
);
new
->
sets
->
size
=
0
;
...
...
drivers/md/bcache/btree.c
View file @
65d22e91
...
...
@@ -317,10 +317,7 @@ void bch_btree_node_read(struct btree *b)
goto
err
;
bch_btree_node_read_done
(
b
);
spin_lock
(
&
b
->
c
->
btree_read_time_lock
);
bch_time_stats_update
(
&
b
->
c
->
btree_read_time
,
start_time
);
spin_unlock
(
&
b
->
c
->
btree_read_time_lock
);
return
;
err:
...
...
drivers/md/bcache/super.c
View file @
65d22e91
...
...
@@ -1435,9 +1435,13 @@ struct cache_set *bch_cache_set_alloc(struct cache_sb *sb)
init_waitqueue_head
(
&
c
->
try_wait
);
init_waitqueue_head
(
&
c
->
bucket_wait
);
closure_init_unlocked
(
&
c
->
uuid_write
);
spin_lock_init
(
&
c
->
sort_time_lock
);
mutex_init
(
&
c
->
sort_lock
);
spin_lock_init
(
&
c
->
btree_read_time_lock
);
spin_lock_init
(
&
c
->
sort_time
.
lock
);
spin_lock_init
(
&
c
->
btree_gc_time
.
lock
);
spin_lock_init
(
&
c
->
btree_split_time
.
lock
);
spin_lock_init
(
&
c
->
btree_read_time
.
lock
);
spin_lock_init
(
&
c
->
try_harder_time
.
lock
);
bch_moving_init_cache_set
(
c
);
...
...
drivers/md/bcache/util.c
View file @
65d22e91
...
...
@@ -168,10 +168,14 @@ int bch_parse_uuid(const char *s, char *uuid)
void
bch_time_stats_update
(
struct
time_stats
*
stats
,
uint64_t
start_time
)
{
uint64_t
now
=
local_clock
();
uint64_t
duration
=
time_after64
(
now
,
start_time
)
uint64_t
now
,
duration
,
last
;
spin_lock
(
&
stats
->
lock
);
now
=
local_clock
();
duration
=
time_after64
(
now
,
start_time
)
?
now
-
start_time
:
0
;
uint64_t
last
=
time_after64
(
now
,
stats
->
last
)
last
=
time_after64
(
now
,
stats
->
last
)
?
now
-
stats
->
last
:
0
;
stats
->
max_duration
=
max
(
stats
->
max_duration
,
duration
);
...
...
@@ -188,6 +192,8 @@ void bch_time_stats_update(struct time_stats *stats, uint64_t start_time)
}
stats
->
last
=
now
?:
1
;
spin_unlock
(
&
stats
->
lock
);
}
/**
...
...
drivers/md/bcache/util.h
View file @
65d22e91
...
...
@@ -378,6 +378,7 @@ ssize_t bch_snprint_string_list(char *buf, size_t size, const char * const list[
ssize_t
bch_read_string_list
(
const
char
*
buf
,
const
char
*
const
list
[]);
struct
time_stats
{
spinlock_t
lock
;
/*
* all fields are in nanoseconds, averages are ewmas stored left shifted
* by 8
...
...
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