From 7a919b86a11250967a00838f906b9d7c8a17a95d Mon Sep 17 00:00:00 2001 From: Stewart Smith Date: Fri, 9 Feb 2024 02:10:58 +0000 Subject: [PATCH] Don't fsync() in checksum This gives a major boost in librepo performance. For a reposync of an Amazon Linux 2023 x86-64 repository on a m5n.16xlarge EC2 instance with a 500MB/sec 3000IOP EBS volume, this alone reduces run time by 30 seconds of wall time, and gets reposync nearly using a whole core rather than only two thirds of one. --- librepo/checksum.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/librepo/checksum.c b/librepo/checksum.c index 4831ddca..6e9aa496 100644 --- a/librepo/checksum.c +++ b/librepo/checksum.c @@ -266,17 +266,6 @@ lr_checksum_fd_compare(LrChecksumType type, *matches = (strcmp(expected, checksum)) ? FALSE : TRUE; - if (fsync(fd) != 0) { - if (errno == EROFS || errno == EINVAL) { - g_debug("fsync failed: %s", strerror(errno)); - } else { - g_set_error(err, LR_CHECKSUM_ERROR, LRE_FILE, - "fsync failed: %s", strerror(errno)); - lr_free(checksum); - return FALSE; - } - } - if (caching && *matches && timestamp != -1) { // Store timestamp and checksum as extended file attribute if caching is enabled FSETXATTR(fd, timestamp_key, timestamp_str, strlen(timestamp_str), 0);