From 8876503c53e612c2663578b2a7750333d9dca208 Mon Sep 17 00:00:00 2001 From: Yeechang Lee Date: Fri, 21 Jun 2013 14:28:31 -0700 Subject: [PATCH] Allow the Disk I/O Storage Group scheduler to fallback to free space The "Balanced Disk I/O" Storage Group scheduler was indeterminate when the weights of two filesystems were equal. This commit makes that decision more determinate by allowing the scheduler to fall back to using the amount of free space on the filesystems to make the decision when two filesystems have the same weight. Closes #10946. Signed-off-by: Chris Pinkham --- mythtv/programs/mythbackend/scheduler.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mythtv/programs/mythbackend/scheduler.cpp b/mythtv/programs/mythbackend/scheduler.cpp index 5e0ecdef48f..17e02db0440 100644 --- a/mythtv/programs/mythbackend/scheduler.cpp +++ b/mythtv/programs/mythbackend/scheduler.cpp @@ -4502,11 +4502,19 @@ static bool comp_storage_free_space(FileSystemInfo *a, FileSystemInfo *b) return false; } -// prefer dirs with less weight (disk I/O) over dirs with more weight +// prefer dirs with less weight (disk I/O) over dirs with more weight. +// if weights are equal, prefer dirs with more absolute free space over less static bool comp_storage_disk_io(FileSystemInfo *a, FileSystemInfo *b) { if (a->getWeight() < b->getWeight()) + { return true; + } + else if (a->getWeight() == b->getWeight()) + { + if (a->getFreeSpace() > b->getFreeSpace()) + return true; + } return false; }