From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthew Wilcox Subject: Re: delete file entry and free space Date: Sun, 19 May 2002 01:41:41 +0100 Sender: linux-fsdevel-owner@vger.kernel.org Message-ID: <20020519014141.C16740@parcelfarce.linux.theplanet.co.uk> References: <000601c1febf$4b045bb0$0100a8c0@winxp> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org Return-path: To: Anthony Chee Content-Disposition: inline In-Reply-To: <000601c1febf$4b045bb0$0100a8c0@winxp>; from anthony.chee@polyu.edu.hk on Sun, May 19, 2002 at 06:56:48AM +0800 List-Id: linux-fsdevel.vger.kernel.org On Sun, May 19, 2002 at 06:56:48AM +0800, Anthony Chee wrote: > The myunlink function is a merge from sys_unlink() and vfs_unlink(), and > remove some permission and quota syntax, as I need to force to delete the > entry. After passing the variables to the function, the entry is disappeared > while using "ls", but I found that it still occupy disk space by using > command "df". How can I also free the disk space. My target is on releasing > the disk space, and I don't care any permission or others. Or any other > method on releasing the disk space by using dir and dentry? Thanks. Unlink probably isn't enough. On unix-like systems, space is only reclaimed once there are no references to the inode. If a task has that file open, it's still got a reference. You could unlink the file and then truncate it to zero size, but any task which still has it open could write to it, causing the file to be non-zero-sized. If you don't care about that, then see sys_ftruncate for how to proceed. -- Revolutions do not require corporate support.