On Aug 20, 2014, at 1:00 AM, Howard Chu <hyc@xxxxxxxxx> wrote: > For example - we have a logfile (opened O_APPEND) that grows continuously. 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 freed, 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 arriving at actual log data. We want both the data to be freed and for the logical beginning of the file to be moved forward, to match the location of where the remaining data begins. It would also be possible to use fallocate(FALLOC_FL_PUNCH_HOLE) to punch out the processed records, and seek(SEEK_DATA) to find the first record that has not been processed. That would avoid problems with the file size changing and O_APPEND. Cheers, Andreas
Attachment:
signature.asc
Description: Message signed with OpenPGP using GPGMail