f2fs: update comments for explicit memory barrier
authorChao Yu <yuchao0@huawei.com>
Sat, 20 Feb 2021 09:38:43 +0000 (17:38 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Fri, 12 Mar 2021 21:16:42 +0000 (13:16 -0800)
Add more detailed comments for explicit memory barrier used by
f2fs, in order to enhance code readability.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/checkpoint.c
fs/f2fs/segment.c

index d0e5ef7e232e3e703620414a0e51dd0998437524..f6169611270f7e3fd9ee009d0e0b56a6736964e0 100644 (file)
@@ -1818,7 +1818,11 @@ int f2fs_issue_checkpoint(struct f2fs_sb_info *sbi)
        llist_add(&req.llnode, &cprc->issue_list);
        atomic_inc(&cprc->queued_ckpt);
 
-       /* update issue_list before we wake up issue_checkpoint thread */
+       /*
+        * update issue_list before we wake up issue_checkpoint thread,
+        * this smp_mb() pairs with another barrier in ___wait_event(),
+        * see more details in comments of waitqueue_active().
+        */
        smp_mb();
 
        if (waitqueue_active(&cprc->ckpt_wait_queue))
index b8c20d29431da8f4d0bc28b43d0e8af6c872d34c..29403540ff6ed00d8797504388557ded2ce1e631 100644 (file)
@@ -653,7 +653,11 @@ int f2fs_issue_flush(struct f2fs_sb_info *sbi, nid_t ino)
 
        llist_add(&cmd.llnode, &fcc->issue_list);
 
-       /* update issue_list before we wake up issue_flush thread */
+       /*
+        * update issue_list before we wake up issue_flush thread, this
+        * smp_mb() pairs with another barrier in ___wait_event(), see
+        * more details in comments of waitqueue_active().
+        */
        smp_mb();
 
        if (waitqueue_active(&fcc->flush_wait_queue))