logo

oasis

Own branch of Oasis Linux (upstream: <https://git.sr.ht/~mcf/oasis/>) git clone https://anongit.hacktivis.me/git/oasis.git

0002-Choose-larger-pieces-for-larger-sizes.patch (1123B)


  1. From ed525431bbe23d61c4c8dd4664c13bc19b4db889 Mon Sep 17 00:00:00 2001
  2. From: Michael Forney <mforney@mforney.org>
  3. Date: Mon, 24 Apr 2023 21:09:06 -0700
  4. Subject: [PATCH] Choose larger pieces for larger sizes
  5. ---
  6. libtransmission/makemeta.c | 21 ++++++++++++++++++---
  7. 1 file changed, 18 insertions(+), 3 deletions(-)
  8. diff --git a/libtransmission/makemeta.c b/libtransmission/makemeta.c
  9. index 713f3e5cb..ae422395d 100644
  10. --- a/libtransmission/makemeta.c
  11. +++ b/libtransmission/makemeta.c
  12. @@ -88,9 +88,24 @@ static struct FileList* getFiles(char const* dir, char const* base, struct FileL
  13. static uint32_t bestPieceSize(uint64_t totalSize)
  14. {
  15. - uint32_t const KiB = 1024;
  16. - uint32_t const MiB = 1048576;
  17. - uint32_t const GiB = 1073741824;
  18. + uint64_t const KiB = 1024;
  19. + uint64_t const MiB = 1048576;
  20. + uint64_t const GiB = 1073741824;
  21. +
  22. + if (totalSize >= 16 * GiB)
  23. + {
  24. + return 16 * MiB;
  25. + }
  26. +
  27. + if (totalSize >= 8 * GiB)
  28. + {
  29. + return 8 * MiB;
  30. + }
  31. +
  32. + if (totalSize >= 4 * GiB)
  33. + {
  34. + return 4 * MiB;
  35. + }
  36. if (totalSize >= 2 * GiB)
  37. {
  38. --
  39. 2.37.3