summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2020-08-07 00:11:38 +0200
committerCarl Hetherington <cth@carlh.net>2020-08-07 00:17:04 +0200
commit6c685e0cd6143dd7a8b1a9b5631b1bc9c0c4d687 (patch)
tree9dc4bdf16691d20ff659d7b58cccddab2bd8c0d1
parent334d3cb564c72bd430a17c6e6f01aeb488fb191c (diff)
Use a much bigger block size when calling fwrite(). Each call to fwrite()
writes a few (often around 4) blocks of (I think) directory data to the drive, so if you only fwrite() one block it ends up writing 1 block of "payload" and 4 blocks of "admin". Using bigger blocks makes it faster; an even bigger block than this makes it a little faster still, but not significantly. The extra block writing is seemingly triggered by fwrite() calling ext4_block_cache_write_back(..., 0). A better fix is probably to call this another way, at the end of the file copy.
-rw-r--r--src/tools/dcpomatic_disk_writer.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/tools/dcpomatic_disk_writer.cc b/src/tools/dcpomatic_disk_writer.cc
index a2788e18b..45a5e8c60 100644
--- a/src/tools/dcpomatic_disk_writer.cc
+++ b/src/tools/dcpomatic_disk_writer.cc
@@ -89,7 +89,8 @@ using boost::optional;
#ifdef DCPOMATIC_LINUX
static PolkitAuthority* polkit_authority = 0;
#endif
-static uint64_t const block_size = 4096;
+/* Use quite a big block size here, as ext4's fwrite() has quite a bit of overhead */
+static uint64_t const block_size = 4096 * 4096;
static Nanomsg* nanomsg = 0;
#define SHORT_TIMEOUT 100
@@ -128,7 +129,7 @@ write (boost::filesystem::path from, boost::filesystem::path to, uint64_t& total
uint8_t* buffer = new uint8_t[block_size];
Digester digester;
- int progress_frequency = 5000;
+ int progress_frequency = 1;
int progress_count = 0;
uint64_t remaining = file_size (from);
while (remaining > 0) {