]> git.karo-electronics.de Git - linux-beck.git/commitdiff
f2fs: avoid needless lock for node pages when fsyncing a file
authorJaegeuk Kim <jaegeuk@kernel.org>
Wed, 13 Apr 2016 23:14:38 +0000 (16:14 -0700)
committerJaegeuk Kim <jaegeuk@kernel.org>
Tue, 26 Apr 2016 21:24:30 +0000 (14:24 -0700)
When fsync is called, sync_node_pages finds a proper direct node pages to flush.
But, it locks unrelated direct node pages together unnecessarily.

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

index 095fc2c96e16e3b8ba85af4a3ad3703b53af8ce7..cccee5006cddf2131da53ef4f2594a814090ba82 100644 (file)
@@ -1272,10 +1272,14 @@ next_step:
                         * we should not skip writing node pages.
                         */
 lock_node:
-                       if (ino && ino_of_node(page) == ino)
-                               lock_page(page);
-                       else if (!trylock_page(page))
+                       if (ino) {
+                               if (ino_of_node(page) == ino)
+                                       lock_page(page);
+                               else
+                                       continue;
+                       } else if (!trylock_page(page)) {
                                continue;
+                       }
 
                        if (unlikely(page->mapping != NODE_MAPPING(sbi))) {
 continue_unlock: