]> git.ipfire.org Git - thirdparty/util-linux.git/commit
hardlink: fix performance regression (inefficient signal evaluation)
authorKarel Zak <kzak@redhat.com>
Tue, 29 Apr 2025 10:29:32 +0000 (12:29 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 19 Jun 2025 08:28:45 +0000 (10:28 +0200)
commit6e4f4a2359d7d1f69642271fb86db04147703952
treebe0a9139b3e40d71eb27dc4981739efbf96873bf
parent68cbde108e25ae2cb40ff60ef8670b22d385374d
hardlink: fix performance regression (inefficient signal evaluation)

During work on better verbose output, I found a regression between
v2.40 and v2.41 (and v2.42). In the new version, hardlink is 3-4 times
slower.

The problem is in the function where we verify signals. It calls the
function signal() even though no signal is delivered. It's called in
code loops where hardlink scans files, making it a performance-sensitive
area.

Another significant performance improvement is using an inline function
for handle_interrupt().

This simple patch improves hardlink performance by 10 times.

Fixes: http://github.com/util-linux/util-linux/commit/1453200e22dd4ec858be027653c167225f2fb358
Signed-off-by: Karel Zak <kzak@redhat.com>
(cherry picked from commit 87831fa19e241803f93556cbeaad153e6ba89b6c)
misc-utils/hardlink.c