mirror of
https://github.com/Lidarr/Lidarr
synced 2026-02-05 06:13:59 +01:00
New: Support reflink on xfs
This commit is contained in:
parent
85f369b92f
commit
859ca2cebc
1 changed files with 5 additions and 3 deletions
|
|
@ -21,6 +21,8 @@ public class DiskTransferService : IDiskTransferService
|
|||
private readonly IDiskProvider _diskProvider;
|
||||
private readonly Logger _logger;
|
||||
|
||||
private static readonly string[] _reflinkFilesystems = { "btrfs", "xfs" };
|
||||
|
||||
public DiskTransferService(IDiskProvider diskProvider, Logger logger)
|
||||
{
|
||||
_diskProvider = diskProvider;
|
||||
|
|
@ -341,11 +343,11 @@ public TransferMode TransferFile(string sourcePath, string targetPath, TransferM
|
|||
var targetDriveFormat = targetMount?.DriveFormat ?? string.Empty;
|
||||
|
||||
var isCifs = targetDriveFormat == "cifs";
|
||||
var isBtrfs = sourceDriveFormat == "btrfs" && targetDriveFormat == "btrfs";
|
||||
var tryReflink = sourceDriveFormat == targetDriveFormat && _reflinkFilesystems.Contains(sourceDriveFormat);
|
||||
|
||||
if (mode.HasFlag(TransferMode.Copy))
|
||||
{
|
||||
if (isBtrfs)
|
||||
if (tryReflink)
|
||||
{
|
||||
if (_diskProvider.TryCreateRefLink(sourcePath, targetPath))
|
||||
{
|
||||
|
|
@ -359,7 +361,7 @@ public TransferMode TransferFile(string sourcePath, string targetPath, TransferM
|
|||
|
||||
if (mode.HasFlag(TransferMode.Move))
|
||||
{
|
||||
if (isBtrfs)
|
||||
if (tryReflink)
|
||||
{
|
||||
if (isSameMount && _diskProvider.TryRenameFile(sourcePath, targetPath))
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue