Getting rid of redundand resume.vdr files.

Message ID 423EFDBB.90002@icem.com
State New
Headers

Commit Message

Carsten Koch March 21, 2005, 5 p.m. UTC
  While trying out VDR 1.3.23 today, I noticed that it does not
contain the attached patch (yes?).

Klaus, is anything wrong with my patch or my idea
or did you just did not have time yet to look at it?

Anyway, the patch still fits smoothly into VDR 1.3.23.

Cheers,

Carsten.
Hi,

I noticed that updating the recordings menu is still very slow.
Caching the data of course did speed up things, but vdr still
has to scan when /video/.update was touched (after an external
change), when it starts up, etc. Also, this has been a workaround
at best against the two basic flaws:

1) when replaying or recording, VDR floods the linux file system
    cache somewhat needlessly with data that do not need to be
    cached since they typically do not get read again while they
    reside in the cache, thus slowing down the intire system and
    not leaving room in the cache for even the directory entries,
    which makes all directoy accesses - including vdr's own recordings
    scan - rather slow.
    I know this problem is not trivial to fix, but using O_DIRECT
    on nnn.vdr files whenever possible should cure it.

2) vdr's recordings scan is slowed down further by the fact that
    VDR opens all resume.vdr files to see if the recording is rewound.
    This problem can be greatly reduced by two steps:
    a) Remove the resume.vdr file if it points to (almost) the
       beginning of the file.
       Patch included.
    b) Never try to read it. If the directory entry is there,
       with the above patch it can be assumed that the recording
       is not rewound.

Carsten.
  

Comments

Klaus Schmidinger March 21, 2005, 5:05 p.m. UTC | #1
Carsten Koch wrote:
> While trying out VDR 1.3.23 today, I noticed that it does not
> contain the attached patch (yes?).
> 
> Klaus, is anything wrong with my patch or my idea
> or did you just did not have time yet to look at it?

Didn't have time to look into it, yet.

Klaus
  

Patch

--- /tmp/vdr-1.3.17/recording.c	2004-11-01 15:04:47.000000000 +0100
+++ recording.c	2005-01-30 13:30:03.383815096 +0100
@@ -193,15 +193,25 @@ 
 
 bool cResumeFile::Save(int Index)
 {
-  if (fileName) {
-     int f = open(fileName, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
-     if (f >= 0) {
-        if (safe_write(f, &Index, sizeof(Index)) < 0)
-           LOG_ERROR_STR(fileName);
-        close(f);
+  if (fileName) 
+  {
+     if ((Index / FRAMESPERSEC) < 60)
+     {
+        Delete();
         return true;
-        }
      }
+     else
+     {
+     	int f = open(fileName, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+     	if (f >= 0) 
+	{
+     	   if (safe_write(f, &Index, sizeof(Index)) < 0)
+     	      LOG_ERROR_STR(fileName);
+     	   close(f);
+     	   return true;
+     	}
+     }
+  }
   return false;
 }