Seems that the issue with Samsung drives on macOS is due to an inherent issue with the APFS implementation and the trim operation.
From the OpenCore 0.6.6 release notes:
A message from vit9696 Dortania Updates Changelogs
dortania.github.io
“Sometimes the changes are not dictated by the necessity to improve things on our end or even our bugs, but rather flaws in the design & code of the other parties. This release includes three changes that happened due to exactly this kind of issues. One of them is the result of Apple’s APFS design, which does not track trimmed areas, resulting in essentially broken trim support for a vast amount of third-party SSDs. The discovery and an ugly workaround are described in the
SetApfsTrimTimeout section thanks to
@lvs1974’s efforts.”
Then in the OpenCore 0.6.6 configuration PDF (
https://github.com/acidanthera/OpenCorePkg/raw/master/Docs/Configuration.pdf)
At 17. SetApfsTrimTimeout Type (Kernel->Quirks):
“APFS filesystem is designed in a way that the space controlled via spaceman structure is either used or free. This may be different in other filesystems where the areas can be marked as used, free, and unmapped. All free space is trimmed (unmapped/deallocated) at macOS startup. The trimming procedure for NVMe drives happens in LBA ranges due to the nature of DSM command with up to 256 ranges per command. The more fragmented the memory on the drive is, the more commands are necessary to trim all the free space.
Depending on the SSD controller and the drive fragmentation trim procedure may take considerable amount of time, causing noticeable boot slowdown APFS driver explicitly ignores previously unmapped areas and trims them on boot again and again. To workaround boot slowdown macOS driver introduced a timeout (9.999999 seconds) that stops trim operation when it did not manage to complete in time. On many controllers, such as Samsung, where the deallocation is not very fast, the timeout is reached very quickly. Essentially it means that macOS will try to trim all the same lower blocks that have already been deallocated, but will never have enough time to deallocate higher blocks once the fragmentation increases. This means that trimming on these SSDs will be broken soon after the installation, causing extra wear to the flash.
One way to workaround the problem is to increase the timeout to a very high value, which at the cost of slow boot times (extra minutes) will ensure that all the blocks are trimmed. For this one can set this option to a high value, e.g. 4294967295.
Another way is to utilize over-provisioning if it is supported or create a dedicated unmapped partition where the reserve blocks can be found by the controller. In this case the trim operation can also be disabled by setting a very low timeout. e.g. 999.”