From: Daan De Meyer Date: Wed, 15 Dec 2021 17:23:15 +0000 (+0100) Subject: journal: Stop reading in increments of block size during hole punching X-Git-Tag: v250-rc3~40^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F21784%2Fhead;p=thirdparty%2Fsystemd.git journal: Stop reading in increments of block size during hole punching Let's not try to be overly clever here. This code path is not overly performance sensitive and we should avoid trying to outsmart the kernel without proper benchmarking. --- diff --git a/src/journal/journald-file.c b/src/journal/journald-file.c index 64f522a7aa8..503900d5bc2 100644 --- a/src/journal/journald-file.c +++ b/src/journal/journald-file.c @@ -81,7 +81,6 @@ static int journald_file_entry_array_punch_hole(JournalFile *f, uint64_t p, uint static int journald_file_punch_holes(JournalFile *f) { HashItem items[PAYLOAD_BUFFER_SIZE / sizeof(HashItem)]; uint64_t p, sz; - size_t to_read; ssize_t n; int r; @@ -92,10 +91,9 @@ static int journald_file_punch_holes(JournalFile *f) { p = le64toh(f->header->data_hash_table_offset); sz = le64toh(f->header->data_hash_table_size); - to_read = MIN((size_t) f->last_stat.st_blksize, sizeof(items)); for (uint64_t i = p; i < p + sz; i += n) { - n = pread(f->fd, items, MIN(to_read, p + sz - i), i); + n = pread(f->fd, items, MIN(sizeof(items), p + sz - i), i); if (n < 0) return n;