From patchwork Sun Sep 4 11:00:24 2005 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carsten Koch X-Patchwork-Id: 12007 Received: from mail.icem.de ([158.225.1.2]) by www.linuxtv.org with esmtp (Exim 4.34) id 1EBsEn-00028k-JA for vdr@linuxtv.org; Sun, 04 Sep 2005 13:00:37 +0200 Received: from localhost (localhost [127.0.0.1]) by mail.icem.de (Postfix) with ESMTP id 8D653125CA9 for ; Sun, 4 Sep 2005 13:00:36 +0200 (CEST) Received: from mail.icem.de ([127.0.0.1]) by localhost (melpumpe [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 12881-10; Sun, 4 Sep 2005 13:00:31 +0200 (CEST) Received: from [192.168.25.3] (wald3.icemnet.de [192.168.25.3]) by mail.icem.de (Postfix) with ESMTP id 8121F125BA8 for ; Sun, 4 Sep 2005 13:00:27 +0200 (CEST) Message-ID: <431AD3C8.9030603@icem.com> Date: Sun, 04 Sep 2005 13:00:24 +0200 From: Carsten Koch User-Agent: Mozilla Thunderbird 1.0 (X11/20041207) X-Accept-Language: en-us, en MIME-Version: 1.0 To: vdr@linuxtv.org Subject: Re: [vdr] [PATCH] Getting rid of redundant resume.vdr files. References: <41FCE7F2.6060304@icem.com> In-Reply-To: <41FCE7F2.6060304@icem.com> X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at icem.com X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Klaus Schmidinger's VDR List-Id: Klaus Schmidinger's VDR List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2005 11:00:37 -0000 Status: O X-Status: X-Keywords: X-UID: 4743 Carsten Koch wrote: ... > 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. Attached is an updated version of my patch for VDR 1.3.31. > 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. diff -ur vdr-1.3.31/recording.c vdr-1.3.31+DeleteResume/recording.c --- vdr-1.3.31/recording.c 2005-08-13 16:00:48.000000000 +0200 +++ vdr-1.3.31+DeleteResume/recording.c 2005-09-04 12:51:07.766593688 +0200 @@ -199,13 +199,19 @@ bool cResumeFile::Save(int Index) { if (fileName) { - int f = open(fileName, O_WRONLY | O_CREAT | O_TRUNC, DEFFILEMODE); - if (f >= 0) { - if (safe_write(f, &Index, sizeof(Index)) < 0) - LOG_ERROR_STR(fileName); - close(f); - return true; - } + if (Index / FRAMESPERSEC < 60) { + Delete(); + return true; + } + else { + int f = open(fileName, O_WRONLY | O_CREAT | O_TRUNC, DEFFILEMODE); + if (f >= 0) { + if (safe_write(f, &Index, sizeof(Index)) < 0) + LOG_ERROR_STR(fileName); + close(f); + return true; + } + } } return false; }