From mboxrd@z Thu Jan 1 00:00:00 1970 From: Randy Dunlap Subject: Re: truncate head of file? Date: Fri, 22 Aug 2014 16:22:55 -0700 Message-ID: <53F7D0CF.9070205@infradead.org> References: <53F435EC.4030601@symas.com> <53F447A8.8020804@symas.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: linux-fsdevel To: Howard Chu , =?windows-1252?Q?Luk=E1=9A_Czerner?= Return-path: Received: from casper.infradead.org ([85.118.1.10]:59123 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752464AbaHVXXA (ORCPT ); Fri, 22 Aug 2014 19:23:00 -0400 In-Reply-To: <53F447A8.8020804@symas.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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 th= at deletes >>> pages from the head of a file. This could be leveraged to make logf= iles easier >>> to maintain, as an example. Anyone else interested, think this woul= d be nice >>> to have? >>> >>> (Note - not the same as just punching holes in the beginning of the= file - we >>> want the beginning of the file to advance as well, past the deleted= 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 ? >=20 > For example - we have a logfile (opened O_APPEND) that grows continuo= usly. We want to delete some old log info from the head of the file. We= could use "hole punching" to cause a specific range of data to be free= d, 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 arrivi= ng at actual log data. We want both the data to be freed and for the lo= gical beginning of the file to be moved forward, to match the location = of where the remaining data begins. >=20 > Freeing the space would be simplest if we just deallocate X pages fro= m the file, and then the beginning of the file becomes the beginning of= the first remaining page of the file. >=20 Hi Howard, I am still interested in what you mean by a "page" of a file? Is it fixed size? What determines page size? Thanks, --=20 ~Randy -- 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