From mboxrd@z Thu Jan 1 00:00:00 1970 From: Howard Chu Subject: Re: truncate head of file? Date: Fri, 29 Aug 2014 06:06:17 +0100 Message-ID: <54000A49.5010201@symas.com> References: <53F435EC.4030601@symas.com> <53F447A8.8020804@symas.com> <53F7D0CF.9070205@infradead.org> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: linux-fsdevel To: Randy Dunlap , =?windows-1252?Q?Luk=E1=9A_Cz?= =?windows-1252?Q?erner?= Return-path: Received: from zill.ext.symas.net ([69.43.206.106]:35549 "EHLO zill.ext.symas.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751795AbaH2FGZ (ORCPT ); Fri, 29 Aug 2014 01:06:25 -0400 In-Reply-To: <53F7D0CF.9070205@infradead.org> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Randy Dunlap wrote: > On 08/20/14 00:00, Howard Chu wrote: >> Luk=E1=9A Czerner wrote: >>> On Tue, 19 Aug 2014, Howard Chu wrote: >>> >>>> Date: Tue, 19 Aug 2014 22:45:16 -0700 >>>> From: Howard Chu >>>> To: linux-fsdevel >>>> Subject: truncate head of file? >>>> >>>> Was thinking it would be very handy to have a truncate() variant t= hat deletes >>>> pages from the head of a file. This could be leveraged to make log= files easier >>>> to maintain, as an example. Anyone else interested, think this wou= ld be nice >>>> to have? >>>> >>>> (Note - not the same as just punching holes in the beginning of th= e file - we >>>> want the beginning of the file to advance as well, past the delete= d pages.) >>> >>> I am not really sure I understand the behaviour you'd like to see. >>> Can you please explain the behaviour including more concrete use >>> case ? >> >> For example - we have a logfile (opened O_APPEND) that grows continu= ously. We want to delete some old log info from the head of the file. W= e could use "hole punching" to cause a specific range of data to be fre= ed, but that just leaves a sparse file. If we were to cat this file the= read() would have to advance thru all of that empty space before arriv= ing at actual log data. We want both the data to be freed and for the l= ogical beginning of the file to be moved forward, to match the location= of where the remaining data begins. >> >> Freeing the space would be simplest if we just deallocate X pages fr= om the file, and then the beginning of the file becomes the beginning o= f the first remaining page of the file. >> > > Hi Howard, > > I am still interested in what you mean by a "page" of a file? > Is it fixed size? What determines page size? I meant a typical page as used by the memory manager. For the most part= that=20 means e.g. 4KB since "large" page sizes are not actually pageable. --=20 -- Howard Chu CTO, Symas Corp. http://www.symas.com Director, Highland Sun http://highlandsun.com/hyc/ Chief Architect, OpenLDAP http://www.openldap.org/project/ -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel= " in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html