summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2013-08-21 13:59:06 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2013-08-21 13:59:06 +0200
commit77da7bb20c4daa019d3642680ee4fec3dd5c21e3 (patch)
tree20ae28fb39a661a6e3c440ef3f695c1daaa6a891
parentacdfbb5aadea58af8c74011bb19ae05dfdd08d89 (diff)
downloadvdr-77da7bb20c4daa019d3642680ee4fec3dd5c21e3.tar.gz
vdr-77da7bb20c4daa019d3642680ee4fec3dd5c21e3.tar.bz2
No longer trying to delete old recordings in AssertFreeDiskSpace() if the given Priority is less than 1
-rw-r--r--HISTORY2
-rw-r--r--recording.c48
2 files changed, 28 insertions, 22 deletions
diff --git a/HISTORY b/HISTORY
index 515cfe51..794ef406 100644
--- a/HISTORY
+++ b/HISTORY
@@ -7816,3 +7816,5 @@ Video Disk Recorder Revision History
2013-08-21: Version 2.0.3
- Fixed asserting free disk space in the cutter.
+- No longer trying to delete old recordings in AssertFreeDiskSpace() if the given
+ Priority is less than 1.
diff --git a/recording.c b/recording.c
index b1ca9c5a..8ea5b9e8 100644
--- a/recording.c
+++ b/recording.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: recording.c 2.91.1.1 2013/04/11 08:20:03 kls Exp $
+ * $Id: recording.c 2.91.1.2 2013/08/21 13:58:35 kls Exp $
*/
#include "recording.h"
@@ -178,34 +178,38 @@ void AssertFreeDiskSpace(int Priority, bool Force)
return; // the next call will actually remove it
}
// No "deleted" files to remove, so let's see if we can delete a recording:
- isyslog("...no deleted recording found, trying to delete an old recording...");
- cThreadLock RecordingsLock(&Recordings);
- if (Recordings.Count()) {
- cRecording *r = Recordings.First();
- cRecording *r0 = NULL;
- while (r) {
- if (r->IsOnVideoDirectoryFileSystem()) { // only delete recordings that will actually increase the free video disk space
- if (!r->IsEdited() && r->Lifetime() < MAXLIFETIME) { // edited recordings and recordings with MAXLIFETIME live forever
- if ((r->Lifetime() == 0 && Priority > r->Priority()) || // the recording has no guaranteed lifetime and the new recording has higher priority
- (r->Lifetime() > 0 && (time(NULL) - r->Start()) / SECSINDAY >= r->Lifetime())) { // the recording's guaranteed lifetime has expired
- if (r0) {
- if (r->Priority() < r0->Priority() || (r->Priority() == r0->Priority() && r->Start() < r0->Start()))
- r0 = r; // in any case we delete the one with the lowest priority (or the older one in case of equal priorities)
+ if (Priority > 0) {
+ isyslog("...no deleted recording found, trying to delete an old recording...");
+ cThreadLock RecordingsLock(&Recordings);
+ if (Recordings.Count()) {
+ cRecording *r = Recordings.First();
+ cRecording *r0 = NULL;
+ while (r) {
+ if (r->IsOnVideoDirectoryFileSystem()) { // only delete recordings that will actually increase the free video disk space
+ if (!r->IsEdited() && r->Lifetime() < MAXLIFETIME) { // edited recordings and recordings with MAXLIFETIME live forever
+ if ((r->Lifetime() == 0 && Priority > r->Priority()) || // the recording has no guaranteed lifetime and the new recording has higher priority
+ (r->Lifetime() > 0 && (time(NULL) - r->Start()) / SECSINDAY >= r->Lifetime())) { // the recording's guaranteed lifetime has expired
+ if (r0) {
+ if (r->Priority() < r0->Priority() || (r->Priority() == r0->Priority() && r->Start() < r0->Start()))
+ r0 = r; // in any case we delete the one with the lowest priority (or the older one in case of equal priorities)
+ }
+ else
+ r0 = r;
}
- else
- r0 = r;
}
}
+ r = Recordings.Next(r);
}
- r = Recordings.Next(r);
+ if (r0 && r0->Delete()) {
+ Recordings.Del(r0);
+ return;
}
- if (r0 && r0->Delete()) {
- Recordings.Del(r0);
- return;
}
+ // Unable to free disk space, but there's nothing we can do about that...
+ isyslog("...no old recording found, giving up");
}
- // Unable to free disk space, but there's nothing we can do about that...
- isyslog("...no old recording found, giving up");
+ else
+ isyslog("...no deleted recording found, priority %d too low to trigger deleting an old recording", Priority);
Skins.QueueMessage(mtWarning, tr("Low disk space!"), 5, -1);
}
LastFreeDiskCheck = time(NULL);