]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: improve performance on fsync of files with multiple hardlinks
authorFilipe Manana <fdmanana@suse.com>
Wed, 17 Apr 2019 10:31:06 +0000 (11:31 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 29 Apr 2019 17:02:52 +0000 (19:02 +0200)
commite81c9f56995d44074435eb1d9b2dd7e4fed57a97
treea5a916bcec3216bbaacda81043dd0495472b9f07
parent42836f6a51b8d1a883b9ea3982e07f596a9b0b08
Btrfs: improve performance on fsync of files with multiple hardlinks

Commit bd8c0888913d8c ("Btrfs: fix fsync of files with multiple hard links
in new directories") introduced a path that makes fsync fallback to a full
transaction commit in order to avoid losing hard links and new ancestors
of the fsynced inode. That path is triggered only when the inode has more
than one hard link and either has a new hard link created in the current
transaction or the inode was evicted and reloaded in the current
transaction.

That path ends up getting triggered very often (hundreds of times) during
the course of pgbench benchmarks, resulting in performance drops of about
20%.

This change restores the performance by not triggering the full transaction
commit in those cases, and instead iterate the fs/subvolume tree in search
of all possible new ancestors, for all hard links, to log them.

Reported-by: Zhao Yuhu <zyuhu@suse.com>
Tested-by: James Wang <jnwang@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/btrfs_inode.h
fs/btrfs/inode.c
fs/btrfs/tree-log.c