Disk: only detect folders that specified by --disk-folders

Can be used to improve performance by ignoring network disks
This commit is contained in:
李通洲
2024-04-30 15:12:49 +08:00
committed by Carter Li
parent 36a0c273f9
commit 367264e549
6 changed files with 62 additions and 65 deletions
+7 -2
View File
@@ -250,7 +250,7 @@ static void detectStats(FFDisk* disk)
#endif
}
const char* ffDetectDisksImpl(FFlist* disks)
const char* ffDetectDisksImpl(FFDiskOptions* options, FFlist* disks)
{
FILE* mountsFile = setmntent("/proc/mounts", "r");
if(mountsFile == NULL)
@@ -260,7 +260,12 @@ const char* ffDetectDisksImpl(FFlist* disks)
while((device = getmntent(mountsFile)))
{
if(!isPhysicalDevice(device))
if (__builtin_expect(options->folders.length, 0))
{
if (!ffDiskMatchMountpoint(options, device->mnt_dir))
continue;
}
else if(!isPhysicalDevice(device))
continue;
//We have a valid device, add it to the list