summaryrefslogtreecommitdiffstats
path: root/drivers/md/bcache/util.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2013-11-14 08:29:01 -0700
committerJens Axboe <axboe@kernel.dk>2013-11-14 08:29:01 -0700
commit1355b37f111b35cd6f53078ce63997aec473629f (patch)
tree590ecf1b148fc631336213a956d8456ce85bdc42 /drivers/md/bcache/util.c
parentf618ef7c47934d1686a764d0c9f70f23e566683f (diff)
parentc86949486d41d9e7d7681fc72923555114fd702f (diff)
Merge branch 'for-3.13/post-mq-drivers' into for-linus
Diffstat (limited to 'drivers/md/bcache/util.c')
-rw-r--r--drivers/md/bcache/util.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/md/bcache/util.c b/drivers/md/bcache/util.c
index 420dad545c7..462214eeacb 100644
--- a/drivers/md/bcache/util.c
+++ b/drivers/md/bcache/util.c
@@ -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);
}
/**