diff options
author | Coly Li <colyli@suse.de> | 2018-08-11 01:20:00 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2018-08-11 17:46:42 -0400 |
commit | eb2b3d034511f7f5f5fa781b9354ea4d5dbd4fc5 (patch) | |
tree | ad0d16a069090d085913618d74c928ef828417bc | |
parent | d0c1b89a409fb8f55783e95effeb60d703f81061 (diff) |
bcache: add the missing comments for smp_mb()/smp_wmb()
Checkpatch.pl warns there are 2 locations of smp_mb() and smp_wmb()
without code comment. This patch adds the missing code comments for
these memory barrier calls.
Signed-off-by: Coly Li <colyli@suse.de>
Reviewed-by: Shenghui Wang <shhuiw@foxmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | drivers/md/bcache/closure.h | 4 | ||||
-rw-r--r-- | drivers/md/bcache/super.c | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/drivers/md/bcache/closure.h b/drivers/md/bcache/closure.h index 7f3594c0be14..eca0d496b686 100644 --- a/drivers/md/bcache/closure.h +++ b/drivers/md/bcache/closure.h | |||
@@ -289,10 +289,12 @@ static inline void closure_init_stack(struct closure *cl) | |||
289 | } | 289 | } |
290 | 290 | ||
291 | /** | 291 | /** |
292 | * closure_wake_up - wake up all closures on a wait list. | 292 | * closure_wake_up - wake up all closures on a wait list, |
293 | * with memory barrier | ||
293 | */ | 294 | */ |
294 | static inline void closure_wake_up(struct closure_waitlist *list) | 295 | static inline void closure_wake_up(struct closure_waitlist *list) |
295 | { | 296 | { |
297 | /* Memory barrier for the wait list */ | ||
296 | smp_mb(); | 298 | smp_mb(); |
297 | __closure_wake_up(list); | 299 | __closure_wake_up(list); |
298 | } | 300 | } |
diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index e637d74e2908..94c756c66bd7 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c | |||
@@ -1136,11 +1136,11 @@ int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c, | |||
1136 | list_move(&dc->list, &c->cached_devs); | 1136 | list_move(&dc->list, &c->cached_devs); |
1137 | calc_cached_dev_sectors(c); | 1137 | calc_cached_dev_sectors(c); |
1138 | 1138 | ||
1139 | smp_wmb(); | ||
1140 | /* | 1139 | /* |
1141 | * dc->c must be set before dc->count != 0 - paired with the mb in | 1140 | * dc->c must be set before dc->count != 0 - paired with the mb in |
1142 | * cached_dev_get() | 1141 | * cached_dev_get() |
1143 | */ | 1142 | */ |
1143 | smp_wmb(); | ||
1144 | refcount_set(&dc->count, 1); | 1144 | refcount_set(&dc->count, 1); |
1145 | 1145 | ||
1146 | /* Block writeback thread, but spawn it */ | 1146 | /* Block writeback thread, but spawn it */ |