Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit eca76e78 authored by Jaegeuk Kim's avatar Jaegeuk Kim
Browse files

f2fs: avoid needless lock for node pages when fsyncing a file



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: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent c27753d6
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -1272,10 +1272,14 @@ int sync_node_pages(struct f2fs_sb_info *sbi, nid_t ino,
			 * we should not skip writing node pages.
			 */
lock_node:
			if (ino && ino_of_node(page) == ino)
			if (ino) {
				if (ino_of_node(page) == ino)
					lock_page(page);
			else if (!trylock_page(page))
				else
					continue;
			} else if (!trylock_page(page)) {
				continue;
			}

			if (unlikely(page->mapping != NODE_MAPPING(sbi))) {
continue_unlock: