]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
bcache: add the missing comments for smp_mb()/smp_wmb()
authorColy Li <colyli@suse.de>
Sat, 11 Aug 2018 05:20:00 +0000 (13:20 +0800)
committerJens Axboe <axboe@kernel.dk>
Sat, 11 Aug 2018 21:46:42 +0000 (15:46 -0600)
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>
drivers/md/bcache/closure.h
drivers/md/bcache/super.c

index 7f3594c0be1494e9f93791f63bb3b8520fb96375..eca0d496b6869e78c76c3774ad819612f27661a9 100644 (file)
@@ -289,10 +289,12 @@ static inline void closure_init_stack(struct closure *cl)
 }
 
 /**
- * closure_wake_up - wake up all closures on a wait list.
+ * closure_wake_up - wake up all closures on a wait list,
+ *                  with memory barrier
  */
 static inline void closure_wake_up(struct closure_waitlist *list)
 {
+       /* Memory barrier for the wait list */
        smp_mb();
        __closure_wake_up(list);
 }
index e637d74e290869977cd9b1772f2d8212b5205c24..94c756c66bd7216a6d83b67eaef891269f965467 100644 (file)
@@ -1136,11 +1136,11 @@ int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c,
        list_move(&dc->list, &c->cached_devs);
        calc_cached_dev_sectors(c);
 
-       smp_wmb();
        /*
         * dc->c must be set before dc->count != 0 - paired with the mb in
         * cached_dev_get()
         */
+       smp_wmb();
        refcount_set(&dc->count, 1);
 
        /* Block writeback thread, but spawn it */