Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linux-dvb] Improved find command in vdr recordings menu



  Hi Klaus and everyone,

  Here is a diff that makes my Recordings-menu to react 10 times faster on
some conditions and prevents the 60 sec watchdog from tripping.  My setup
has file size limited to 100 MB, for historical reasons (I had a FAT
partition that corrupted files on crash) and also because I want to
experiment with in-place editing with minimal copying of files.  Anyway,
this reduces number of stat64 calls in the find command from 3400 to 860
in a 100G partition, and makes the menu usable again.

  The trick is to stop scanning *.rec and *.del directories, so that *.vdr
files are not stat'd.

--- old/vdr-1.2.6/recording.c	Sat Nov  8 17:25:35 2003
+++ vdr-1.2.6/recording.c	Wed Dec 10 09:42:34 2003
@@ -46,7 +46,7 @@
 #define SUMMARYFILESUFFIX "/summary.vdr"
 #define MARKSFILESUFFIX   "/marks.vdr"

-#define FINDCMD      "cd '%s' && find '%s' -follow -type d -name '%s' 2> /dev/null"
+#define FINDCMD      "cd '%s' && find '%s' -follow -type d -name '%s' -print -prune -o -follow -type d -name '%s' -prune 2> /dev/null"

 #define MINDISKSPACE 1024 // MB

@@ -621,7 +621,7 @@
   Clear();
   bool result = false;
   char *cmd = NULL;
-  asprintf(&cmd, FINDCMD, VideoDirectory, VideoDirectory, Deleted ? "*" DELEXT : "*" RECEXT);
+  asprintf(&cmd, FINDCMD, VideoDirectory, VideoDirectory, Deleted ? "*" DELEXT : "*" RECEXT, Deleted ? "*" RECEXT : "*" DELEXT);
   FILE *p = popen(cmd, "r");
   if (p) {
      char *s;

-- 
Foreca Ltd                                           Jaakko.Hyvatti@foreca.com
Pursimiehenkatu 29-31 B, FIN-00150 Helsinki, Finland     http://www.foreca.com
-- 
Jaakko.Hyvatti@iki.fi         http://www.iki.fi/hyvatti/        +358 40 5011222
echo 'movl $36,%eax;int $128;movl $0,%ebx;movl $1,%eax;int $128'|as -o/bin/sync


-- 
Info:
To unsubscribe send a mail to ecartis@linuxtv.org with "unsubscribe linux-dvb" as subject.



Home | Main Index | Thread Index