From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <7ea713cb549c1d7b91a32c77987b62c2@collyer.net> To: 9fans@cse.psu.edu Subject: Re: [9fans] truncation via wstat on ken's fs Date: Sun, 17 Oct 2004 17:43:25 -0700 From: geoff@collyer.net In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Topicbox-Message-UUID: ef93d3b4-eacd-11e9-9e20-41e7f4b1d025 Good point, Russ, and I had done something similar (cloned dtrunc() and added a length argument). Ken frees blocks in reverse order (last block freed first), presumably to assist repairs if the system should crash in the middle of it, or something of the sort. The obvious way to truncate is to walk to the point of truncation, zero any partial block after it, then free data blocks (and if feasible indirect blocks) while walking to EOF. Doing this backward is a little messier.