0002-Choose-larger-pieces-for-larger-sizes.patch (1123B)
- From ed525431bbe23d61c4c8dd4664c13bc19b4db889 Mon Sep 17 00:00:00 2001
- From: Michael Forney <mforney@mforney.org>
- Date: Mon, 24 Apr 2023 21:09:06 -0700
- Subject: [PATCH] Choose larger pieces for larger sizes
- ---
- libtransmission/makemeta.c | 21 ++++++++++++++++++---
- 1 file changed, 18 insertions(+), 3 deletions(-)
- diff --git a/libtransmission/makemeta.c b/libtransmission/makemeta.c
- index 713f3e5cb..ae422395d 100644
- --- a/libtransmission/makemeta.c
- +++ b/libtransmission/makemeta.c
- @@ -88,9 +88,24 @@ static struct FileList* getFiles(char const* dir, char const* base, struct FileL
- static uint32_t bestPieceSize(uint64_t totalSize)
- {
- - uint32_t const KiB = 1024;
- - uint32_t const MiB = 1048576;
- - uint32_t const GiB = 1073741824;
- + uint64_t const KiB = 1024;
- + uint64_t const MiB = 1048576;
- + uint64_t const GiB = 1073741824;
- +
- + if (totalSize >= 16 * GiB)
- + {
- + return 16 * MiB;
- + }
- +
- + if (totalSize >= 8 * GiB)
- + {
- + return 8 * MiB;
- + }
- +
- + if (totalSize >= 4 * GiB)
- + {
- + return 4 * MiB;
- + }
- if (totalSize >= 2 * GiB)
- {
- --
- 2.37.3