public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@debian.org>
To: Anthony Chee <anthony.chee@polyu.edu.hk>
Cc: linux-fsdevel@vger.kernel.org
Subject: Re: delete file entry and free space
Date: Sun, 19 May 2002 01:41:41 +0100	[thread overview]
Message-ID: <20020519014141.C16740@parcelfarce.linux.theplanet.co.uk> (raw)
In-Reply-To: <000601c1febf$4b045bb0$0100a8c0@winxp>; from anthony.chee@polyu.edu.hk on Sun, May 19, 2002 at 06:56:48AM +0800

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.

  reply	other threads:[~2002-05-19  0:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-18 22:56 delete file entry and free space Anthony Chee
2002-05-19  0:41 ` Matthew Wilcox [this message]
2002-05-19 12:25   ` Anthony Chee
2002-05-19 14:47     ` Matthew Wilcox
  -- strict thread matches above, loose matches on Subject: below --
2002-05-20 23:28 Bryan Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020519014141.C16740@parcelfarce.linux.theplanet.co.uk \
    --to=willy@debian.org \
    --cc=anthony.chee@polyu.edu.hk \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox