diff options
author | Seppo Yli-Olli <seppo.yliolli@gmail.com> | 2023-03-14 21:25:08 +0200 |
---|---|---|
committer | Seppo Yli-Olli <seppo.yliolli@gmail.com> | 2023-03-15 12:04:02 +0200 |
commit | 931a85d3f15554cb6428965ffebbe7d8eb0b43e4 (patch) | |
tree | ff67c32ff3918af8c93f07d3a1f5a99508906778 | |
parent | e7c414cbff3fad73e4527a280db494b2dcbc7b03 (diff) | |
download | ostree-931a85d3f15554cb6428965ffebbe7d8eb0b43e4.tar.gz |
Increase buffer size for create_regular_tmpfile_linkable_with_content
The small buffer size results in really bad performance under any
FUSE-based filesystems with round-trips.
-rw-r--r-- | src/libostree/ostree-repo-commit.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libostree/ostree-repo-commit.c b/src/libostree/ostree-repo-commit.c index 7f668b7d..4acc1e7f 100644 --- a/src/libostree/ostree-repo-commit.c +++ b/src/libostree/ostree-repo-commit.c @@ -678,12 +678,13 @@ create_regular_tmpfile_linkable_with_content (OstreeRepo *self, * e.g. 10 bytes but is actually gigabytes. * - Due to GLib bugs that pointlessly calls `poll()` on the output fd for every write */ - char buf[8192]; + gsize buf_size = MIN(length, 1048576); + g_autofree gchar * buf = g_malloc(buf_size); guint64 remaining = length; while (remaining > 0) { const gssize bytes_read = - g_input_stream_read (input, buf, MIN (remaining, sizeof (buf)), cancellable, error); + g_input_stream_read (input, buf, MIN (remaining, buf_size), cancellable, error); if (bytes_read < 0) return FALSE; else if (bytes_read == 0) |